Fixture Group
An extension of the ActiveRecord Fixtures that make possible to create fixtures group.
Features
Rails.root/
`- test/
`- fixtures/
|- case_a/
| |- users.yml
| `- items.yml
`- case_b/
|- subcase_b1/
| |- users.yml
| `- items.yml
`- subcase_b2/
|- users.yml
`- items.yml
class FooControllerTest < ActiveSupport::TestCase
fixture_group 'case_a', :all
end
class BarScenarioTest < ActionDispatch::IntegrationTest
fixture_group 'case_b/subcase_b2', :all
end
class UserTest < ActiveSupport::TestCase
fixture_group 'case_b', :users
end
Supported versions
- Ruby 2.3 + ActiveRecord 4.2, 5.0
- Ruby 2.4 + ActiveRecord 5.0
Install
Put this line in your Gemfile:
gem 'fixture_group', group: :test
Then bundle:
% bundle
Usage
Please see *_test.rb
in test/integration.
DON'T DO THIS
class FooTest < ActiveSupport::TestCase
fixture_group 'case_a', :users
fixture_group 'case_b', :users
end
In this code, case_b/users.yml
will be loaded, but case_a/users.yml
will be ignored.
Questions, Feedback
or, feel free to message me on GitHub or Twitter (@hidakatsuya)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright
© Katsuya HIDAKA. See MIT-LICENSE for further details.