Created
August 24, 2009 18:25
-
-
Save ghnatiuk/174018 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Example | |
class << self | |
def attribute | |
@attribute ||= nil | |
end | |
end | |
end |
This file contains hidden or 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
require File.dirname(__FILE__) + '/example' | |
describe Example do | |
context "Running spec1" do | |
it "attribute should be nil" do | |
Example.instance_variable_get(:@attribute).should be_nil | |
end | |
it "attribute can be set in this spec" do | |
Example.instance_variable_set(:@attribute, "an attribute").should == "an attribute" | |
end | |
it "attributes can be gotten in this spec" do | |
Example.instance_variable_get(:@attribute).should == "an attribute" | |
end | |
end | |
end |
This file contains hidden or 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
require File.dirname(__FILE__) + '/example' | |
describe Example do | |
context "Running spec2" do | |
it "attribute should be nil" do | |
Example.instance_variable_get(:@attribute).should be_nil | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment