Sha256: d3a87f50b3d3163647c30052321b3e64336866bbb7a7177aa9278cc5a1dc5d60
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'capybara/rails' require 'capybara/dsl' require 'bbq/util' module Bbq class TestUser include ActionDispatch::Routing::UrlFor include Rails.application.routes.url_helpers include Capybara::DSL attr_reader :options class << self attr_accessor :callbacks end def initialize(options = {}) @session_name = options.delete(:session_name) @current_driver = options.delete(:driver) @options = options self.class.callbacks && self.class.callbacks.each do |callback| callback[:extension].send(callback[:method], self) end end def page Capybara.using_session(session_name) do Capybara.current_session end end def session_name @session_name ||= ActiveSupport::SecureRandom.hex(8) end def roles(*names) names.each do |name| module_obj = Bbq::Util.find_module(name, self) self.extend(module_obj) end end def self.add_callback(extension, method=:init) self.callbacks ||= [] self.callbacks << {:extension => extension, :method => method} end def see?(*args) args.all? { |arg| has_content?(arg) } end def not_see?(*args) args.all? { |arg| has_no_content?(arg) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bbq-0.0.2.beta.1 | lib/bbq/test_user.rb |