Created
December 27, 2012 02:07
-
-
Save drewdeponte/4384850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DrewTest | |
def initialize | |
@name = self.class.build_name | |
end | |
def self.build_name | |
return "bar" | |
end | |
end | |
describe DrewTest do | |
describe "#initialize" do | |
it "should build the name" do | |
DrewTest.should_receive(:build_name) | |
DrewTest.new | |
end | |
it "should set the name instance variable to the built name" do | |
DrewTest.stub(:build_name).and_return("hoopty") | |
obj = DrewTest.new | |
obj.instance_variable_get("@name").should == "hoopty" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment