Permalink
Browse files

Handle strings as well as symbols for method stubs.

Yes, I usually write my method stubs using symbols, but wandered from that path with some simple metaprogramming. RSpec's fine with strings, but rspec-fire wasn't when it came to running my full test suite - it insisted the methods did not exist on the real classes.
  • Loading branch information...
1 parent 8444090 commit 0907ec7edfb50850bd4a53162613e25a81ce675e @pat pat committed Jul 14, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −1 lib/rspec/fire.rb
  2. +3 −0 spec/fire_double_spec.rb
View
@@ -177,7 +177,7 @@ def implemented_methods(doubled_class, checked_methods)
end
def unimplemented_methods(doubled_class, expected_methods, checked_methods)
- expected_methods -
+ expected_methods.map(&:to_sym) -
implemented_methods(doubled_class, checked_methods)
end
View
@@ -58,11 +58,14 @@ def clear_config
describe 'doubled class is not loaded' do
let(:doubled_object) { fire_double("UnloadedObject") }
should_allow(:undefined_method)
+ should_allow('undefined_method')
end
describe 'doubled class is loaded' do
should_allow(:defined_method)
+ should_allow('defined_method')
should_not_allow(:undefined_method)
+ should_not_allow('undefined_method')
end
end

0 comments on commit 0907ec7

Please sign in to comment.