{"action":"created","issue":{"url":"https://api.github.com/repos/geermc4/spree_user_groups/issues/4","labels_url":"https://api.github.com/repos/geermc4/spree_user_groups/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/geermc4/spree_user_groups/issues/4/comments","events_url":"https://api.github.com/repos/geermc4/spree_user_groups/issues/4/events","html_url":"https://github.com/geermc4/spree_user_groups/issues/4","id":53576498,"number":4,"title":"NoMethodError: undefined method `mock_model'","user":{"login":"kailosBryan","id":594867,"avatar_url":"https://avatars.githubusercontent.com/u/594867?v=3","gravatar_id":"","url":"https://api.github.com/users/kailosBryan","html_url":"https://github.com/kailosBryan","followers_url":"https://api.github.com/users/kailosBryan/followers","following_url":"https://api.github.com/users/kailosBryan/following{/other_user}","gists_url":"https://api.github.com/users/kailosBryan/gists{/gist_id}","starred_url":"https://api.github.com/users/kailosBryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kailosBryan/subscriptions","organizations_url":"https://api.github.com/users/kailosBryan/orgs","repos_url":"https://api.github.com/users/kailosBryan/repos","events_url":"https://api.github.com/users/kailosBryan/events{/privacy}","received_events_url":"https://api.github.com/users/kailosBryan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-06T23:17:43Z","updated_at":"2015-01-07T15:23:17Z","closed_at":"2015-01-07T15:23:17Z","body":"I'm updating this to work with 2.4, but I'm unfamiliar with rspec - any ideas why \"mock_model\" is not working here?\r\n\r\n```\r\nNoMethodError: undefined method `mock_model' for #<RSpec::ExampleGroups::SpreeCalculatorAdvancedFlatPercentBasedOnMasterPrice::Compute:0x007fdaf520d230>\r\n./spec/models/calculator/advanced_flat_percent_spec.rb:5:in `block (2 levels) in <top (required)>'\r\n./spec/models/calculator/advanced_flat_percent_spec.rb:11:in `block (3 levels) in <top (required)>'\r\n```\r\n```ruby\r\ndescribe 'Spree::Calculator::AdvancedFlatPercent based on master_price' do\r\n  let(:calculator) { Spree::Calculator::AdvancedFlatPercent.new }\r\n  let(:order) { mock_model Spree::Order, :line_items => [mock_model(Spree::LineItem, :amount => 10), mock_model(Spree::LineItem, :amount => 20)], :user => mock_model(Spree::User) }\r\n\r\n  before { calculator.stub :preferred_flat_percent => 10, :preferred_based_on_cost_price => false }\r\n\r\n  context \"compute\" do\r\n    it \"should compute amount correctly\" do\r\n      calculator.compute(order).should == -3.0\r\n    end\r\n\r\n    it \"should round result correctly\" do\r\n      order.stub :line_items => [mock_model(Spree::LineItem, :amount => 10.56), mock_model(Spree::LineItem, :amount => 20.49)]\r\n      calculator.compute(order).should == -3.11\r\n\r\n      order.stub :line_items => [mock_model(Spree::LineItem, :amount => 10.56), mock_model(Spree::LineItem, :amount => 20.48)]\r\n      calculator.compute(order).should == -3.10\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nI've tried adding \"rspec-activemodel-mocks\" since I saw they were trying to move these mocks out of rspec-rails, but this didn't help.\r\n\r\nThank you,\r\nBryan"},"comment":{"url":"https://api.github.com/repos/geermc4/spree_user_groups/issues/comments/69036463","html_url":"https://github.com/geermc4/spree_user_groups/issues/4#issuecomment-69036463","issue_url":"https://api.github.com/repos/geermc4/spree_user_groups/issues/4","id":69036463,"user":{"login":"kailosBryan","id":594867,"avatar_url":"https://avatars.githubusercontent.com/u/594867?v=3","gravatar_id":"","url":"https://api.github.com/users/kailosBryan","html_url":"https://github.com/kailosBryan","followers_url":"https://api.github.com/users/kailosBryan/followers","following_url":"https://api.github.com/users/kailosBryan/following{/other_user}","gists_url":"https://api.github.com/users/kailosBryan/gists{/gist_id}","starred_url":"https://api.github.com/users/kailosBryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kailosBryan/subscriptions","organizations_url":"https://api.github.com/users/kailosBryan/orgs","repos_url":"https://api.github.com/users/kailosBryan/repos","events_url":"https://api.github.com/users/kailosBryan/events{/privacy}","received_events_url":"https://api.github.com/users/kailosBryan/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T15:23:17Z","updated_at":"2015-01-07T15:23:17Z","body":"Ok, solved, now that **rspec-rails** has moved *stub_model* & *mock_model* out to [rspec-activemodel-mocks](https://github.com/rspec/rspec-activemodel-mocks), you need to add the following to your spec_helper.rb:\r\n```\r\nrequire 'rspec/active_model/mocks'\r\n```\r\nI'm new to submitted patches back to their respective authors, but I'll try to do a pull request back to you with my 2-4-stable branch and respective test fixes."}}