Sha256: 455236f7db84ce2d5fbf334041a5093818f3fb9c8aa4ce59ce2bc586ce42d65e

Contents?: true

Size: 922 Bytes

Versions: 12

Compression:

Stored size: 922 Bytes

Contents

shared_examples_for :it_has_a_dependency_accessor do |accessor_name|
  describe accessor_name.to_s do
    it "returns the #{accessor_name} object passed in at initialization" do
      component = subject_class.new(accessor_name => :thing)
      component.send(accessor_name).should == :thing
    end

    context "when the #{accessor_name} object is not set" do
      it 'raises a StandardError' do
        component = subject_class.new
        lambda { component.send(accessor_name) } \
          .should raise_error(StandardError)
      end

      it "explains that the #{accessor_name} was not set on initialiation" do
        subject_class.stub!(:name => 'Foo')
        component = subject_class.new
        begin
          component.send(accessor_name)
        rescue StandardError => e
          e.message.should == "No #{accessor_name} object was set on Foo initialization."
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kookaburra-0.21.1 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.21.0 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.20.0 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.18.3 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.18.2 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.18.1 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.18.0 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.17.1 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.17.0 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.16.1 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.16.0 spec/support/shared_examples/it_has_a_dependency_accessor.rb
kookaburra-0.15.1 spec/support/shared_examples/it_has_a_dependency_accessor.rb