Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## normal.rb
- class Base
- def foo; 1 end
- end
- describe Base do
- it "should work" { Base.new.foo.should == 1 }
- end
- class Derived
- def bar
- foo + 1
- end
- end
- describe Derived do
- it "should work" { Derived.new.bar.should == 2 }
- end
- ## database.rb
- class Base
- def foo; SQL['SELECT id FROM table'].to_i end
- end
- describe Base do
- before { @base = Base.new; @base.stub!(:SQL).returns(1) } # not actually valid, i know
- it "should work" { @base.foo.should == 1 }
- end
- class Derived
- def bar
- foo + 1
- end
- end
- describe Derived do
- it "should work" { Derived.new.bar.should == 2 }
- end
Add Comment
Please, Sign In to add comment