diff --git a/app/views/aspects/_selected_contacts.html.haml b/app/views/aspects/_selected_contacts.html.haml index 385197682..02ddb70ad 100644 --- a/app/views/aspects/_selected_contacts.html.haml +++ b/app/views/aspects/_selected_contacts.html.haml @@ -1,7 +1,7 @@ #selected_aspect_contacts.section .title.no_icon %h5 - - if @aspect_ids.size > 1 + - if all_aspects_selected? || @aspect_ids.size > 1 = "#{t('_contacts')}" - else = @aspect.name diff --git a/features/closes_account.feature b/features/closes_account.feature index 6ee0b0419..96ba83664 100644 --- a/features/closes_account.feature +++ b/features/closes_account.feature @@ -13,7 +13,7 @@ Feature: Close Account Then I should be on the home page When I go to the new user session page - And I try to sign in + And I try to sign in manually Then I should be on the new user session page When I wait for the ajax to finish Then I should see "Invalid email or password." diff --git a/features/step_definitions/session_steps.rb b/features/step_definitions/session_steps.rb index 79ebb7eba..11a369746 100644 --- a/features/step_definitions/session_steps.rb +++ b/features/step_definitions/session_steps.rb @@ -16,6 +16,18 @@ end When /^I try to sign in$/ do @me ||= Factory(:user_with_aspect, :getting_started => false) + #page.driver.post(integration_sessions_path(:user_id => @me.id)) + + page.driver.visit(new_integration_sessions_path(:user_id => @me.id)) + And %(I press "Login") + # To save time as compared to: + #When %(I go to the new user session page) + #When %(I fill in "Username" with "#{@me.username}") + #When %(I fill in "Password" with "#{@me.password}") + #When %(I press "Sign in") +end + +When /^I try to sign in manually$/ do When %(I go to the new user session page) When %(I fill in "Username" with "#{@me.username}") When %(I fill in "Password" with "#{@me.password}") diff --git a/features/support/env.rb b/features/support/env.rb index 50a591bca..8687f2234 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -40,6 +40,7 @@ DatabaseCleaner.orm = "active_record" Cucumber::Rails::World.use_transactional_fixtures = false require File.join(File.dirname(__FILE__), "database_cleaner_patches") +require File.join(File.dirname(__FILE__), "integration_sessions_controller") require File.join(File.dirname(__FILE__), "..", "..", "spec", "support", "fake_redis") require File.join(File.dirname(__FILE__), "..", "..", "spec", "helper_methods") diff --git a/features/support/integration_sessions_controller.rb b/features/support/integration_sessions_controller.rb new file mode 100644 index 000000000..ba47346f7 --- /dev/null +++ b/features/support/integration_sessions_controller.rb @@ -0,0 +1,25 @@ +class IntegrationSessionsController < ApplicationController + def new + @user_id = params[:user_id] + render 'features/support/integration_sessions_form' + end + def create + sign_in_and_redirect User.find(params[:user_id]) + end +end + +#Copypasta from http://openhood.com/rails/rails%203/2010/07/20/add-routes-at-runtime-rails-3/ +begin + _routes = Diaspora::Application.routes + _routes.disable_clear_and_finalize = true + _routes.clear! + Diaspora::Application.routes_reloader.paths.each{ |path| load(path) } + _routes.draw do + # here you can add any route you want + post 'integration_sessions' => 'integration_sessions#create', :as => 'integration_sessions' + get 'integration_sessions' => 'integration_sessions#new', :as => 'new_integration_sessions' + end + ActiveSupport.on_load(:action_controller) { _routes.finalize! } +ensure + _routes.disable_clear_and_finalize = false +end diff --git a/features/support/integration_sessions_form.haml b/features/support/integration_sessions_form.haml new file mode 100644 index 000000000..90c676531 --- /dev/null +++ b/features/support/integration_sessions_form.haml @@ -0,0 +1 @@ += button_to "Login", integration_sessions_path(:user_id => @user_id)