Sha256: afa44779c39ba584cba2dcc9285208ae9d4b3f7e7f6ccac83427627745861390

Contents?: true

Size: 702 Bytes

Versions: 6

Compression:

Stored size: 702 Bytes

Contents

require 'cantango/config'
require 'fixtures/models'

require 'spec_helper'

class User
  extend CanTango::Macros::Masquerader::User
end

class Admin
  extend CanTango::Macros::Masquerader::User
end

CanTango.config.users do |u|
  u.register :user, User
  u.register :admin, Admin
end

describe CanTango::Macros::Masquerader::User do
  before do
    @mike   = User.new 'mike', 'mike@mail.com'
    @admin  = Admin.new 'admin', 'admin@mail.com'
  end
  
  describe 'masquerader' do
    before do
      Admin.masquerader
    end

    context 'admin masquerading as mike' do
      before do
        @admin.masquerade_as @mike
      end
      specify { @admin.active_user.should == @mike }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cantango-masquerade-0.1.3.2 spec/cantango/macros/masquerade/user_spec.rb
cantango-masquerade-0.1.3.1 spec/cantango/macros/masquerade/user_spec.rb
cantango-masquerade-0.1.3 spec/cantango/macros/masquerade/user_spec.rb
cantango-masquerade-0.1.2.1 spec/cantango/macros/masquerade/user_spec.rb
cantango-masquerade-0.1.2 spec/cantango/macros/masquerade/user_spec.rb
cantango-masquerade-0.1.1 spec/cantango/macros/masquerade/user_spec.rb