Sha256: f3abc66e377c9e7ae2e7452459ffd3c4c6d502b471b9c5dc4b25ed7b9f6a4d36

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

require 'spec_helper'
require 'cancan'

describe Admin::OrdersController do
  context "#authorize_admin" do
    let(:user) { mock_model User }
    before { controller.stub :current_user => user }
    it "should grant access to users with an admin role" do
      user.stub :has_role? => true
      post :index
      response.should render_template :index
    end
    it "should deny access to users without an admin role" do
      user.stub :has_role? => false
      post :index
      response.should render_template "shared/unauthorized"
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
MyCommerceapi-1.0.0 auth/spec/controllers/admin_base_controller_spec.rb
MyCommerce-0.0.3 auth/spec/controllers/admin_base_controller_spec.rb