Please implement 'compute_mock(mock)' in your calculator

The update to Spree calculators in Spree master are doing some dynamic class name loading to call the specific compute method. When you are working with mocks (or doubles) in your specs this could give you this error message:

Please implement 'compute_mock(mock)' in your calculator  

When you are working with a PORO (plain old ruby object) the best way to make it work is to create a proper instance of the object and use that instance in your specs. It is save to use mock_model on Rails models though, since the class name is properly set when you use mock_model.

You could also do it the hard (and ugly) way if your really want to mock a PORO with mock_model. You will need to dynamicly extend the PORO with ActiveModel::Naming to make the mock_model call work. See a sample of that below:

let(:package) do  
  Stock::Package.extend ActiveModel::Naming

Happy coding!