require 'spec_helper' describe ApiRetailersController, type: :controller do render_views let (:owner) {FactoryGirl.create(:user)} let (:retailer) {FactoryGirl.create(:retailer, user: owner)} before(:each) do controller.current_user = owner end describe "show" do it "works" do get :show, id: retailer.id response.should be_success JSON.parse(response.body)['id'].should eql retailer.id end end describe "update" do it "works" do post :update, id: retailer.id, name: "Hardy har", format: 'json' response.should be_success json = JSON.parse(response.body) json['name'].should eql "Hardy har" end end end