Sha256: d2430a41b3abf20e2eddb05d686f059c29fc5632ccdcaf20adde3e8ce5555870

Contents?: true

Size: 854 Bytes

Versions: 7

Compression:

Stored size: 854 Bytes

Contents

class ShopCustomersDataset < Dataset::Base
  def load
    create_model :shop_customer, :customer,
      :name     => 'customer',
      :email    => 'customer@example.com',
      :login    => 'customer',
      :password => 'radiant',
      :password_confirmation => 'radiant'
      
    create_model :shop_customer, :bad_customer,
      :name     => 'bad customer',
      :email    => 'bad_customer@example.com',
      :login    => 'bad customer',
      :password => 'radiant',
      :password_confirmation => 'radiant'
  end
  
  helpers do
    def login_as(user)
      login_user = user.is_a?(User) ? user : users(user)
      flunk "Can't login as non-existing user #{user.to_s}." unless login_user
      UserActionObserver.current_user = login_user
      login_user
    end

    def logout
      UserActionObserver.current_user = nil
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
radiant-shop-extension-0.11.6 spec/datasets/shop_customers.rb
radiant-shop-extension-0.11.5 spec/datasets/shop_customers.rb
radiant-shop-extension-0.11.4 spec/datasets/shop_customers.rb
radiant-shop-extension-0.11.3 spec/datasets/shop_customers.rb
radiant-shop-extension-0.11.1 spec/datasets/shop_customers.rb
radiant-shop-extension-0.11.0 spec/datasets/shop_customers.rb
radiant-shop-extension-0.10.0 spec/datasets/shop_customers.rb