Sha256: 7c3655ff3c4d48128f292bfa7e9e9ee03d05aaacebd843f9ffcb6aaa145fc96a
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' describe RatingsController do let(:instance) { mock_model(ActsAsStarrable::Rating) } describe '#create' do context 'success' do before do expect(ActsAsStarrable::Rating).to receive(:new).and_return(instance) expect(instance).to receive(:save).and_return(true) post :create, :format => 'json', :rating => { :id => '1', :stype => 'Flick', :value => '2.5'} end it { should respond_with 201 } end context 'failure' do before do expect(ActsAsStarrable::Rating).to receive(:new).and_return(instance) expect(instance).to receive(:save).and_return(false) post :create, :format => 'json', :rating => { :id => '1', :stype => 'Flick', :value => '2.5'} end it { should respond_with 422 } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts_as_starrable-0.0.1 | spec/controllers/ratings_controller_spec.rb |