Sha256: 2ecb8e45a20f955e56f4318e0f391ba5ff45cca08e2133ea5d0ad96de5c6e9ee
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' module Spree describe Api::AddressesController do render_views before do stub_authentication! @address = create(:address) end context "with their own address" do before do Address.any_instance.stub :user => current_api_user end it "gets an address" do api_get :show, :id => @address.id json_response['address1'].should eq @address.address1 end it "updates an address" do api_put :update, :id => @address.id, :address => { :address1 => "123 Test Lane" } json_response['address1'].should eq '123 Test Lane' end end context "on somebody else's address" do before do Address.any_instance.stub :user => stub_model(Spree::LegacyUser) end it "cannot retreive address information" do api_get :show, :id => @address.id assert_unauthorized! end it "cannot update address information" do api_get :update, :id => @address.id assert_unauthorized! end end end end
Version data entries
6 entries across 6 versions & 2 rubygems