Sha256: 800ea682dcfaed82ef8ecea2898fde5e513962cb3419c602a95e7db8178e9306

Contents?: true

Size: 817 Bytes

Versions: 185

Compression:

Stored size: 817 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 Factory, "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

185 entries across 83 versions & 7 rubygems

Version Path
classiccms-0.6.3 vendor/bundle/gems/factory_girl-3.3.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.3 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.2 vendor/bundle/gems/factory_girl-3.2.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.2 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.2 vendor/bundle/gems/factory_girl-3.3.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.1 vendor/bundle/gems/factory_girl-3.3.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.1 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.1 vendor/bundle/gems/factory_girl-3.2.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.0 vendor/bundle/gems/factory_girl-3.3.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.0 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb
classiccms-0.6.0 vendor/bundle/gems/factory_girl-3.2.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.2.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.3.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.2.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.3.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.3.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/aliases_spec.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.2.0/spec/factory_girl/aliases_spec.rb