spec/rspec/mocks/stub_const_spec.rb in rspec-mocks-2.11.1 vs spec/rspec/mocks/stub_const_spec.rb in rspec-mocks-2.11.2
- old
+ new
@@ -55,11 +55,10 @@
reset_rspec_mocks
const.should be(original_value)
end
it 'returns the stubbed value' do
- orig_value = const
stub_const(const_name, 7).should eq(7)
end
end
shared_examples_for "unloaded constant stubbing" do |const_name|
@@ -174,9 +173,13 @@
end
end
context 'for a loaded nested constant' do
it_behaves_like "loaded constant stubbing", "TestClass::Nested"
+ end
+
+ context 'for an unloaded constant with nested name that matches a top-level constant' do
+ it_behaves_like "unloaded constant stubbing", "TestClass::Hash"
end
context 'for a loaded deeply nested constant' do
it_behaves_like "loaded constant stubbing", "TestClass::Nested::NestedEvenMore"
end