Testing

In case you are having troubles to use the [ruby] expect_any_instance_of [/ruby] From Rspec, guess what, it is not only you, many of us have faced the same troubles before, you can see it here in the thread discussion https://github.com/rspec/rspec-mocks/issues/910 I really agree with this argument: The name of the method is...

Consuming Tumblr blog from your website using Ruby on Rails (Spree), Backbone and Tumblr Api You need to have an account on tumblr of course and generate the application to be able to consume the tumblr api: http://www.tumblr.com/oauth/apps About the default callback you can choose any url for example: http:://localhost:3000 Then generate the application oauth in the following url: https://api.tumblr.com/console/calls/user/info Add the following gem to your Gemfile: [ruby] gem 'tumblr_client' [/ruby]

My test file content: [ruby] describe ProductsService do describe '#valid?' do context 'when is successfully' do let(:result) { mock 'Result', object: {'errors' => ''}} before do subject.instance_variable_set(:@result, result) end specify do expect(subject.valid?).to be_true end end context 'when there is an error' do let(:result) { mock 'Result', object: {'errors' => 'error example'}} before do subject.instance_variable_set(:@result, result) end specify do expect(subject.valid?).to be_false end end end [/ruby]