diff --git a/Gemfile b/Gemfile index 705a1c2b4..117e781b9 100644 --- a/Gemfile +++ b/Gemfile @@ -42,10 +42,11 @@ end group :test do gem 'webmock' gem "factory_girl_rails" - gem 'capybara', '~> 1.1.4' + gem 'capybara', '>= 2.0.1' gem "poltergeist" gem "launchy" gem "database_cleaner" gem 'shoulda-matchers' gem "faker" + gem 'capybara-screenshot' end diff --git a/Gemfile.lock b/Gemfile.lock index 0a61eaf4e..c0d66ed0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,13 +40,15 @@ GEM bourne (1.1.2) mocha (= 0.10.5) builder (3.0.4) - capybara (1.1.4) + capybara (2.0.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) + xpath (~> 1.0.0) + capybara-screenshot (0.3.4) + capybara (>= 1.0, < 3) childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) coderay (1.0.9) @@ -128,7 +130,7 @@ GEM multi_json (1.7.1) multipart-post (1.2.0) nested_form (0.3.1) - nokogiri (1.5.6) + nokogiri (1.5.8) oauth2 (0.8.1) faraday (~> 0.8) httpauth (~> 0.1) @@ -146,12 +148,10 @@ GEM omniauth (~> 1.0) orm_adapter (0.4.0) pg (0.14.1) - poltergeist (1.0.2) - capybara (~> 1.1) - childprocess (~> 0.3) + poltergeist (1.1.0) + capybara (~> 2.0, >= 2.0.1) faye-websocket (~> 0.4, >= 0.4.4) http_parser.rb (~> 0.5.3) - multi_json (~> 1.0) polyglot (0.3.3) pry (0.9.12) coderay (~> 1.0.5) @@ -189,7 +189,7 @@ GEM rspec-core (~> 2.13.0) rspec-expectations (~> 2.13.0) rspec-mocks (~> 2.13.0) - rspec-core (2.13.0) + rspec-core (2.13.1) rspec-expectations (2.13.0) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.13.0) @@ -246,11 +246,11 @@ GEM multi_json (~> 1.0, >= 1.0.2) warden (1.2.1) rack (>= 1.0) - webmock (1.10.1) + webmock (1.11.0) addressable (>= 2.2.7) crack (>= 0.3.2) websocket (1.0.7) - xpath (0.1.4) + xpath (1.0.0) nokogiri (~> 1.3) PLATFORMS @@ -260,7 +260,8 @@ DEPENDENCIES active_hash awesome_print bootstrap-sass-rails - capybara (~> 1.1.4) + capybara (>= 2.0.1) + capybara-screenshot coffee-rails database_cleaner devise (~> 2.2.3) diff --git a/spec/requests/event_listing_request_spec.rb b/spec/features/event_listing_request_spec.rb similarity index 95% rename from spec/requests/event_listing_request_spec.rb rename to spec/features/event_listing_request_spec.rb index 04b2c054a..2b6c1b199 100644 --- a/spec/requests/event_listing_request_spec.rb +++ b/spec/features/event_listing_request_spec.rb @@ -52,7 +52,7 @@ end_time_selects[1].select "45" end - select "Alaska", from: 'event_time_zone' + select "(GMT-09:00) Alaska", from: 'event_time_zone' fill_in "event_details", :with => "This is a note in the detail text box\n With a new line! and a (missing) javascript injection, as well as an unclosed

tag" click_button "Create Event" @@ -92,8 +92,8 @@ fill_in "rsvp_teaching_experience", :with => "I have taught all kinds of things." check 'Teaching' - page.find("input[type='checkbox'][value='#{@session1.id}']").should be_checked - page.find("input[type='checkbox'][value='#{@session2.id}']").should be_checked + page.first("input[type='checkbox'][value='#{@session1.id}']").should be_checked + page.first("input[type='checkbox'][value='#{@session2.id}']").should be_checked uncheck "Curriculum" diff --git a/spec/requests/event_organizer_dashboard_request_spec.rb b/spec/features/event_organizer_dashboard_request_spec.rb similarity index 96% rename from spec/requests/event_organizer_dashboard_request_spec.rb rename to spec/features/event_organizer_dashboard_request_spec.rb index 0d8c49142..406233901 100644 --- a/spec/requests/event_organizer_dashboard_request_spec.rb +++ b/spec/features/event_organizer_dashboard_request_spec.rb @@ -21,7 +21,8 @@ it "lets the user manage volunteers" do visit organize_event_path(@event) - click_link "Manage Volunteers" + within('.mission-control-actions') { click_link 'Manage Volunteers' } + page.should have_content("Assign Volunteer") end @@ -72,4 +73,4 @@ page.should have_content 'Checked In' end end -end \ No newline at end of file +end diff --git a/spec/requests/event_organizers_request_spec.rb b/spec/features/event_organizers_request_spec.rb similarity index 98% rename from spec/requests/event_organizers_request_spec.rb rename to spec/features/event_organizers_request_spec.rb index 6075052f2..20be2e1c1 100644 --- a/spec/requests/event_organizers_request_spec.rb +++ b/spec/features/event_organizers_request_spec.rb @@ -7,7 +7,7 @@ @event = create(:event) @event.organizers << @user_organizer - + sign_in_as(@user_organizer) visit "/events/#{@event.id}/organizers" @@ -62,7 +62,7 @@ page.should_not have_selector('input[value="Remove"]') end - it "should remove the organizer and display the removed organizer int the user select" do + it "should remove the organizer and display the removed organizer in the user select" do @event.organizers << @user1 visit "/events/#{@event.id}/organizers" @@ -72,4 +72,4 @@ removed_user.value.should eq(@user1.id.to_s) removed_user.text.should eq(@user1.full_name) end -end \ No newline at end of file +end diff --git a/spec/requests/event_volunteer_emails_request_spec.rb b/spec/features/event_volunteer_emails_request_spec.rb similarity index 100% rename from spec/requests/event_volunteer_emails_request_spec.rb rename to spec/features/event_volunteer_emails_request_spec.rb diff --git a/spec/requests/event_volunteers_request_spec.rb b/spec/features/event_volunteers_request_spec.rb similarity index 100% rename from spec/requests/event_volunteers_request_spec.rb rename to spec/features/event_volunteers_request_spec.rb diff --git a/spec/requests/individual_event_page_request_spec.rb b/spec/features/individual_event_page_request_spec.rb similarity index 100% rename from spec/requests/individual_event_page_request_spec.rb rename to spec/features/individual_event_page_request_spec.rb diff --git a/spec/requests/locations_request_spec.rb b/spec/features/locations_request_spec.rb similarity index 100% rename from spec/requests/locations_request_spec.rb rename to spec/features/locations_request_spec.rb diff --git a/spec/requests/new_event_request_spec.rb b/spec/features/new_event_request_spec.rb similarity index 100% rename from spec/requests/new_event_request_spec.rb rename to spec/features/new_event_request_spec.rb diff --git a/spec/requests/profiles_spec.rb b/spec/features/profiles_spec.rb similarity index 100% rename from spec/requests/profiles_spec.rb rename to spec/features/profiles_spec.rb diff --git a/spec/requests/users_request_spec.rb b/spec/features/users_request_spec.rb similarity index 93% rename from spec/requests/users_request_spec.rb rename to spec/features/users_request_spec.rb index 5ed2b6fc5..8040f2dad 100644 --- a/spec/requests/users_request_spec.rb +++ b/spec/features/users_request_spec.rb @@ -9,8 +9,8 @@ fill_in "user_first_name", :with => @user.first_name fill_in "user_last_name", :with => @user.last_name fill_in "Email", :with => @user.email - fill_in "Password", :with => @user.password - fill_in "Password confirmation", :with => @user.password + fill_in 'user_password', with: @user.password + fill_in 'user_password_confirmation', with: @user.password click_button "Sign up" page.should have_content("A message with a confirmation link has been sent to your email address. Please open the link to activate your account.") end @@ -33,7 +33,7 @@ page.should have_content("Sign in") current_path.should == new_user_session_path end - + describe "is signed in" do before do sign_in_as(@user) @@ -44,14 +44,14 @@ page.should have_link("Sign Out") page.should_not have_link("Sign In") page.should_not have_link("Sign Up") - end + end end - + it "should see sign up link on the home page" do visit '/' page.should have_link("Sign Up") end - + it "should be able to sign up from the home page" do visit '/' click_link("Sign Up") @@ -68,4 +68,4 @@ page.should have_link("Profile") end end -end \ No newline at end of file +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5e297cc61..d460ff2e3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,7 @@ require 'rspec/rails' require 'capybara/rspec' require 'capybara/poltergeist' +require 'capybara-screenshot/rspec' require 'webmock/rspec' Capybara.javascript_driver = :poltergeist @@ -12,7 +13,7 @@ RSpec.configure do |config| config.mock_with :rspec - + config.use_transactional_fixtures = false config.before(:suite) do @@ -38,7 +39,7 @@ #Uncomment if need to write tests using devise helpers #config.extend ControllerMacros, :type => :controller config.include Devise::TestHelpers, :type => :controller - + config.include FactoryGirl::Syntax::Methods end