lib/bbq/test_user.rb in bbq-0.0.2.beta.2 vs lib/bbq/test_user.rb in bbq-0.0.2.beta.3
- old
+ new
@@ -2,31 +2,22 @@
require 'capybara/dsl'
require 'securerandom'
require 'bbq/util'
module Bbq
-
class TestUser
-
include ActionDispatch::Routing::UrlFor
include Rails.application.routes.url_helpers
+ include ActionDispatch::Routing::RouteSet::MountedHelpers unless Rails.version < "3.1"
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_driver(current_driver) do
Capybara.using_session(session_name) do
@@ -50,21 +41,14 @@
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