Sha256: ef80198d89f17e49f3a9cb9beb378869663a1f22c9d3fc223c667b6a48814a78

Contents?: true

Size: 730 Bytes

Versions: 4

Compression:

Stored size: 730 Bytes

Contents

require 'spec_helper'

require 'factory_girl/syntax/make'

describe "a factory using make syntax" do
  before do
    Factory.define :user do |factory|
      factory.first_name 'Bill'
      factory.last_name  'Nye'
      factory.email      'science@guys.net'
    end
  end

  after do
    Factory.factories.clear
  end

  describe "after making an instance" do
    before do
      @instance = User.make(:last_name => 'Rye')
    end

    it "should use attributes from the factory" do
      @instance.first_name.should == 'Bill'
    end

    it "should use attributes passed to make" do
      @instance.last_name.should == 'Rye'
    end

    it "should save the record" do
      @instance.should_not be_new_record
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
factory_girl-1.3.3 spec/acceptance/syntax/make_spec.rb
factory_girl-1.3.2 spec/acceptance/syntax/make_spec.rb
factory_girl-1.3.1 spec/acceptance/syntax/make_spec.rb
factory_girl-1.3.0 spec/acceptance/syntax/make_spec.rb