Sha256: 09815bc6ab9bdba23b07a30c6fda93f1e2edcbfd1ee00e27cbf74ef9fc5a0a9b
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper") module Erector describe Doc do describe "#output" do it "seeks to the end of the buffer" do string = "Hello" io = StringIO.new(string) doc = Doc.new(io) string.concat(" World") doc.text " Again" string.should == "Hello World Again" end end describe "#method_missing" do context "when passed in io object raises a NoMethodError" do context "when the passed in io object respond_to? method is false" do attr_reader :io before do @io = StringIO.new io.should_not respond_to(:foo) lambda {io.foo}.should raise_error(NoMethodError, /undefined method `foo' for #<StringIO/) end it "raises a NoMethodError that originates from within Doc#method_missing" do doc = Doc.new(io) lambda do doc.foo end.should raise_error(NoMethodError, /undefined method `foo' for #<Erector::Doc/) end end context "when the passed in io object respond_to? method is true" do attr_reader :io before do @io = StringIO.new stub(io).foo {raise NoMethodError, "Stubbed NoMethodError"} io.should respond_to(:foo) lambda {io.foo}.should raise_error(NoMethodError, "Stubbed NoMethodError") end it "raises a NoMethodError that originates from within Doc#method_missing" do doc = Doc.new(io) lambda do doc.foo end.should raise_error(NoMethodError, /undefined method `foo' for #<Erector::Doc/) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
erector-0.4.191 | spec/erector/doc_spec.rb |
erector-0.4.200 | spec/erector/doc_spec.rb |