Skip to content

Instantly share code, notes, and snippets.

@ghnatiuk
Created August 24, 2009 18:25
Show Gist options
  • Save ghnatiuk/174018 to your computer and use it in GitHub Desktop.
Save ghnatiuk/174018 to your computer and use it in GitHub Desktop.
class Example
class << self
def attribute
@attribute ||= nil
end
end
end
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
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