Build Status

composable_fixtures

An elight and bhaibel joint.

Installation

NOTE: Currently depends on rspec and rspec-rails

In your spec_helper, add the following:

class RSpec::Core::ExampleGroup
  extend ComposableFixtures::ExampleGroupHelpers
end

require 'rspec/rails'

You will also want to add a FixtureSetDefinition. An example is given below.

Rough Example

ComposableFixtures.define do
    set :normal_shipped,        "spec/auditor/fixtures/normal_shipped"
    set :normal_shipped_amazon, "spec/auditor/fixtures/normal_shipped_amazon"
    set :multiple               "spec/foo/fixtures", "spec/bar/fixtures"

    compose :normal, :normal_shipped, :normal_shipped_amazon
    compose :all_fixtures, :multiple, :normal
  end

  describe Foo do
    # Any 'set' or 'compose' is a valid input and *only* loads those fixtures
    use_composed_fixture_set :normal
    fixtures :all
  end

Future direction

We envision something ala a factories.rb file for the FixtureSetDefinition that, similar to factories.rb, could conceivably be defined over multiple files for sanity's sake. Beyond that, the goal is to keep this gem relatively simple.

We have a sister project under way internally for fixture generation from sanitized production/test data; however, it is not as yet ready for public release.

Contributing to composable_fixtures

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright (c) 2015 Optoro. See LICENSE.txt for further details.