Sha256: a9c4c83c5b15a5aa79ab9b4d53998bc6fd3bec3504e8d4c3a1285710ca981b5f

Contents?: true

Size: 1.35 KB

Versions: 11

Compression:

Stored size: 1.35 KB

Contents

# This is a temporary hack to get around some hackery with Devise when
# using the authentication macros in request specs that are defined in
# refinerycms-testing. If you remove this line ensure that tests pass
# in an extension that is testing against this Factory via the
# authentication macros in refinerycms-testing.
# 10-11-2011 - Jamie Winsor - jamie@enmasse.com
require Refinery.roots(:'refinery/authentication').join("app/models/refinery/role.rb")

FactoryGirl.define do
  factory :user, :class => Refinery::User do
    sequence(:username) { |n| "refinery#{n}" }
    sequence(:email) { |n| "refinery#{n}@refinerycms.com" }
    password  "refinerycms"
    password_confirmation "refinerycms"
  end

  factory :refinery_user, :parent => :user do
    roles { [ ::Refinery::Role[:refinery] ] }

    after_create do |user|
      ::Refinery::Plugins.registered.each_with_index do |plugin, index|
        user.plugins.create(:name => plugin.name, :position => index)
      end
    end
  end

  factory :refinery_superuser, :parent => :refinery_user do
    roles { [ ::Refinery::Role[:refinery], ::Refinery::Role[:superuser] ]}
  end

  factory :refinery_translator, :parent => :user do
    roles { [ ::Refinery::Role[:refinery], ::Refinery::Role[:translator] ] }

    after_create do |user|
      user.plugins.create(:name => 'refinery_pages', :position => 0)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
refinerycms-authentication-2.0.10 spec/factories/user.rb
refinerycms-authentication-2.0.9 spec/factories/user.rb
refinerycms-authentication-2.0.8 spec/factories/user.rb
refinerycms-authentication-2.0.7 spec/factories/user.rb
refinerycms-authentication-2.0.6 spec/factories/user.rb
refinerycms-authentication-2.0.5 spec/factories/user.rb
refinerycms-authentication-2.0.4 spec/factories/user.rb
refinerycms-authentication-2.0.3 spec/factories/user.rb
refinerycms-authentication-2.0.2 spec/factories/user.rb
refinerycms-authentication-2.0.1 spec/factories/user.rb
refinerycms-authentication-2.0.0 spec/factories/user.rb