Sha256: e21dd1bacfccaa43b9d12b138e82fd55d30c8797bfbcd1d554fbe316bb07ccd3

Contents?: true

Size: 700 Bytes

Versions: 33

Compression:

Stored size: 700 Bytes

Contents

require "spec_helper"

describe FactoryGirl::Decorator::DisallowsDuplicatesRegistry do
  let(:registry) { stub("registry", name: 'Great thing', register: true) }

  subject { described_class.new(registry) }

  it "delegates #register to the registry when not registered" do
    registry.stubs(registered?: false)
    subject.register(:awesome, {})
    registry.should have_received(:register).with(:awesome, {})
  end

  it "raises when attempting to #register a previously registered strategy" do
    registry.stubs(registered?: true)
    expect { subject.register(:same_name, {}) }.
      to raise_error(FactoryGirl::DuplicateDefinitionError, "Great thing already registered: same_name")
  end
end

Version data entries

33 entries across 25 versions & 4 rubygems

Version Path
challah-0.7.1 vendor/bundle/gems/factory_girl-3.6.1/spec/factory_girl/disallows_duplicates_registry_spec.rb
challah-0.7.0 vendor/bundle/gems/factory_girl-3.6.1/spec/factory_girl/disallows_duplicates_registry_spec.rb
challah-0.7.0.pre2 vendor/bundle/gems/factory_girl-3.6.1/spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-4.0.0 spec/factory_girl/disallows_duplicates_registry_spec.rb
challah-0.7.0.pre vendor/bundle/gems/factory_girl-3.6.1/spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-4.0.0.rc1 spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-3.6.1 spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-3.6.0 spec/factory_girl/disallows_duplicates_registry_spec.rb
challah-0.6.2 vendor/bundle/gems/factory_girl-3.5.0/spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-3.5.0 spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-3.4.2 spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-3.4.1 spec/factory_girl/disallows_duplicates_registry_spec.rb
factory_girl-3.4.0 spec/factory_girl/disallows_duplicates_registry_spec.rb