upworthy/silverpop

method_missing and respond_to? implementations break rspec stubbing

Opened this issue · 0 comments

The test:

it 'create a SilverPop client' do
  expect(SilverPop).to receive(:new)
end

The output:

 Failure/Error: expect(SilverPop).to receive(:new)

     SystemStackError:
       stack level too deep
     # /Users/keltonmanzanares/.rvm/gems/ruby-2.3.1@isr-intrawest/gems/silverpop-0.0.9/lib/silverpop.rb:14:in `method_missing'
     .
     .
     .
     # /Users/keltonmanzanares/.rvm/gems/ruby-2.3.1@isr-intrawest/gems/silverpop-0.0.9/lib/silverpop.rb:14:in `method_missing'
     # /Users/keltonmanzanares/.rvm/gems/ruby-2.3.1@isr-intrawest/gems/silverpop-0.0.9/lib/silverpop.rb:19:in `respond_to?'
     # ./spec/models/silver_pop_table_spec.rb:43:in `block (3 levels) in <top (required)>'

Finished in 0.16148 seconds (files took 7.95 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/models/silver_pop_table_spec.rb:42 # SilverPopTable.update create a SilverPop client