module Bbq::Devise
Constants
- VERSION
Attributes
devise_authentication_key[RW]
email[RW]
password[RW]
scope[RW]
Public Class Methods
included(klass)
click to toggle source
# File lib/bbq/devise.rb, line 8 def self.included(klass) require 'bbq/rails/routes' klass.send(:include, Bbq::Rails::Routes) end
next_email()
click to toggle source
# File lib/bbq/devise.rb, line 48 def self.next_email "#{SecureRandom.hex(3)}@example.com" end
next_password()
click to toggle source
# File lib/bbq/devise.rb, line 52 def self.next_password SecureRandom.hex(8) end
Public Instance Methods
initialize_devise()
click to toggle source
# File lib/bbq/devise.rb, line 13 def initialize_devise @devise_initialized ||= begin self.devise_authentication_key = ::Devise.authentication_keys.first self.email = options[devise_authentication_key.to_sym] || Bbq::Devise.next_email self.password = options[:password] || Bbq::Devise.next_password self.scope = ::Devise.mappings.first.second.singular.to_s true end end
login()
click to toggle source
# File lib/bbq/devise.rb, line 32 def login initialize_devise visit send("new_#{scope}_session_path") fill_in "#{scope}_#{devise_authentication_key}", :with => @email fill_in "#{scope}_password", :with => @password find(:xpath, "//input[@name='commit']").click end
logout()
click to toggle source
# File lib/bbq/devise.rb, line 40 def logout visit send("destroy_#{scope}_session_path") end
register()
click to toggle source
# File lib/bbq/devise.rb, line 23 def register initialize_devise visit send("new_#{scope}_registration_path") fill_in "#{scope}_#{devise_authentication_key}", :with => @email fill_in "#{scope}_password", :with => @password fill_in "#{scope}_password_confirmation", :with => @password find(:xpath, "//input[@name='commit']").click end
register_and_login()
click to toggle source
# File lib/bbq/devise.rb, line 44 def register_and_login register end