From 84e0e8f9909786ae807f1469e1fae461df79d6a4 Mon Sep 17 00:00:00 2001 From: Jose Manuel Date: Mon, 24 Aug 2015 23:04:10 +0100 Subject: [PATCH] =?UTF-8?q?Adds=20testing=20for=20moderator=C2=B4s=20admin?= =?UTF-8?q?=20consol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/admin.en.yml | 4 ++++ config/locales/admin.es.yml | 3 +++ spec/features/admin/moderators_spec.rb | 25 +++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 2c7565d62..1783ff4f6 100644 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -99,3 +99,7 @@ en: email_placeholder: 'Search user by email' search: Search user_not_found: 'User not found' + moderator: + delete: Delete + add: Add + diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index dc3213cbd..ae7c4a23b 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -99,3 +99,6 @@ es: email_placeholder: 'Buscar usuario por email' search: Buscar user_not_found: 'Usuario no encontrado' + moderator: + delete: Borrar + add: AƱadir diff --git a/spec/features/admin/moderators_spec.rb b/spec/features/admin/moderators_spec.rb index f218779b0..c94373e93 100644 --- a/spec/features/admin/moderators_spec.rb +++ b/spec/features/admin/moderators_spec.rb @@ -2,14 +2,35 @@ require 'rails_helper' feature 'Admin moderators' do background do - @user = create(:user) + @user = create(:user, first_name: 'Jose Luis', last_name: 'Balbin' ) @moderator = create(:moderator) @admin = create(:administrator) - login_as(@admin) + login_as(@admin.user) end scenario 'Index' do visit admin_moderators_path + expect(page).to have_content @moderator.name + expect(page).to have_content @moderator.email + expect(page).to_not have_content @user.name + end + + scenario 'Create Moderator', :js do + visit admin_moderators_path + fill_in 'email', with: @user.email + click_button 'Search' + + expect(page).to have_content @user.name + click_link 'Add' + + expect(page).to have_content @user.name + end + + scenario 'Delete Moderator' do + visit admin_moderators_path + click_link 'Delete' + + expect(page).to_not have_content @moderator.name end end