I'm learning test in rails rspec. I have this part of test:
subject(:service) { described_class.new() }
context 'when sth' do
it 'should sth' do
expect ( service.call(@params) ).to eq(0)
end
end
Service's method call return number. But I get something like this:
Failures:
1) Module::Registration when sth should sth
Failure/Error: expect ( service.call(@params) ).to eq(2)
NoMethodError:
undefined method `to' for 2:Fixnum
# ./spec/module/registration_spec.rb:22:in `block (3 levels) in <module:Module>'
Finished in 2.48 seconds
1 example, 1 failure
So how can I check that method return correct "Number" variable using to?