Sha256: 0cb744205fc39155c63b91caade56587338f12ccd9b05deabe06421dd1f89e8a

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

def admin_user
  @admin ||= instance_double(Symphonia::User,
                             id: 1,
                             admin: true,
                             admin?: true,
                             authorize?: true,
                             logged_in?: true,
                             allowed_to?: true,
                             persistence_token: SecureRandom.hex(12)
  )
end

def regular_user
  # @user ||= instance_double(Symphonia::User,
  #                           id: 2,
  #                           admin: false,
  #                           admin?: false,
  #                           authorize?: false,
  #                           logged_in?: true,
  #                           allowed_to?: false,
  #                           persistence_token: SecureRandom.hex(12)
  # )
  @user ||= FactoryBot.build_stubbed :user
end

def add_permission *args
  @role ||= FactoryBot.build_stubbed :role
  @role.permissions = args
  regular_user.role = @role
  # allow(regular_user).to receive(:role).and_return @role
  @role
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
symphonia-3.0.2 spec/support/stub_users.rb
symphonia-2.2.1 spec/support/stub_users.rb
symphonia-3.0.1 spec/support/stub_users.rb
symphonia-3.0.0 spec/support/stub_users.rb
symphonia-2.1.8 spec/support/stub_users.rb
symphonia-2.1.7 spec/support/stub_users.rb