Module: Taza::Fixtures

Defined in:
lib/taza/fixture.rb

Overview

The module that will mixin methods based on the fixture files in your ‘spec/fixtures’

Example:

 describe "something" do
   it "should test something" do
     users(:jane_smith).first_name.should eql("jane")
   end
 end

where there is a spec/fixtures/users.yml file containing a entry of:

jane_smith:

first_name: jane
last_name: smith

Class Method Summary collapse

Class Method Details

.included(other_module) ⇒ Object

:nodoc:



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/taza/fixture.rb', line 53

def Fixtures.included(other_module) # :nodoc:
  fixture = Fixture.new
  fixture.load_all
  fixture.fixture_names.each do |fixture_name|
    self.class_eval do
      define_method(fixture_name) do |entity_key|
        fixture.get_fixture_entity(fixture_name,entity_key.to_s)
      end
    end
  end
end