rspec / rspec-activemodel-mocks

Add stub_model and mock_model to rspec-mocks
MIT License
119 stars 32 forks source link

#initialize instance private method issue #23

Open ulugbekov opened 8 years ago

ulugbekov commented 8 years ago

mock_model("Book")

allow(Book).to receive(:new).with({}) { book_instance }

Wrong number of arguments. Expected 0, got 1. The reason is Book.instance_method(:initialize).arity is 0; Which is supposed to be -1. Book.new takes *args, so initialize is failing when testing with RSpec.