mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
set configurations for using cucumber and selenium
if you want to run it, update your database.yml to include cucumber and selenium environments (like in the .tmpl) and run RAILS_ENV=selenium cucumber -p selenium
This commit is contained in:
parent
502e60c9a1
commit
8f349d3b6b
9 changed files with 60 additions and 20 deletions
|
|
@ -16,7 +16,7 @@
|
|||
:url => note_path(note),
|
||||
:method => :delete,
|
||||
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?" },
|
||||
{ :class => 'delete_note' }) -%>
|
||||
{ :class => 'delete_note', :title => "delete note" }) -%>
|
||||
<%= link_to_function(image_tag( "blank.png", :title => "Edit item", :class=>"edit_item"),
|
||||
"$('##{dom_id(note)}').toggle(); $('##{dom_id(note, 'edit')}').show(); $('##{dom_id(note, 'edit_form')} textarea').focus();" ) + " | " %>
|
||||
<%= link_to("In: " + note.project.name, project_path(note.project), :class=>"footer_link" ) %> |
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
<%
|
||||
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
||||
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
||||
std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
|
||||
requires = "-r features/support/env.rb -r features/step_definitions"
|
||||
std_opts = "#{rerun_opts} #{requires} --format rerun --out rerun.txt --strict --tags ~@wip"
|
||||
%>
|
||||
default: <%= std_opts %> --tags ~@selenium
|
||||
selenium: <%= std_opts %> --tags @selenium
|
||||
selenium: <%= std_opts %> --tags @selenium -r features/support/selenium.rb
|
||||
wip: --tags @wip:3 --wip features
|
||||
|
|
|
|||
|
|
@ -15,3 +15,9 @@ production:
|
|||
host: localhost
|
||||
username: root
|
||||
password:
|
||||
|
||||
cucumber:
|
||||
<<: *TEST
|
||||
|
||||
selenium:
|
||||
<<: *TEST
|
||||
|
|
|
|||
29
config/environments/selenium.rb
Normal file
29
config/environments/selenium.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Edit at your own peril - it's recommended to regenerate this file
|
||||
# in the future when you upgrade to a newer version of Cucumber.
|
||||
|
||||
# IMPORTANT: Setting config.cache_classes to false is known to
|
||||
# break Cucumber's use_transactional_fixtures method.
|
||||
# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
|
||||
config.cache_classes = true
|
||||
|
||||
# Log error messages when you accidentally call methods on nil.
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.action_controller.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Disable request forgery protection in test environment
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
|
||||
config.gem 'database_cleaner', :lib => false, :version => '>=0.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
|
||||
config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
||||
config.gem 'rspec', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
||||
config.gem 'rspec-rails', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ Feature: View, add, remove notes
|
|||
When I go to the notes page
|
||||
And I delete the first note
|
||||
Then the first note should disappear
|
||||
Then the badge should show 1
|
||||
And the badge should show 1
|
||||
|
||||
@selenium
|
||||
Scenario: Link to note
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
|
||||
visit login_path
|
||||
fill_in "login", :with => username
|
||||
fill_in "password", :with => password
|
||||
click_button "Sign in"
|
||||
response.body.should =~ /Login successful/m
|
||||
fill_in "Login", :with => username
|
||||
fill_in "Password", :with => password
|
||||
click_button
|
||||
response.should contain(/Login successful/)
|
||||
@current_user = User.find_by_login(username)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -38,14 +38,18 @@ end
|
|||
|
||||
Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num|
|
||||
project = @current_user.projects.create!(:name => project_name)
|
||||
num.to_i.downto 0 do |i|
|
||||
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}")
|
||||
0.upto num.to_i do |i|
|
||||
project.notes.create!(:user_id => @current_user.id, :body => "A note #{i+1}")
|
||||
end
|
||||
end
|
||||
|
||||
When /^I delete the first note$/ do
|
||||
# need selenium for this to check on the js
|
||||
pending
|
||||
click_link "delete note"
|
||||
end
|
||||
|
||||
Then /^the first note should disappear$/ do
|
||||
# the first note contains "A note 1"
|
||||
Then "I should not see \"A note 1\""
|
||||
end
|
||||
|
||||
Given /^I have one project "([^\"]*)" with 1 note$/ do |arg1|
|
||||
|
|
@ -99,12 +103,6 @@ visits '/notes'
|
|||
should_see "new exam note"
|
||||
end
|
||||
|
||||
Then "the first note should disappear" do
|
||||
wait_for_ajax_and_effects
|
||||
should_not_see 'exam note 1'
|
||||
end
|
||||
|
||||
|
||||
Then "he should see the note text" do
|
||||
should_see 'exam note 1'
|
||||
end
|
||||
|
|
|
|||
6
features/support/selenium.rb
Normal file
6
features/support/selenium.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Webrat.configure do |config|
|
||||
config.mode = :selenium
|
||||
config.application_environment = :selenium
|
||||
end
|
||||
|
||||
Cucumber::Rails::World.use_transactional_fixtures = false
|
||||
|
|
@ -49,7 +49,7 @@ $.fn.clearForm = function() {
|
|||
* Unobtrusive jQuery written by Eric Allen
|
||||
****************************************/
|
||||
|
||||
/* Set up authenticity token proplery */
|
||||
/* Set up authenticity token properly */
|
||||
$(document).ajaxSend(function(event, request, settings) {
|
||||
if ( settings.type == 'POST' ) {
|
||||
if(typeof(AUTH_TOKEN) != 'undefined'){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue