From 88aea500243c17b891bcf46eae466ddb6e0dab1a Mon Sep 17 00:00:00 2001 From: Cyril Mougel Date: Tue, 17 Sep 2013 23:01:22 +0200 Subject: [PATCH] Add Acceptance test to unwatch application --- app/views/devise/sessions/new.html.haml | 2 +- config/locales/en.yml | 3 +++ spec/acceptance/sign_in_with_github_spec.rb | 1 + spec/acceptance/watch_unwatch_app.rb | 23 +++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 spec/acceptance/watch_unwatch_app.rb diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 565419c02..29fa3b02b 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -22,7 +22,7 @@ = f.label :remember_me %div.buttons - %button{:type => 'submit', :class => 'sign_in'}= "Sign in" + %button{:type => 'submit', :class => 'sign_in'}=t('.sign_in') :javascript $('a#forgot_password').click(function(){ diff --git a/config/locales/en.yml b/config/locales/en.yml index ade58a0e1..7e6b8f827 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -65,6 +65,9 @@ en: omniauth_callbacks: failure: "Could not authenticate you from %{kind} because \"%{reason}\"." success: "Successfully authenticated from %{kind} account." + sessions: + new: + sign_in: "Sign in" apps: index: diff --git a/spec/acceptance/sign_in_with_github_spec.rb b/spec/acceptance/sign_in_with_github_spec.rb index 7b760c147..b02bc01c8 100644 --- a/spec/acceptance/sign_in_with_github_spec.rb +++ b/spec/acceptance/sign_in_with_github_spec.rb @@ -1,6 +1,7 @@ require 'acceptance/acceptance_helper' feature 'Sign in with GitHub' do + background do Errbit::Config.stub(:github_authentication) { true } Fabricate(:user, :github_login => 'nashby') diff --git a/spec/acceptance/watch_unwatch_app.rb b/spec/acceptance/watch_unwatch_app.rb new file mode 100644 index 000000000..408722189 --- /dev/null +++ b/spec/acceptance/watch_unwatch_app.rb @@ -0,0 +1,23 @@ +require 'acceptance/acceptance_helper' + +feature 'A user can watch and unwatch an application' do + + let!(:app) { Fabricate(:app) } + let!(:user) do + user = Fabricate(:user) + app.watchers.create!( + :user_id => user.id + ) + user.reload + end + + scenario 'log in watch a project and unwatch it' do + visit '/' + fill_in :user_email, :with => user.email + fill_in :user_password, :with => 'password' + click_on I18n.t('devise.sessions.new.sign_in') + click_on I18n.t('apps.show.unwatch') + expect(page).to have_content(I18n.t('apps.index.no_apps') + end + +end