Skip to content

Commit

Permalink
Remove the bang from our #stub! methods.
Browse files Browse the repository at this point in the history
I'm not really sure why I used them when I wrote this in rspec-fire;
given there were not corresponding bang-less methods, it didn't
really make sense.

For rspec#144.
  • Loading branch information
myronmarston committed Jun 2, 2012
1 parent 9a7c90d commit 2b4fad7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/mocks/example_methods.rb
Expand Up @@ -42,7 +42,7 @@ def allow_message_expectations_on_nil
end

def stub_const(name, value, options = {})
ConstantStubber.stub!(name, value, options)
ConstantStubber.stub(name, value, options)
end

private
Expand Down
8 changes: 4 additions & 4 deletions lib/rspec/mocks/stub_const.rb
Expand Up @@ -26,7 +26,7 @@ def initialize(full_constant_name, stubbed_value, transfer_nested_constants)
@transfer_nested_constants = transfer_nested_constants
end

def stub!
def stub
context_parts = @full_constant_name.split('::')
@const_name = context_parts.pop
@context = recursive_const_get(context_parts.join('::'))
Expand Down Expand Up @@ -96,7 +96,7 @@ def original_value
# always nil
end

def stub!
def stub
context_parts = @full_constant_name.split('::')
const_name = context_parts.pop

Expand All @@ -120,7 +120,7 @@ def rspec_reset
end
end

def self.stub!(constant_name, value, options = {})
def self.stub(constant_name, value, options = {})
stubber = if recursive_const_defined?(constant_name)
DefinedConstantReplacer.new(constant_name, value, options[:transfer_nested_constants])
else
Expand All @@ -129,7 +129,7 @@ def self.stub!(constant_name, value, options = {})

stubbers << stubber

stubber.stub!
stubber.stub
ensure_registered_with_rspec_mocks
stubber.original_value
end
Expand Down

0 comments on commit 2b4fad7

Please sign in to comment.