Sha256: 434c7ebcb94a34944afba7b874674b6a7bfcca582d9fdbc03b781fa664c1fd5f

Contents?: true

Size: 821 Bytes

Versions: 32

Compression:

Stored size: 821 Bytes

Contents

require 'spec_helper'

describe FactoryGirl, "aliases" do
  context "aliases for an attribute" do
    subject { FactoryGirl.aliases_for(:test) }
    it      { should include(:test) }
    it      { should include(:test_id) }
  end

  context "aliases for a foreign key" do
    subject { FactoryGirl.aliases_for(:test_id) }
    it      { should include(:test) }
    it      { should include(:test_id) }
  end

  context "aliases for an attribute starting with an underscore" do
    subject { FactoryGirl.aliases_for(:_id) }
    it      { should_not include(:id) }
  end
end

describe FactoryGirl, "after defining an alias" do
  before do
    FactoryGirl.aliases << [/(.*)_suffix/, '\1']
  end

  subject { FactoryGirl.aliases_for(:test_suffix) }

  it { should include(:test) }
  it { should include(:test_suffix_id) }
end

Version data entries

32 entries across 24 versions & 7 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/factory_girl-4.5.0/spec/factory_girl/aliases_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/aliases_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/aliases_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/aliases_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/factory_girl/aliases_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/factory_girl/aliases_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/factory_girl/aliases_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/factory_girl/aliases_spec.rb
factory_girl-4.5.0 spec/factory_girl/aliases_spec.rb
factory_girl-4.4.0 spec/factory_girl/aliases_spec.rb
factory_girl-4.3.0 spec/factory_girl/aliases_spec.rb
challah-1.0.0 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/aliases_spec.rb
challah-1.0.0.beta3 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/aliases_spec.rb
challah-1.0.0.beta2 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/aliases_spec.rb
challah-1.0.0.beta vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/aliases_spec.rb
challah-1.0.0.beta vendor/bundle/gems/factory_girl-4.1.0/spec/factory_girl/aliases_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/factory_girl-4.1.0/spec/factory_girl/aliases_spec.rb
factory_girl-4.2.0 spec/factory_girl/aliases_spec.rb
challah-0.9.1.beta vendor/bundle/gems/factory_girl-4.1.0/spec/factory_girl/aliases_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.1.0/spec/factory_girl/aliases_spec.rb