Sha256: 022108dabd4681bf31da58d1c99376c16f7e3e4e6b957d2164a55717a9ea7109

Contents?: true

Size: 719 Bytes

Versions: 16

Compression:

Stored size: 719 Bytes

Contents

require "spec_helper"

describe FactoryGirl::StrategyCalculator do
  let(:strategy) do
    define_class("MyAwesomeClass")
  end

  context "when a class" do
    subject { FactoryGirl::StrategyCalculator.new(strategy).strategy }

    it "returns the class passed" do
      expect(subject).to eq strategy
    end
  end

  context "when a symbol" do
    before  { FactoryGirl.stubs(:strategy_by_name).returns(strategy) }
    subject { FactoryGirl::StrategyCalculator.new(:build).strategy }

    it "finds the strategy by name" do
      subject
      expect(FactoryGirl).to have_received(:strategy_by_name).with(:build)
    end

    it "returns the strategy found" do
      expect(subject).to eq strategy
    end
  end
end

Version data entries

16 entries across 13 versions & 5 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/strategy_calculator_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/strategy_calculator_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/strategy_calculator_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/factory_girl-4.5.0/spec/factory_girl/strategy_calculator_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/factory_girl/strategy_calculator_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/strategy_calculator_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/strategy_calculator_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/factory_girl/strategy_calculator_spec.rb
factory_girl-4.5.0 spec/factory_girl/strategy_calculator_spec.rb
factory_girl-4.4.0 spec/factory_girl/strategy_calculator_spec.rb
factory_girl-4.3.0 spec/factory_girl/strategy_calculator_spec.rb
challah-1.0.0 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/strategy_calculator_spec.rb
challah-1.0.0.beta3 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/strategy_calculator_spec.rb
challah-1.0.0.beta2 vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/strategy_calculator_spec.rb
challah-1.0.0.beta vendor/bundle/gems/factory_girl-4.2.0/spec/factory_girl/strategy_calculator_spec.rb
factory_girl-4.2.0 spec/factory_girl/strategy_calculator_spec.rb