mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 06:21:49 +01:00
add cucumber for integration testing and add a feature for statistics
refactor some stuff to support testing statistisc
This commit is contained in:
parent
058079a0a7
commit
43440eaf33
11 changed files with 286 additions and 5 deletions
17
features/support/env.rb
Normal file
17
features/support/env.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Sets up the Rails environment for Cucumber
|
||||
ENV["RAILS_ENV"] ||= "test"
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
||||
require 'cucumber/rails/world'
|
||||
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
|
||||
Cucumber::Rails.use_transactional_fixtures
|
||||
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
|
||||
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
||||
|
||||
require 'webrat'
|
||||
|
||||
Webrat.configure do |config|
|
||||
config.mode = :rails
|
||||
end
|
||||
|
||||
require 'cucumber/rails/rspec'
|
||||
require 'webrat/core/matchers'
|
||||
22
features/support/paths.rb
Normal file
22
features/support/paths.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
module NavigationHelpers
|
||||
def path_to(page_name)
|
||||
case page_name
|
||||
|
||||
when /the homepage/
|
||||
root_path
|
||||
when /the statistics page/
|
||||
stats_path
|
||||
|
||||
# Add more page name => path mappings here
|
||||
|
||||
else
|
||||
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
||||
"Now, go and add a mapping in features/support/paths.rb"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
World do |world|
|
||||
world.extend NavigationHelpers
|
||||
world
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue