Sha256: e21d7b28c83b526eb8e342483968dddddb7b1f05f8e7dc1e56a91d72dba0963e

Contents?: true

Size: 1.28 KB

Versions: 48

Compression:

Stored size: 1.28 KB

Contents

FactoryGirl.define do

  factory :token, class: "Adeia::Token" do
    token { SecureRandom.urlsafe_base64 }
    is_valid true
    exp_at { 1.month.from_now }
  end

  factory :permission, class: "Adeia::Permission" do
    transient do
      element_name 'admin/articles'
      group_name "admin"
      type_name 'all_entries'
      action 'share'
    end
    element { Adeia::Element.find_or_create_by(name: element_name) }
    owner { Adeia::Group.find_by_name(group_name) || create(:group, name: group_name) }
    
    permission_type { Adeia::Permission.permission_types[type_name] }

    resource_id nil
    read_right false
    create_right false
    update_right false
    destroy_right false
    actions {[ Adeia::Action.find_or_create_by(name: action) ]}
  end

  factory :group, class: "Adeia::Group" do
    name "admin"
  end

  factory :user_group, class: "Adeia::GroupUser" do
    group { Adeia::Group.find_by_name("admin") || create(:group) }
    user { nil }
  end

  ### Test App factories

  factory :user do
    name "admin"
    password "12341"
    password_confirmation "12341"
  end
  
  factory :article do
    title "Des ours meurt chaque année"
    content "Chaque année, plus de 1000 ourse blancs meurt"
    user { User.find_by_name("editor") || create(:user, name: "editor") }
  end

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
adeia-0.10.5 spec/factories.rb
adeia-0.10.4 spec/factories.rb
adeia-0.10.3 spec/factories.rb
adeia-0.10.2 spec/factories.rb
adeia-0.10.1 spec/factories.rb
adeia-0.10.0 spec/factories.rb
adeia-0.9.2 spec/factories.rb
adeia-0.9.1 spec/factories.rb
adeia-0.9.0 spec/factories.rb
adeia-0.8.6 spec/factories.rb
adeia-0.8.5 spec/factories.rb
adeia-0.8.4 spec/factories.rb
adeia-0.8.3 spec/factories.rb
adeia-0.8.2 spec/factories.rb
adeia-0.8.1 spec/factories.rb
adeia-0.8.0 spec/factories.rb
adeia-0.7.1 spec/factories.rb
adeia-0.7.0 spec/factories.rb
adeia-0.6.2 spec/factories.rb
adeia-0.6.1 spec/factories.rb