Skip to content

Commit

Permalink
Refactor away the use of #its.
Browse files Browse the repository at this point in the history
#its is going away in rspec-core at some future point, so we shouldn't use it here.
  • Loading branch information
myronmarston committed Jun 8, 2012
1 parent fd595a8 commit 722529e
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions spec/rspec/mocks/stub_const_spec.rb
Expand Up @@ -244,63 +244,63 @@ def change_const_value_to(value)
describe Constant do
describe ".original" do
context 'for a previously defined unstubbed constant' do
subject { Constant.original("TestClass::M") }
let(:const) { Constant.original("TestClass::M") }

its(:name) { should eq("TestClass::M") }
its(:previously_defined?) { should be_true }
its(:stubbed?) { should be_false }
its(:original_value) { should eq(:m) }
it("exposes its name") { const.name.should eq("TestClass::M") }
it("indicates it was previously defined") { const.should be_previously_defined }
it("indicates it has not been stubbed") { const.should_not be_stubbed }
it("exposes its original value") { const.original_value.should eq(:m) }
end

context 'for a previously defined stubbed constant' do
before { stub_const("TestClass::M", :other) }
subject { Constant.original("TestClass::M") }
let(:const) { Constant.original("TestClass::M") }

its(:name) { should eq("TestClass::M") }
its(:previously_defined?) { should be_true }
its(:stubbed?) { should be_true }
its(:original_value) { should eq(:m) }
it("exposes its name") { const.name.should eq("TestClass::M") }
it("indicates it was previously defined") { const.should be_previously_defined }
it("indicates it has been stubbed") { const.should be_stubbed }
it("exposes its original value") { const.original_value.should eq(:m) }
end

context 'for a previously undefined stubbed constant' do
before { stub_const("TestClass::Undefined", :other) }
subject { Constant.original("TestClass::Undefined") }
let(:const) { Constant.original("TestClass::Undefined") }

its(:name) { should eq("TestClass::Undefined") }
its(:previously_defined?) { should be_false }
its(:stubbed?) { should be_true }
its(:original_value) { should be_nil }
it("exposes its name") { const.name.should eq("TestClass::Undefined") }
it("indicates it was not previously defined") { const.should_not be_previously_defined }
it("indicates it has been stubbed") { const.should be_stubbed }
it("returns nil for the original value") { const.original_value.should be_nil }
end

context 'for a previously undefined unstubbed constant' do
subject { Constant.original("TestClass::Undefined") }
let(:const) { Constant.original("TestClass::Undefined") }

its(:name) { should eq("TestClass::Undefined") }
its(:previously_defined?) { should be_false }
its(:stubbed?) { should be_false }
its(:original_value) { should be_nil }
it("exposes its name") { const.name.should eq("TestClass::Undefined") }
it("indicates it was not previously defined") { const.should_not be_previously_defined }
it("indicates it has not been stubbed") { const.should_not be_stubbed }
it("returns nil for the original value") { const.original_value.should be_nil }
end

context 'for a previously defined constant that has been stubbed twice' do
before { stub_const("TestClass::M", 1) }
before { stub_const("TestClass::M", 2) }
subject { Constant.original("TestClass::M") }
let(:const) { Constant.original("TestClass::M") }

its(:name) { should eq("TestClass::M") }
its(:previously_defined?) { should be_true }
its(:stubbed?) { should be_true }
its(:original_value) { should eq(:m) }
it("exposes its name") { const.name.should eq("TestClass::M") }
it("indicates it was previously defined") { const.should be_previously_defined }
it("indicates it has been stubbed") { const.should be_stubbed }
it("exposes its original value") { const.original_value.should eq(:m) }
end

context 'for a previously undefined constant that has been stubbed twice' do
before { stub_const("TestClass::Undefined", 1) }
before { stub_const("TestClass::Undefined", 2) }
subject { Constant.original("TestClass::Undefined") }
let(:const) { Constant.original("TestClass::Undefined") }

its(:name) { should eq("TestClass::Undefined") }
its(:previously_defined?) { should be_false }
its(:stubbed?) { should be_true }
its(:original_value) { should be_nil }
it("exposes its name") { const.name.should eq("TestClass::Undefined") }
it("indicates it was not previously defined") { const.should_not be_previously_defined }
it("indicates it has been stubbed") { const.should be_stubbed }
it("returns nil for the original value") { const.original_value.should be_nil }
end
end
end
Expand Down

0 comments on commit 722529e

Please sign in to comment.