diff --git a/app/views/notes/_notes.rhtml b/app/views/notes/_notes.rhtml
index 4ae528e0..f9f9dacb 100644
--- a/app/views/notes/_notes.rhtml
+++ b/app/views/notes/_notes.rhtml
@@ -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" ) %> |
diff --git a/config/cucumber.yml b/config/cucumber.yml
index c4d32843..080025da 100644
--- a/config/cucumber.yml
+++ b/config/cucumber.yml
@@ -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
diff --git a/config/database.yml.tmpl b/config/database.yml.tmpl
index 87014691..d7738ac5 100644
--- a/config/database.yml.tmpl
+++ b/config/database.yml.tmpl
@@ -15,3 +15,9 @@ production:
host: localhost
username: root
password:
+
+cucumber:
+ <<: *TEST
+
+selenium:
+ <<: *TEST
diff --git a/config/environments/selenium.rb b/config/environments/selenium.rb
new file mode 100644
index 00000000..26c08a08
--- /dev/null
+++ b/config/environments/selenium.rb
@@ -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'))
+
diff --git a/features/notes_manage.feature b/features/notes_manage.feature
index bf4be120..5ed5cbf7 100644
--- a/features/notes_manage.feature
+++ b/features/notes_manage.feature
@@ -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
diff --git a/features/step_definitions/login_steps.rb b/features/step_definitions/login_steps.rb
index 13c50b59..b4d80868 100644
--- a/features/step_definitions/login_steps.rb
+++ b/features/step_definitions/login_steps.rb
@@ -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
@@ -11,4 +11,4 @@ When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do
fill_in 'Login', :with => username
fill_in 'Password', :with => password
click_button
-end
\ No newline at end of file
+end
diff --git a/features/step_definitions/note_steps.rb b/features/step_definitions/note_steps.rb
index 59dfe53a..5f8b6a87 100644
--- a/features/step_definitions/note_steps.rb
+++ b/features/step_definitions/note_steps.rb
@@ -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
diff --git a/features/support/selenium.rb b/features/support/selenium.rb
new file mode 100644
index 00000000..a1e23d4e
--- /dev/null
+++ b/features/support/selenium.rb
@@ -0,0 +1,6 @@
+Webrat.configure do |config|
+ config.mode = :selenium
+ config.application_environment = :selenium
+end
+
+Cucumber::Rails::World.use_transactional_fixtures = false
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index ca07245b..fcae81a9 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -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'){