Sha256: 31885fb451984404654ef72ec8c79c79ddf4d448d57d2edd8b1958b64a01920f

Contents?: true

Size: 1.35 KB

Versions: 6

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

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-authentication-2.1.5 spec/factories/user.rb
refinerycms-authentication-2.1.4 spec/factories/user.rb
refinerycms-authentication-2.1.3 spec/factories/user.rb
refinerycms-authentication-2.1.2 spec/factories/user.rb
refinerycms-authentication-2.1.1 spec/factories/user.rb
refinerycms-authentication-2.1.0 spec/factories/user.rb