Sha256: 825ddadccfb117b6a338fef41b85bb0c6ded9a4a1a1c24c2740d24f041c2d94e

Contents?: true

Size: 1.16 KB

Versions: 17

Compression:

Stored size: 1.16 KB

Contents

require 'active_record/spec_helper'

require_all File.dirname(__FILE__) + "/../shared/" 

describe 'Scenario: masquerading for admin user' do

  context "Masquerading as user" do
    before(:each) do
      @user = User.create!(:role => "user")
      @admin = Admin.create!(:name => "kris")
      @admin.masquerade_as @user
    end

    it_should_behave_like "User role" do
      let(:current_user) { @admin }
      let(:user) { current_ability(:user) }
      let(:own_article) { Article.create!(:user_id => @user.id) }
      let(:own_post)    { Post.create(:user_id => @user.id) }
      let(:own_comment) { Comment.create(:user_id => @user.id) }
    end
  end

  context "Masquerading as editor" do 
    before(:each) do
      @user = User.create!(:role => "editor")
      @admin = Admin.create!(:name => "kris")
      @admin.masquerade_as @user
    end

    it_should_behave_like "Editor role" do
      let(:current_user) { @admin }
      let(:user) { current_ability(:user) }
      let(:own_article) { Article.create!(:user_id => @user.id) }
      let(:own_post)    { Post.create(:user_id => @user.id) }
      let(:own_comment) { Comment.create(:user_id => @user.id) }
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
cantango-0.9.4.1 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.9.4 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.9.3.2 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.9.5 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.9.4 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.9.3 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.9.2 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.9.1 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.9 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.8.1 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.8 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.7 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.6.2 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.6.1 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.6 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.5.1 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb
cantango-0.8.0 spec/active_record/scenarios/masquerading/masquerading_for_admin_user_spec.rb