Sha256: fb57b9aa67feca418d9e999c96d3959c8eb3490686287d3518c2c23dbd9604e9

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'


describe "Taza::Fixtures" do

  Taza::Fixture.stubs(:base_path).returns('./spec/sandbox/fixtures/')
  Taza.load_fixtures
  include Taza::Fixtures

  it "should be able to look up a fixture entity off fixture_methods module" do
    examples(:first_example).name.should eql('first')
  end

  it "should still raise method missing error" do
    lambda{zomgwtf(:first_example)}.should raise_error(NoMethodError)
  end

  #TODO: this test tests what is in entity's instance eval not happy with it being here
  it "should be able to look up a fixture entity off fixture_methods module" do
    examples(:first_example).user.name.should eql(users(:shatner).name)
  end

  it "should be able to resolve one to many relationships" do
    foos(:gap).examples.length.should eql(2)
  end

  it "should be able to get one to many entities" do
    foos(:gap).examples['first_example'].name.should eql('first')
    foos(:gap).examples['second_example'].name.should eql('second')
  end

  it "should not be able to access fixtures in sub-folders if not included" do
    lambda{bars(:foo)}.should raise_error(NoMethodError)
  end

  it "should template fixture files" do
    users(:shatner).age.should eql(66)
  end

  it "should be able to get one to many entities for hash[key] style" do
    foos(:gap)['examples']['first_example']['name'].should eql('first')
  end

  it "should be able to access multiple levels inside fixtures" do
    examples(:forth_example).something.user.name.should eql('William Shatner')
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
taza-0.9.2.1 spec/taza/fixtures_spec.rb
taza-0.9.2.0 spec/taza/fixtures_spec.rb
taza-0.9.1.2 spec/fixtures_spec.rb
taza-0.9.1.1 spec/fixtures_spec.rb
taza-0.9.1 spec/fixtures_spec.rb
taza-0.9.0 spec/fixtures_spec.rb