Sha256: 676e560b2c50e3af9d396230411647216cd78d2bbab5568137dc89e797c2a4b1

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

require_relative '../spec_helper'

describe BlueprintsBoy::Factories do
  describe "finding" do
    before do
      subject.add(Integer, :create) { 5 }
    end

    it "should allow defining and finding a factory" do
      factory = subject[Integer, :create]
      factory.should be_instance_of(Proc)
      factory.call.should == 5
    end

    it "should find factory for child class" do
      factory = subject[Fixnum, :create]
      factory.should be_instance_of(Proc)
      factory.call.should == 5
    end

    it "should raise error if factory can't be found" do
      expect {
        subject[Float, :create]
      }.to raise_error(BlueprintsBoy::FactoryNotFound, "Factory for Float can't be located")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blueprints_boy-1.0.0 spec/unit/factories_spec.rb