Working user order flow spec

This commit is contained in:
2013-12-02 07:38:02 +01:00
parent 7b9b784ef9
commit afb30556bd
15 changed files with 161 additions and 7 deletions
+33
View File
@@ -22,6 +22,38 @@ module FactoryAttributesFor
super(obj, options).merge(build(obj).attributes.select{|k,v| k =~ /_id$/}).symbolize_keys
end
end
module SpecSelectorHelpers
def top_navigation
'.navbar-fixed-top'
end
# allows tests like:
# route_should_be 'agama_groups#index'
def route_should_be(route_def)
route_hash = case route_def
when String
controller_name, action_name = route_def.split('#')
#action_name = 'index' unless action_name.present?
{controller: controller_name, action: action_name}
else
route_def
end
Rails.application.routes.recognize_path(page.current_path).should include route_hash
end
# Uses the click_on method for capybara
def click_on_translation(key)
text = I18n.t(key)
text.should_not =~ /missing/
click_on text
end
# same as save_and_open_page but with styling
def show_page
save_page Rails.root.join( 'public', 'capybara.html' )
%x(launchy http://localhost:3000/capybara.html)
end
end
RSpec.configure do |config|
# == Mock Framework
#
@@ -36,6 +68,7 @@ RSpec.configure do |config|
config.include Devise::TestHelpers, type: :controller
config.include EndWithMatcher
config.include Features::BasicHelpers, type: :feature
config.include SpecRouteHelpers, type: :feature
#config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = true
config.filter_run_excluding broken: true