Sha256: ab66f5afa9554cf7106c30eda0996f092951998cbda7784a95956e69464c1ac4

Contents?: true

Size: 881 Bytes

Versions: 4

Compression:

Stored size: 881 Bytes

Contents

require File.expand_path(
    File.join(File.dirname(__FILE__), %w[.. .. lib germinate]))

module Germinate
  describe ImplicitInsertion do
    before :each do
      @hunk     = stub("Hunk").as_null_object
      @library  = stub("Library")
      @selector = stub("Selector")
      @it = Germinate::ImplicitInsertion.new(@selector, @library)
    end

    context "when the librarian can find the selection" do
      before :each do
        @library.stub!(:[]).and_return(@hunk)
      end

      it "should resolve to the hunk the librarian returns" do
        @it.resolve.should equal(@hunk)
      end
    end

    context "when the librarian cannot find the selection" do
      before :each do
        @library.stub!(:[]).and_raise(IndexError.new)
      end

      it "should resolve to a null hunk" do
        @it.resolve.should be_a_kind_of(NullHunk)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
devver-germinate-1.0.1 spec/germinate/implicit_insertion_spec.rb
devver-germinate-1.1.0 spec/germinate/implicit_insertion_spec.rb
devver-germinate-1.2.0 spec/germinate/implicit_insertion_spec.rb
germinate-1.2.0 spec/germinate/implicit_insertion_spec.rb