Created
December 2, 2018 06:47
-
-
Save dpaluy/8dbc256ec69967f37722ee93dbe1484f to your computer and use it in GitHub Desktop.
RSpec Helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # spec/support/fixture_helpers.rb | |
| def fixture_file_path(filename) | |
| Rails.root.join("spec/fixtures/#{filename}").to_s | |
| end | |
| def read_fixture_file(filename) | |
| File.read fixture_file_path(filename) | |
| end | |
| def yaml_fixture_file(filename) | |
| YAML.load_file(fixture_file_path(filename)) | |
| end | |
| __END__ | |
| # Usage | |
| RSpec.describe LoadItems do | |
| let(:source) { read_fixture_file('items.xml') } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment