Updates tests with new texts
This commit is contained in:
@@ -119,13 +119,10 @@ en:
|
||||
level_5: "Level 5"
|
||||
index:
|
||||
title: "Officials"
|
||||
search_placeholder: "Search user by name or email"
|
||||
search: "Search"
|
||||
search:
|
||||
title: "Official positions: User search"
|
||||
edit_official: "Edit official"
|
||||
make_official: "Make official"
|
||||
search: "Search"
|
||||
edit:
|
||||
title: "Officials: Edit user"
|
||||
destroy: "Remove 'Official' status"
|
||||
|
||||
@@ -70,7 +70,7 @@ en:
|
||||
user: "Account"
|
||||
debate: "Debate"
|
||||
proposal: "Proposal"
|
||||
verification:":sms: Telephone"
|
||||
verification::sms: "Telephone"
|
||||
application:
|
||||
alert:
|
||||
only_beta_testers: "Sorry: only beta testers have access at this time"
|
||||
@@ -343,9 +343,9 @@ en:
|
||||
title: "Participate"
|
||||
go_to_index: "See proposals and debates"
|
||||
user_permission_info: "With your account you can..."
|
||||
user_permission_title: "Participation"
|
||||
user_permission_debates: "Participate on debates"
|
||||
user_permission_proposal: "Create new proposals"
|
||||
user_permission_support_proposal: "Support proposals*"
|
||||
user_permission_votes: "Participate on final voting"
|
||||
user_permission_verify: "To perform all the actions %{verify}."
|
||||
user_permission_verify_url: "verify your account"
|
||||
|
||||
@@ -37,7 +37,7 @@ feature 'Account' do
|
||||
check 'account_email_on_comment_reply'
|
||||
click_button 'Save changes'
|
||||
|
||||
expect(page).to have_content "Saved"
|
||||
expect(page).to have_content "Changes saved"
|
||||
|
||||
visit account_path
|
||||
|
||||
@@ -55,7 +55,7 @@ feature 'Account' do
|
||||
check 'account_email_on_comment_reply'
|
||||
click_button 'Save changes'
|
||||
|
||||
expect(page).to have_content "Saved"
|
||||
expect(page).to have_content "Changes saved"
|
||||
|
||||
visit account_path
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ feature 'Admin activity' do
|
||||
visit proposal_path(proposal)
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
click_link 'Ban author'
|
||||
click_link 'Hide author'
|
||||
end
|
||||
|
||||
visit admin_activity_path
|
||||
@@ -221,7 +221,7 @@ feature 'Admin activity' do
|
||||
visit moderation_users_path(name_or_email: user.username)
|
||||
|
||||
within(".admin-list") do
|
||||
click_link 'Ban'
|
||||
click_link 'Block'
|
||||
end
|
||||
|
||||
visit admin_activity_path
|
||||
|
||||
@@ -18,7 +18,7 @@ feature 'Admin comments' do
|
||||
|
||||
visit proposal_path(proposal)
|
||||
within("#proposal_#{proposal.id}") do
|
||||
click_link 'Ban author'
|
||||
click_link 'Hide author'
|
||||
end
|
||||
|
||||
visit admin_comments_path
|
||||
|
||||
@@ -32,7 +32,7 @@ feature 'Admin officials' do
|
||||
select '3', from: 'user_official_level', exact: false
|
||||
click_button 'Update User'
|
||||
|
||||
expect(page).to have_content 'Official position saved!'
|
||||
expect(page).to have_content 'Details of official saved'
|
||||
|
||||
visit admin_officials_path
|
||||
|
||||
@@ -55,7 +55,7 @@ feature 'Admin officials' do
|
||||
select '4', from: 'user_official_level', exact: false
|
||||
click_button 'Update User'
|
||||
|
||||
expect(page).to have_content 'Official position saved!'
|
||||
expect(page).to have_content 'Details of official saved'
|
||||
|
||||
visit admin_officials_path
|
||||
|
||||
@@ -68,9 +68,9 @@ feature 'Admin officials' do
|
||||
scenario 'Destroy' do
|
||||
visit edit_admin_official_path(@official)
|
||||
|
||||
click_link "Remove 'Official' condition"
|
||||
click_link "Remove 'Official' status"
|
||||
|
||||
expect(page).to have_content 'User is not an official anymore'
|
||||
expect(page).to have_content 'Details saved: the user is no longer an official'
|
||||
expect(current_path).to eq(admin_officials_path)
|
||||
expect(page).to_not have_content @citizen.name
|
||||
expect(page).to_not have_content @official.name
|
||||
|
||||
@@ -22,7 +22,7 @@ feature 'Admin::Organizations' do
|
||||
expect(page).to have_content(org.user.email)
|
||||
expect(page).to_not have_content("Greentroll")
|
||||
expect(page).to_not have_content("trol@troller.com")
|
||||
expect(page).to have_content("There is 1 organization without user or with the user banned")
|
||||
expect(page).to have_content("There is also one organisation with no users or with a hidden user")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -25,6 +25,6 @@ feature 'Admin settings' do
|
||||
click_button 'Update'
|
||||
end
|
||||
|
||||
expect(page).to have_content 'Setting updated!'
|
||||
expect(page).to have_content 'Value updated'
|
||||
end
|
||||
end
|
||||
@@ -54,7 +54,7 @@ feature 'Admin tags' do
|
||||
expect(page).to have_content tag2.name
|
||||
|
||||
within("#edit_tag_#{tag2.id}") do
|
||||
click_link 'Delete Topic'
|
||||
click_link 'Destroy Topic'
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
@@ -73,7 +73,7 @@ feature 'Admin tags' do
|
||||
expect(page).to have_content tag2.name
|
||||
|
||||
within("#edit_tag_#{tag2.id}") do
|
||||
click_link 'Delete Topic'
|
||||
click_link 'Destroy Topic'
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
|
||||
@@ -43,7 +43,7 @@ feature 'Incomplete verifications' do
|
||||
visit admin_verifications_path
|
||||
|
||||
within "#user_#{incompletely_verified_user.id}" do
|
||||
expect(page).to have_content "Spanish ID"
|
||||
expect(page).to have_content "DNI"
|
||||
expect(page).to have_content incompletely_verified_user.document_number
|
||||
expect(page).to have_content Date.new(1900, 1, 1)
|
||||
expect(page).to have_content "28000"
|
||||
|
||||
@@ -17,7 +17,7 @@ feature 'Admin' do
|
||||
|
||||
expect(current_path).not_to eq(admin_root_path)
|
||||
expect(current_path).to eq(proposals_path)
|
||||
expect(page).to have_content "not authorized"
|
||||
expect(page).to have_content "You do not have permission to access this page"
|
||||
end
|
||||
|
||||
scenario 'Access as a moderator is not authorized' do
|
||||
@@ -26,7 +26,7 @@ feature 'Admin' do
|
||||
|
||||
expect(current_path).not_to eq(admin_root_path)
|
||||
expect(current_path).to eq(proposals_path)
|
||||
expect(page).to have_content "not authorized"
|
||||
expect(page).to have_content "You do not have permission to access this page"
|
||||
end
|
||||
|
||||
scenario 'Access as an administrator is authorized' do
|
||||
@@ -34,7 +34,7 @@ feature 'Admin' do
|
||||
visit admin_root_path
|
||||
|
||||
expect(current_path).to eq(admin_root_path)
|
||||
expect(page).to_not have_content "not authorized"
|
||||
expect(page).to_not have_content "You do not have permission to access this page"
|
||||
end
|
||||
|
||||
scenario "Admin access links" do
|
||||
@@ -99,7 +99,7 @@ feature 'Admin' do
|
||||
|
||||
expect(page).to have_content 'Mi barrio'
|
||||
|
||||
click_link 'Delete Topic'
|
||||
click_link 'Destroy Topic'
|
||||
|
||||
expect(page).not_to have_content 'Mi barrio'
|
||||
end
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Beta testers' do
|
||||
|
||||
background do
|
||||
allow_any_instance_of(ApplicationController).
|
||||
to receive(:beta_site?).and_return(true)
|
||||
|
||||
allow_any_instance_of(ApplicationController).
|
||||
to receive(:beta_testers).and_return(['isabel@example.com'])
|
||||
end
|
||||
|
||||
scenario 'Beta testers should have access' do
|
||||
visit root_path
|
||||
sign_up('isabel@example.com', 'secretpassword')
|
||||
confirm_email
|
||||
|
||||
fill_in 'user_email', with: 'isabel@example.com'
|
||||
fill_in 'user_password', with: 'secretpassword'
|
||||
click_button 'Log in'
|
||||
|
||||
expect(page).to have_content "Signed in successfully."
|
||||
end
|
||||
|
||||
scenario 'Non beta testers should not have access' do
|
||||
visit root_path
|
||||
sign_up('other@example.com', 'secretpassword')
|
||||
confirm_email
|
||||
|
||||
fill_in 'user_email', with: 'other@example.com'
|
||||
fill_in 'user_password', with: 'secretpassword'
|
||||
click_button 'Log in'
|
||||
|
||||
expect(page).to have_content "Sorry only Beta Testers are allowed access at the moment"
|
||||
end
|
||||
|
||||
scenario "Trying to access site without being logged in" do
|
||||
visit debates_path
|
||||
|
||||
expect(page).to have_content "Sorry only Beta Testers are allowed access at the moment"
|
||||
expect(current_path).to eq(new_user_session_path)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -67,7 +67,7 @@ feature 'Commenting debates' do
|
||||
create(:comment, commentable: debate)
|
||||
visit debate_path(debate)
|
||||
|
||||
expect(page).to have_content 'You need to sign in or sign up to comment'
|
||||
expect(page).to have_content 'You must Sign in or Sign up to leave a comment'
|
||||
within('#comments') do
|
||||
expect(page).to_not have_content 'Write a comment'
|
||||
expect(page).to_not have_content 'Reply'
|
||||
|
||||
@@ -67,7 +67,7 @@ feature 'Commenting proposals' do
|
||||
create(:comment, commentable: proposal)
|
||||
visit proposal_path(proposal)
|
||||
|
||||
expect(page).to have_content 'You need to sign in or sign up to comment'
|
||||
expect(page).to have_content 'You must Sign in or Sign up to leave a comment'
|
||||
within('#comments') do
|
||||
expect(page).to_not have_content 'Write a comment'
|
||||
expect(page).to_not have_content 'Reply'
|
||||
|
||||
@@ -56,7 +56,7 @@ feature 'Debates' do
|
||||
|
||||
visit debates_path(order: :hot_score, page: 1)
|
||||
first(:link, debate.title).click
|
||||
link_text = find_link('Back')[:href]
|
||||
link_text = find_link('Go back')[:href]
|
||||
|
||||
expect(link_text).to include(debates_path order: :hot_score, page: 1)
|
||||
end
|
||||
@@ -74,7 +74,7 @@ feature 'Debates' do
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content 'A title for a debate'
|
||||
expect(page).to have_content 'Debate was successfully created.'
|
||||
expect(page).to have_content 'Debate created successfully.'
|
||||
expect(page).to have_content 'This is very important because...'
|
||||
expect(page).to have_content author.name
|
||||
expect(page).to have_content I18n.l(Debate.last.created_at.to_date)
|
||||
@@ -91,13 +91,13 @@ feature 'Debates' do
|
||||
|
||||
click_button "Start a debate"
|
||||
|
||||
expect(page).to_not have_content "Debate was successfully created."
|
||||
expect(page).to_not have_content "Debate created successfully."
|
||||
expect(page).to have_content "1 error"
|
||||
|
||||
fill_in 'debate_captcha', with: correct_captcha_text
|
||||
click_button "Start a debate"
|
||||
|
||||
expect(page).to have_content "Debate was successfully created."
|
||||
expect(page).to have_content "Debate created successfully."
|
||||
end
|
||||
|
||||
scenario 'Failed creation goes back to new showing featured tags' do
|
||||
@@ -113,7 +113,7 @@ feature 'Debates' do
|
||||
|
||||
click_button "Start a debate"
|
||||
|
||||
expect(page).to_not have_content "Debate was successfully created."
|
||||
expect(page).to_not have_content "Debate created successfully."
|
||||
expect(page).to have_content "error"
|
||||
within(".tags") do
|
||||
expect(page).to have_content featured_tag.name
|
||||
@@ -142,7 +142,7 @@ feature 'Debates' do
|
||||
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully created.'
|
||||
expect(page).to have_content 'Debate created successfully.'
|
||||
expect(page).to have_content 'Testing an attack'
|
||||
expect(page.html).to include '<p>This is alert("an attack");</p>'
|
||||
expect(page.html).to_not include '<script>alert("an attack");</script>'
|
||||
@@ -161,7 +161,7 @@ feature 'Debates' do
|
||||
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully created.'
|
||||
expect(page).to have_content 'Debate created successfully.'
|
||||
expect(page).to have_content 'Testing auto link'
|
||||
expect(page).to have_link('www.example.org', href: 'http://www.example.org')
|
||||
end
|
||||
@@ -178,13 +178,13 @@ feature 'Debates' do
|
||||
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully created.'
|
||||
expect(page).to have_content 'Debate created successfully.'
|
||||
expect(page).to have_content 'Testing auto link'
|
||||
expect(page).to have_link('http://example.org', href: 'http://example.org')
|
||||
expect(page).not_to have_link('click me')
|
||||
expect(page.html).to_not include "<script>alert('hey')</script>"
|
||||
|
||||
click_link 'Edit debate'
|
||||
click_link 'Edit'
|
||||
|
||||
expect(current_path).to eq edit_debate_path(Debate.last)
|
||||
expect(page).not_to have_link('click me')
|
||||
@@ -216,7 +216,7 @@ feature 'Debates' do
|
||||
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully created.'
|
||||
expect(page).to have_content 'Debate created successfully.'
|
||||
['Medio Ambiente', 'Ciencia'].each do |tag_name|
|
||||
expect(page).to have_content tag_name
|
||||
end
|
||||
@@ -234,7 +234,7 @@ feature 'Debates' do
|
||||
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully created.'
|
||||
expect(page).to have_content 'Debate created successfully.'
|
||||
expect(page).to have_content 'user_id1'
|
||||
expect(page).to have_content 'a3'
|
||||
expect(page).to have_content 'scriptalert("hey");script'
|
||||
@@ -250,7 +250,7 @@ feature 'Debates' do
|
||||
visit edit_debate_path(debate)
|
||||
expect(current_path).not_to eq(edit_debate_path(debate))
|
||||
expect(current_path).to eq(proposals_path)
|
||||
expect(page).to have_content 'not authorized'
|
||||
expect(page).to have_content "You do not have permission to carry out the action 'edit' on debate."
|
||||
end
|
||||
|
||||
scenario 'Update should not be posible if debate is not editable' do
|
||||
@@ -265,7 +265,7 @@ feature 'Debates' do
|
||||
|
||||
expect(current_path).not_to eq(edit_debate_path(debate))
|
||||
expect(current_path).to eq(proposals_path)
|
||||
expect(page).to have_content 'not authorized'
|
||||
expect(page).to have_content 'You do not have permission to'
|
||||
end
|
||||
|
||||
scenario 'Update should be posible for the author of an editable debate' do
|
||||
@@ -281,7 +281,7 @@ feature 'Debates' do
|
||||
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Debate was successfully updated."
|
||||
expect(page).to have_content "Debate updated successfully."
|
||||
expect(page).to have_content "End child poverty"
|
||||
expect(page).to have_content "Let's do something to end child poverty"
|
||||
end
|
||||
@@ -308,13 +308,13 @@ feature 'Debates' do
|
||||
fill_in 'debate_captcha', with: "wrong!"
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to_not have_content "Debate was successfully updated."
|
||||
expect(page).to_not have_content "Debate updated successfully."
|
||||
expect(page).to have_content "error"
|
||||
|
||||
fill_in 'debate_captcha', with: correct_captcha_text
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Debate was successfully updated."
|
||||
expect(page).to have_content "Debate updated successfully."
|
||||
end
|
||||
|
||||
scenario 'Failed update goes back to edit showing featured tags' do
|
||||
@@ -330,7 +330,7 @@ feature 'Debates' do
|
||||
fill_in 'debate_captcha', with: correct_captcha_text
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to_not have_content "Debate was successfully updated."
|
||||
expect(page).to_not have_content "Debate updated successfully."
|
||||
expect(page).to have_content "error"
|
||||
within(".tags") do
|
||||
expect(page).to have_content featured_tag.name
|
||||
@@ -419,7 +419,7 @@ feature 'Debates' do
|
||||
create(:debate, title: 'Medium').update_column(:confidence_score, 5)
|
||||
|
||||
visit debates_path
|
||||
select 'best rated', from: 'order-selector'
|
||||
select 'highest rated', from: 'order-selector'
|
||||
|
||||
expect(page).to have_selector('.js-order-selector[data-order="confidence_score"]')
|
||||
|
||||
@@ -518,10 +518,10 @@ feature 'Debates' do
|
||||
conflictive_debate = create(:debate, :conflictive)
|
||||
|
||||
visit debate_path(conflictive_debate)
|
||||
expect(page).to have_content "This debate has been flag as innapropiate for some users."
|
||||
expect(page).to have_content "This debate has been flagged as inappropriate by several users."
|
||||
|
||||
visit debate_path(good_debate)
|
||||
expect(page).to_not have_content "This debate has been flag as innapropiate for some users."
|
||||
expect(page).to_not have_content "This debate has been flagged as inappropriate by several users."
|
||||
end
|
||||
|
||||
scenario 'Erased author' do
|
||||
|
||||
@@ -31,7 +31,7 @@ feature 'Emails' do
|
||||
comment_on(proposal)
|
||||
|
||||
email = open_last_email
|
||||
expect(email).to have_subject('Someone has commented on your proposal')
|
||||
expect(email).to have_subject('Someone has commented on your citizen proposal')
|
||||
expect(email).to deliver_to(proposal.author)
|
||||
expect(email).to have_body_text(proposal_path(proposal))
|
||||
end
|
||||
@@ -88,7 +88,7 @@ feature 'Emails' do
|
||||
reply_to(user)
|
||||
|
||||
email = open_last_email
|
||||
expect(email).to have_subject('Someone has replied to your comment')
|
||||
expect(email).to have_subject('Someone has responded to your comment')
|
||||
expect(email).to deliver_to(user)
|
||||
expect(email).to have_body_text(debate_path(Comment.first.commentable))
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ feature "Highlights" do
|
||||
|
||||
visit highlights_path
|
||||
|
||||
expect(page).to have_link("Start a proposal")
|
||||
expect(page).to have_link("Create a proposal")
|
||||
expect(page).to have_link("Start a debate")
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ feature "Home" do
|
||||
scenario 'Welcome message' do
|
||||
visit root_path
|
||||
|
||||
expect(page).to have_content "we open this digital Puerta del Sol"
|
||||
expect(page).to have_content "Love the city, and it will become a city you love"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ feature 'EmailVerifications' do
|
||||
sent_token = /.*email_verification_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
|
||||
visit email_path(email_verification_token: sent_token)
|
||||
|
||||
expect(page).to have_content "You are now a verified user"
|
||||
expect(page).to have_content "You are a verified user"
|
||||
|
||||
expect(page).to_not have_link "Verify my account"
|
||||
expect(page).to have_content "Verified account"
|
||||
expect(page).to have_content "Account verified"
|
||||
|
||||
expect(user.reload.document_number).to eq('1234')
|
||||
expect(user).to be_level_three_verified
|
||||
|
||||
@@ -30,9 +30,9 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
|
||||
expect(page).to have_content 'Help refugees'
|
||||
expect(page).to have_content '¿Would you like to give assistance to war refugees?'
|
||||
@@ -120,7 +120,7 @@ feature 'Proposals' do
|
||||
find('.in-favor a').click
|
||||
|
||||
expect(page).to have_content "1 support"
|
||||
expect(page).to have_content "You already supported this proposal"
|
||||
expect(page).to have_content "You have already supported this proposal. Share it!"
|
||||
end
|
||||
expect(current_path).to eq(management_proposals_path)
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ feature 'users' do
|
||||
|
||||
expect(user.reload).to be_confirmed
|
||||
|
||||
expect(page).to have_content "Your email address has been successfully confirmed."
|
||||
expect(page).to have_content "Your account has been confirmed."
|
||||
end
|
||||
|
||||
end
|
||||
@@ -75,7 +75,7 @@ feature 'Moderate comments' do
|
||||
end
|
||||
|
||||
scenario 'Ignore the comment' do
|
||||
click_on "Ignore flags"
|
||||
click_on "Marked as viewed"
|
||||
expect(page).to_not have_css("comment_#{@comment.id}")
|
||||
expect(@comment.reload).to be_ignored_flag
|
||||
expect(@comment.reload).to_not be_hidden
|
||||
@@ -106,7 +106,7 @@ feature 'Moderate comments' do
|
||||
|
||||
visit moderation_comments_path(filter: 'all', page: '2', order: 'created_at')
|
||||
|
||||
click_on "Ignore flags"
|
||||
click_on "Marked as viewed"
|
||||
|
||||
expect(page).to have_selector('.js-order-selector[data-order="created_at"]')
|
||||
|
||||
@@ -120,27 +120,27 @@ feature 'Moderate comments' do
|
||||
visit moderation_comments_path
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Marked as viewed')
|
||||
|
||||
visit moderation_comments_path(filter: 'all')
|
||||
within('.sub-nav') do
|
||||
expect(page).to_not have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Marked as viewed')
|
||||
end
|
||||
|
||||
visit moderation_comments_path(filter: 'pending_flag_review')
|
||||
within('.sub-nav') do
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Marked as viewed')
|
||||
end
|
||||
|
||||
visit moderation_comments_path(filter: 'with_ignored_flag')
|
||||
within('.sub-nav') do
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to_not have_link('Ignored')
|
||||
expect(page).to_not have_link('Marked as viewed')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ feature 'Moderate debates' do
|
||||
end
|
||||
|
||||
scenario 'Ignore the debate' do
|
||||
click_on "Ignore flags"
|
||||
click_on "Marked as viewed"
|
||||
expect(page).to_not have_css("debate_#{@debate.id}")
|
||||
expect(@debate.reload).to be_ignored_flag
|
||||
expect(@debate.reload).to_not be_hidden
|
||||
@@ -105,7 +105,7 @@ feature 'Moderate debates' do
|
||||
|
||||
visit moderation_debates_path(filter: 'all', page: '2', order: 'created_at')
|
||||
|
||||
click_on "Ignore flags"
|
||||
click_on "Marked as viewed"
|
||||
|
||||
expect(page).to have_selector('.js-order-selector[data-order="created_at"]')
|
||||
|
||||
@@ -119,27 +119,27 @@ feature 'Moderate debates' do
|
||||
visit moderation_debates_path
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Marked as viewed')
|
||||
|
||||
visit moderation_debates_path(filter: 'all')
|
||||
within('.sub-nav') do
|
||||
expect(page).to_not have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Marked as viewed')
|
||||
end
|
||||
|
||||
visit moderation_debates_path(filter: 'pending_flag_review')
|
||||
within('.sub-nav') do
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Marked as viewed')
|
||||
end
|
||||
|
||||
visit moderation_debates_path(filter: 'with_ignored_flag')
|
||||
within('.sub-nav') do
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to_not have_link('Ignored')
|
||||
expect(page).to_not have_link('Marked as viewed')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ feature 'Moderate proposals' do
|
||||
end
|
||||
|
||||
scenario 'Ignore the proposal' do
|
||||
click_on "Ignore flags"
|
||||
click_button "Mark as viewed"
|
||||
expect(page).to_not have_css("proposal_#{@proposal.id}")
|
||||
expect(@proposal.reload).to be_ignored_flag
|
||||
expect(@proposal.reload).to_not be_hidden
|
||||
@@ -105,7 +105,7 @@ feature 'Moderate proposals' do
|
||||
|
||||
visit moderation_proposals_path(filter: 'all', page: '2', order: 'created_at')
|
||||
|
||||
click_on "Ignore flags"
|
||||
click_button "Mark as viewed"
|
||||
|
||||
expect(page).to have_selector('.js-order-selector[data-order="created_at"]')
|
||||
|
||||
@@ -119,27 +119,27 @@ feature 'Moderate proposals' do
|
||||
visit moderation_proposals_path
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Mark as viewed')
|
||||
|
||||
visit moderation_proposals_path(filter: 'all')
|
||||
within('.sub-nav') do
|
||||
expect(page).to_not have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Pending review')
|
||||
expect(page).to have_link('Mark as viewed')
|
||||
end
|
||||
|
||||
visit moderation_proposals_path(filter: 'pending_flag_review')
|
||||
within('.sub-nav') do
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to_not have_link('Pending')
|
||||
expect(page).to have_link('Ignored')
|
||||
expect(page).to have_link('Marked as viewed')
|
||||
end
|
||||
|
||||
visit moderation_proposals_path(filter: 'with_ignored_flag')
|
||||
within('.sub-nav') do
|
||||
expect(page).to have_link('All')
|
||||
expect(page).to have_link('Pending')
|
||||
expect(page).to_not have_link('Ignored')
|
||||
expect(page).to_not have_link('Marked as viewed')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ feature 'Moderate users' do
|
||||
visit debate_path(debate1)
|
||||
|
||||
within("#debate_#{debate1.id}") do
|
||||
click_link 'Ban author'
|
||||
click_link 'Hide author'
|
||||
end
|
||||
|
||||
expect(current_path).to eq(debates_path)
|
||||
@@ -37,12 +37,12 @@ feature 'Moderate users' do
|
||||
|
||||
expect(page).to_not have_content(comment3.body)
|
||||
|
||||
click_link("Logout")
|
||||
click_link("Sign out")
|
||||
|
||||
click_link 'Log in'
|
||||
click_link 'Sign in'
|
||||
fill_in 'user_email', with: citizen.email
|
||||
fill_in 'user_password', with: citizen.password
|
||||
click_button 'Log in'
|
||||
click_button 'Enter'
|
||||
|
||||
expect(page).to have_content 'Invalid email or password'
|
||||
expect(current_path).to eq(new_user_session_path)
|
||||
@@ -62,13 +62,13 @@ feature 'Moderate users' do
|
||||
|
||||
within(".admin-list") do
|
||||
expect(page).to have_content citizen.name
|
||||
expect(page).not_to have_content "Banned"
|
||||
click_link 'Ban'
|
||||
expect(page).not_to have_content "Blocked"
|
||||
click_link 'Block'
|
||||
end
|
||||
|
||||
within(".admin-list") do
|
||||
expect(page).to have_content citizen.name
|
||||
expect(page).to have_content "Banned"
|
||||
expect(page).to have_content "Blocked"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ feature 'Admin' do
|
||||
|
||||
expect(current_path).not_to eq(moderation_root_path)
|
||||
expect(current_path).to eq(proposals_path)
|
||||
expect(page).to have_content "not authorized"
|
||||
expect(page).to have_content "You do not have permission to access this page"
|
||||
end
|
||||
|
||||
scenario 'Access as a moderator is authorized' do
|
||||
@@ -25,7 +25,7 @@ feature 'Admin' do
|
||||
click_on "Moderation"
|
||||
|
||||
expect(current_path).to eq(moderation_root_path)
|
||||
expect(page).to_not have_content "not authorized"
|
||||
expect(page).to_not have_content "You do not have permission to access this page"
|
||||
end
|
||||
|
||||
scenario 'Access as an administrator is authorized' do
|
||||
@@ -38,7 +38,7 @@ feature 'Admin' do
|
||||
click_on "Moderation"
|
||||
|
||||
expect(current_path).to eq(moderation_root_path)
|
||||
expect(page).to_not have_content "not authorized"
|
||||
expect(page).to_not have_content "You do not have permission to access this page"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ feature 'Organizations' do
|
||||
fill_in 'user_captcha', with: correct_captcha_text
|
||||
check 'user_terms_of_service'
|
||||
|
||||
click_button 'Sign up'
|
||||
click_button 'Register'
|
||||
|
||||
user = User.organizations.where(email: 'green@peace.com').first
|
||||
expect(user).to be
|
||||
@@ -27,7 +27,7 @@ feature 'Organizations' do
|
||||
scenario 'Errors on create' do
|
||||
visit new_organization_registration_path
|
||||
|
||||
click_button 'Sign up'
|
||||
click_button 'Register'
|
||||
|
||||
expect(page).to have_content error_message
|
||||
end
|
||||
|
||||
@@ -87,9 +87,9 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
expect(page).to have_content 'Help refugees'
|
||||
expect(page).to have_content '¿Would you like to give assistance to war refugees?'
|
||||
expect(page).to have_content 'In summary, what we want is...'
|
||||
@@ -115,9 +115,9 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_responsible_name', with: 'Isabel Garcia'
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
expect(Proposal.last.responsible_name).to eq('Isabel Garcia')
|
||||
end
|
||||
|
||||
@@ -136,9 +136,9 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
end
|
||||
|
||||
scenario 'Captcha is required for proposal creation' do
|
||||
@@ -154,15 +154,15 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: "wrongText!"
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button "Start a proposal"
|
||||
click_button "Create proposal"
|
||||
|
||||
expect(page).to_not have_content "Proposal was successfully created."
|
||||
expect(page).to_not have_content "Proposal created successfully."
|
||||
expect(page).to have_content "1 error"
|
||||
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
click_button "Start a proposal"
|
||||
click_button "Create proposal"
|
||||
|
||||
expect(page).to have_content "Proposal was successfully created."
|
||||
expect(page).to have_content "Proposal created successfully."
|
||||
end
|
||||
|
||||
scenario 'Failed creation goes back to new showing featured tags' do
|
||||
@@ -180,9 +180,9 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button "Start a proposal"
|
||||
click_button "Create proposal"
|
||||
|
||||
expect(page).to_not have_content "Proposal was successfully created."
|
||||
expect(page).to_not have_content "Proposal created successfully."
|
||||
expect(page).to have_content "error"
|
||||
within(".tags") do
|
||||
expect(page).to have_content featured_tag.name
|
||||
@@ -195,7 +195,7 @@ feature 'Proposals' do
|
||||
login_as(author)
|
||||
|
||||
visit new_proposal_path
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
expect(page).to have_content error_message
|
||||
end
|
||||
|
||||
@@ -213,9 +213,9 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
expect(page).to have_content 'Testing an attack'
|
||||
expect(page.html).to include '<p>This is alert("an attack");</p>'
|
||||
expect(page.html).to_not include '<script>alert("an attack");</script>'
|
||||
@@ -235,9 +235,9 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
expect(page).to have_content 'Testing auto link'
|
||||
expect(page).to have_link('www.example.org', href: 'http://www.example.org')
|
||||
end
|
||||
@@ -255,15 +255,15 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
check 'proposal_terms_of_service'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
expect(page).to have_content 'Testing auto link'
|
||||
expect(page).to have_link('http://example.org', href: 'http://example.org')
|
||||
expect(page).not_to have_link('click me')
|
||||
expect(page.html).to_not include "<script>alert('hey')</script>"
|
||||
|
||||
click_link 'Edit proposal'
|
||||
click_link 'Edit'
|
||||
|
||||
expect(current_path).to eq edit_proposal_path(Proposal.last)
|
||||
expect(page).not_to have_link('click me')
|
||||
@@ -297,9 +297,9 @@ feature 'Proposals' do
|
||||
find('.js-add-tag-link', text: tag_name).click
|
||||
end
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
['Medio Ambiente', 'Ciencia'].each do |tag_name|
|
||||
expect(page).to have_content tag_name
|
||||
end
|
||||
@@ -319,9 +319,9 @@ feature 'Proposals' do
|
||||
|
||||
fill_in 'proposal_tag_list', with: 'user_id=1, &a=3, <script>alert("hey");</script>'
|
||||
|
||||
click_button 'Start a proposal'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Proposal was successfully created.'
|
||||
expect(page).to have_content 'Proposal created successfully.'
|
||||
expect(page).to have_content 'user_id1'
|
||||
expect(page).to have_content 'a3'
|
||||
expect(page).to have_content 'scriptalert("hey");script'
|
||||
@@ -337,7 +337,7 @@ feature 'Proposals' do
|
||||
visit edit_proposal_path(proposal)
|
||||
expect(current_path).not_to eq(edit_proposal_path(proposal))
|
||||
expect(current_path).to eq(proposals_path)
|
||||
expect(page).to have_content 'not authorized'
|
||||
expect(page).to have_content 'You do not have permission'
|
||||
end
|
||||
|
||||
scenario 'Update should not be posible if proposal is not editable' do
|
||||
@@ -352,7 +352,7 @@ feature 'Proposals' do
|
||||
|
||||
expect(current_path).not_to eq(edit_proposal_path(proposal))
|
||||
expect(current_path).to eq(proposals_path)
|
||||
expect(page).to have_content 'not authorized'
|
||||
expect(page).to have_content 'You do not have permission'
|
||||
end
|
||||
|
||||
scenario 'Update should be posible for the author of an editable proposal' do
|
||||
@@ -372,7 +372,7 @@ feature 'Proposals' do
|
||||
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Proposal was successfully updated."
|
||||
expect(page).to have_content "Proposal updated successfully."
|
||||
expect(page).to have_content "Basically..."
|
||||
expect(page).to have_content "End child poverty"
|
||||
expect(page).to have_content "Let's do something to end child poverty"
|
||||
@@ -400,13 +400,13 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: "wrong!"
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to_not have_content "Proposal was successfully updated."
|
||||
expect(page).to_not have_content "Proposal updated successfully."
|
||||
expect(page).to have_content "error"
|
||||
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Proposal was successfully updated."
|
||||
expect(page).to have_content "Proposal updated successfully."
|
||||
end
|
||||
|
||||
scenario 'Failed update goes back to edit showing featured tags' do
|
||||
@@ -422,7 +422,7 @@ feature 'Proposals' do
|
||||
fill_in 'proposal_captcha', with: correct_captcha_text
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to_not have_content "Proposal was successfully updated."
|
||||
expect(page).to_not have_content "Proposal updated successfully."
|
||||
expect(page).to have_content "error"
|
||||
within(".tags") do
|
||||
expect(page).to have_content featured_tag.name
|
||||
@@ -482,7 +482,7 @@ feature 'Proposals' do
|
||||
create(:proposal, title: 'Medium proposal').update_column(:confidence_score, 5)
|
||||
|
||||
visit proposals_path
|
||||
select 'most supported', from: 'order-selector'
|
||||
select 'highest rated', from: 'order-selector'
|
||||
|
||||
expect(page).to have_selector('.js-order-selector[data-order="confidence_score"]')
|
||||
|
||||
@@ -587,10 +587,10 @@ feature 'Proposals' do
|
||||
conflictive_proposal = create(:proposal, :conflictive)
|
||||
|
||||
visit proposal_path(conflictive_proposal)
|
||||
expect(page).to have_content "This proposal has been flag as innapropiate for some users."
|
||||
expect(page).to have_content "This proposal has been flagged as inappropriate by several users."
|
||||
|
||||
visit proposal_path(good_proposal)
|
||||
expect(page).to_not have_content "This proposal has been flag as innapropiate for some users."
|
||||
expect(page).to_not have_content "This proposal has been flagged as inappropriate by several users."
|
||||
end
|
||||
|
||||
scenario "Flagging", :js do
|
||||
|
||||
@@ -84,7 +84,7 @@ feature 'Tags' do
|
||||
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully created.'
|
||||
expect(page).to have_content 'Debate created successfully.'
|
||||
expect(page).to have_content 'Economía'
|
||||
expect(page).to have_content 'Hacienda'
|
||||
expect(page).to have_content 'Impuestos'
|
||||
@@ -104,7 +104,7 @@ feature 'Tags' do
|
||||
|
||||
click_button 'Start a debate'
|
||||
|
||||
expect(page).to have_content '1 error prohibited this debate from being saved:'
|
||||
expect(page).to have_content error_message
|
||||
expect(page).to have_content 'tags must be less than or equal to 6'
|
||||
end
|
||||
|
||||
@@ -120,7 +120,7 @@ feature 'Tags' do
|
||||
fill_in 'debate_captcha', with: correct_captcha_text
|
||||
click_button 'Save changes'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully updated.'
|
||||
expect(page).to have_content 'Debate updated successfully.'
|
||||
within('.tags') do
|
||||
expect(page).to have_css('a', text: 'Economía')
|
||||
expect(page).to have_css('a', text: 'Hacienda')
|
||||
@@ -137,7 +137,7 @@ feature 'Tags' do
|
||||
fill_in 'debate_captcha', with: correct_captcha_text
|
||||
click_button 'Save changes'
|
||||
|
||||
expect(page).to have_content 'Debate was successfully updated.'
|
||||
expect(page).to have_content 'Debate updated successfully.'
|
||||
expect(page).to_not have_content 'Economía'
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ feature 'Users' do
|
||||
context 'Regular authentication' do
|
||||
scenario 'Sign up' do
|
||||
visit '/'
|
||||
click_link 'Sign up'
|
||||
click_link 'Register'
|
||||
|
||||
fill_in 'user_username', with: 'Manuela Carmena'
|
||||
fill_in 'user_email', with: 'manuela@madrid.es'
|
||||
@@ -14,20 +14,20 @@ feature 'Users' do
|
||||
fill_in 'user_captcha', with: correct_captcha_text
|
||||
check 'user_terms_of_service'
|
||||
|
||||
click_button 'Sign up'
|
||||
click_button 'Register'
|
||||
|
||||
expect(page).to have_content "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||
expect(page).to have_content "You have been sent a message containing a verification link. Please click on this link to activate your account."
|
||||
|
||||
sent_token = /.*confirmation_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
|
||||
visit user_confirmation_path(confirmation_token: sent_token)
|
||||
|
||||
expect(page).to have_content "Your email address has been successfully confirmed"
|
||||
expect(page).to have_content "Your account has been confirmed."
|
||||
end
|
||||
|
||||
scenario 'Errors on sign up' do
|
||||
visit '/'
|
||||
click_link 'Sign up'
|
||||
click_button 'Sign up'
|
||||
click_link 'Register'
|
||||
click_button 'Register'
|
||||
|
||||
expect(page).to have_content error_message
|
||||
end
|
||||
@@ -36,12 +36,12 @@ feature 'Users' do
|
||||
create(:user, email: 'manuela@madrid.es', password: 'judgementday')
|
||||
|
||||
visit '/'
|
||||
click_link 'Log in'
|
||||
click_link 'Sign in'
|
||||
fill_in 'user_email', with: 'manuela@madrid.es'
|
||||
fill_in 'user_password', with: 'judgementday'
|
||||
click_button 'Log in'
|
||||
click_button 'Enter'
|
||||
|
||||
expect(page).to have_content 'Signed in successfully.'
|
||||
expect(page).to have_content 'You have been signed in successfully.'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ feature 'Users' do
|
||||
OmniAuth.config.add_mock(:twitter, omniauth_twitter_hash)
|
||||
|
||||
visit '/'
|
||||
click_link 'Sign up'
|
||||
click_link 'Register'
|
||||
|
||||
expect do
|
||||
expect do
|
||||
@@ -105,7 +105,7 @@ feature 'Users' do
|
||||
OmniAuth.config.add_mock(:twitter, omniauth_twitter_hash)
|
||||
|
||||
visit '/'
|
||||
click_link 'Sign up'
|
||||
click_link 'Register'
|
||||
|
||||
expect do
|
||||
expect do
|
||||
@@ -122,7 +122,7 @@ feature 'Users' do
|
||||
expect(user.email).to eq("omniauth@participacion-12345-twitter.com")
|
||||
|
||||
fill_in 'user_email', with: 'manueladelascarmenas@example.com'
|
||||
click_button 'Sign up'
|
||||
click_button 'Register'
|
||||
|
||||
sent_token = /.*confirmation_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
|
||||
visit user_confirmation_path(confirmation_token: sent_token)
|
||||
@@ -145,7 +145,7 @@ feature 'Users' do
|
||||
OmniAuth.config.add_mock(:twitter, omniauth_twitter_hash)
|
||||
|
||||
visit '/'
|
||||
click_link 'Log in'
|
||||
click_link 'Sign in'
|
||||
|
||||
expect do
|
||||
expect do
|
||||
@@ -163,20 +163,20 @@ feature 'Users' do
|
||||
login_as(user)
|
||||
|
||||
visit "/"
|
||||
click_link 'Logout'
|
||||
click_link 'Sign out'
|
||||
|
||||
expect(page).to have_content 'Signed out successfully.'
|
||||
expect(page).to have_content 'You have been signed out successfully.'
|
||||
end
|
||||
|
||||
scenario 'Reset password' do
|
||||
create(:user, email: 'manuela@madrid.es')
|
||||
|
||||
visit '/'
|
||||
click_link 'Log in'
|
||||
click_link 'Forgot your password?'
|
||||
click_link 'Sign in'
|
||||
click_link 'Forgotten your password?'
|
||||
|
||||
fill_in 'user_email', with: 'manuela@madrid.es'
|
||||
click_button 'Send me reset password'
|
||||
click_button 'Send instructions'
|
||||
|
||||
expect(page).to have_content "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||
|
||||
|
||||
@@ -22,15 +22,15 @@ feature 'Verify email' do
|
||||
click_button "Send code"
|
||||
end
|
||||
|
||||
expect(page).to have_content 'We have send you a confirmation email to your email account: rock@example.com'
|
||||
expect(page).to have_content 'We have sent a confirmation email to your account: rock@example.com'
|
||||
|
||||
sent_token = /.*email_verification_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
|
||||
visit email_path(email_verification_token: sent_token)
|
||||
|
||||
expect(page).to have_content "You are now a verified user"
|
||||
expect(page).to have_content "You are a verified user"
|
||||
|
||||
expect(page).to_not have_link "Verify my account"
|
||||
expect(page).to have_content "Verified account"
|
||||
expect(page).to have_content "Account verified"
|
||||
end
|
||||
|
||||
scenario "Errors on token verification" do
|
||||
@@ -39,7 +39,7 @@ feature 'Verify email' do
|
||||
login_as(user)
|
||||
visit email_path(email_verification_token: "1234")
|
||||
|
||||
expect(page).to have_content "Incorrect verification code"
|
||||
expect(page).to have_content "Verification code incorrect"
|
||||
end
|
||||
|
||||
scenario "Errors on sending confirmation email" do
|
||||
@@ -60,6 +60,6 @@ feature 'Verify email' do
|
||||
verified_user.destroy
|
||||
click_button "Send code"
|
||||
|
||||
expect(page).to have_content "There was a problem sending you an email to your account"
|
||||
expect(page).to have_content "There was a problem with sending an email to your account"
|
||||
end
|
||||
end
|
||||
@@ -35,7 +35,7 @@ feature 'Verify Letter' do
|
||||
login_as(user)
|
||||
visit new_letter_path
|
||||
|
||||
expect(page).to have_content 'You have not yet confirmed your residence'
|
||||
expect(page).to have_content 'You have not yet confirmed your residency'
|
||||
expect(current_path).to eq(new_residence_path)
|
||||
end
|
||||
|
||||
@@ -45,7 +45,7 @@ feature 'Verify Letter' do
|
||||
login_as(user)
|
||||
visit new_letter_path
|
||||
|
||||
expect(page).to have_content 'You have not yet enter the confirmation code'
|
||||
expect(page).to have_content 'You have not yet entered the confirmation code'
|
||||
expect(current_path).to eq(new_sms_path)
|
||||
end
|
||||
|
||||
|
||||
@@ -20,16 +20,16 @@ feature 'Level three verification' do
|
||||
click_button "Send code"
|
||||
end
|
||||
|
||||
expect(page).to have_content 'Phone confirmation'
|
||||
expect(page).to have_content 'Security code confirmation'
|
||||
|
||||
user = user.reload
|
||||
fill_in 'sms_confirmation_code', with: user.sms_confirmation_code
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content "Correct code. Your account is verified"
|
||||
expect(page).to have_content "Code correct. Your account is now verified"
|
||||
|
||||
expect(page).to_not have_link "Verify my account"
|
||||
expect(page).to have_content "Verified account"
|
||||
expect(page).to have_content "Account verified"
|
||||
end
|
||||
|
||||
scenario 'Verification with residency and verified email' do
|
||||
@@ -51,15 +51,15 @@ feature 'Level three verification' do
|
||||
click_button "Send code"
|
||||
end
|
||||
|
||||
expect(page).to have_content 'We have send you a confirmation email to your email account: rock@example.com'
|
||||
expect(page).to have_content 'We have sent a confirmation email to your account: rock@example.com'
|
||||
|
||||
sent_token = /.*email_verification_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
|
||||
visit email_path(email_verification_token: sent_token)
|
||||
|
||||
expect(page).to have_content "You are now a verified user"
|
||||
expect(page).to have_content "You are a verified user"
|
||||
|
||||
expect(page).to_not have_link "Verify my account"
|
||||
expect(page).to have_content "Verified account"
|
||||
expect(page).to have_content "Account verified"
|
||||
end
|
||||
|
||||
scenario 'Verification with residency and sms and letter' do
|
||||
@@ -75,15 +75,15 @@ feature 'Level three verification' do
|
||||
fill_in 'sms_phone', with: "611111111"
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Phone confirmation'
|
||||
expect(page).to have_content 'Security code confirmation'
|
||||
|
||||
user = user.reload
|
||||
fill_in 'sms_confirmation_code', with: user.sms_confirmation_code
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Correct code'
|
||||
expect(page).to have_content 'Code correct'
|
||||
|
||||
click_link "Request a letter"
|
||||
click_link "Send me a letter with the code"
|
||||
|
||||
expect(page).to have_content "Before voting you'll receive a letter whith the instructions for verify your account."
|
||||
end
|
||||
|
||||
@@ -14,13 +14,13 @@ feature 'Level two verification' do
|
||||
fill_in 'sms_phone', with: "611111111"
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Phone confirmation'
|
||||
expect(page).to have_content 'Security code confirmation'
|
||||
|
||||
user = user.reload
|
||||
fill_in 'sms_confirmation_code', with: user.sms_confirmation_code
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Correct code'
|
||||
expect(page).to have_content 'Code correct'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -10,7 +10,7 @@ feature 'Residence' do
|
||||
click_link 'Verify my account'
|
||||
|
||||
fill_in 'residence_document_number', with: "12345678Z"
|
||||
select 'Spanish ID', from: 'residence_document_type'
|
||||
select 'DNI', from: 'residence_document_type'
|
||||
select_date '31-December-1980', from: 'residence_date_of_birth'
|
||||
fill_in 'residence_postal_code', with: '28013'
|
||||
check 'residence_terms_of_service'
|
||||
@@ -40,7 +40,7 @@ feature 'Residence' do
|
||||
click_link 'Verify my account'
|
||||
|
||||
fill_in 'residence_document_number', with: "12345678Z"
|
||||
select 'Spanish ID', from: 'residence_document_type'
|
||||
select 'DNI', from: 'residence_document_type'
|
||||
select '1997', from: 'residence_date_of_birth_1i'
|
||||
select 'January', from: 'residence_date_of_birth_2i'
|
||||
select '1', from: 'residence_date_of_birth_3i'
|
||||
@@ -49,7 +49,7 @@ feature 'Residence' do
|
||||
|
||||
click_button 'Verify residence'
|
||||
|
||||
expect(page).to have_content 'To verify your account you need to be in the census of the Madrid town.'
|
||||
expect(page).to have_content 'In order to be verified, you must be registered in the municipality of Madrid'
|
||||
end
|
||||
|
||||
scenario 'Error on Madrid census' do
|
||||
@@ -60,7 +60,7 @@ feature 'Residence' do
|
||||
click_link 'Verify my account'
|
||||
|
||||
fill_in 'residence_document_number', with: "12345678Z"
|
||||
select 'Spanish ID', from: 'residence_document_type'
|
||||
select 'DNI', from: 'residence_document_type'
|
||||
select '1997', from: 'residence_date_of_birth_1i'
|
||||
select 'January', from: 'residence_date_of_birth_2i'
|
||||
select '1', from: 'residence_date_of_birth_3i'
|
||||
@@ -69,7 +69,7 @@ feature 'Residence' do
|
||||
|
||||
click_button 'Verify residence'
|
||||
|
||||
expect(page).to have_content 'The census of the city of Madrid could not verify your information'
|
||||
expect(page).to have_content 'The Madrid Census was unable to verify your information'
|
||||
end
|
||||
|
||||
scenario '5 tries allowed' do
|
||||
@@ -81,7 +81,7 @@ feature 'Residence' do
|
||||
|
||||
5.times do
|
||||
fill_in 'residence_document_number', with: "12345678Z"
|
||||
select 'Spanish ID', from: 'residence_document_type'
|
||||
select 'DNI', from: 'residence_document_type'
|
||||
select '1997', from: 'residence_date_of_birth_1i'
|
||||
select 'January', from: 'residence_date_of_birth_2i'
|
||||
select '1', from: 'residence_date_of_birth_3i'
|
||||
@@ -89,15 +89,15 @@ feature 'Residence' do
|
||||
check 'residence_terms_of_service'
|
||||
|
||||
click_button 'Verify residence'
|
||||
expect(page).to have_content 'The census of the city of Madrid could not verify your information'
|
||||
expect(page).to have_content 'The Madrid Census was unable to verify your information'
|
||||
end
|
||||
|
||||
click_button 'Verify residence'
|
||||
expect(page).to have_content "You have reached the maximum number of verification tries. Please try again later."
|
||||
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
|
||||
expect(current_path).to eq(account_path)
|
||||
|
||||
visit new_residence_path
|
||||
expect(page).to have_content "You have reached the maximum number of verification tries. Please try again later."
|
||||
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
|
||||
expect(current_path).to eq(account_path)
|
||||
end
|
||||
end
|
||||
@@ -11,13 +11,13 @@ feature 'SMS Verification' do
|
||||
fill_in 'sms_phone', with: "611111111"
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Phone confirmation'
|
||||
expect(page).to have_content 'Security code confirmation'
|
||||
|
||||
user = user.reload
|
||||
fill_in 'sms_confirmation_code', with: user.sms_confirmation_code
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Correct code'
|
||||
expect(page).to have_content 'Code correct'
|
||||
end
|
||||
|
||||
scenario 'Errors on phone number' do
|
||||
@@ -40,7 +40,7 @@ feature 'SMS Verification' do
|
||||
fill_in 'sms_phone', with: "611111111"
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Phone confirmation'
|
||||
expect(page).to have_content 'Security code confirmation'
|
||||
|
||||
click_button 'Send'
|
||||
|
||||
@@ -53,7 +53,7 @@ feature 'SMS Verification' do
|
||||
|
||||
visit new_sms_path
|
||||
|
||||
expect(page).to have_content 'You have not yet confirmed your residence'
|
||||
expect(page).to have_content 'You have not yet confirmed your residency'
|
||||
expect(current_path).to eq(new_residence_path)
|
||||
end
|
||||
|
||||
@@ -66,14 +66,14 @@ feature 'SMS Verification' do
|
||||
5.times do
|
||||
fill_in 'sms_phone', with: "611111111"
|
||||
click_button 'Send'
|
||||
click_link 'Request a new code'
|
||||
click_link 'Click here to send it again'
|
||||
end
|
||||
|
||||
expect(page).to have_content "You have reached the maximum number of verification tries. Please try again later."
|
||||
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
|
||||
expect(current_path).to eq(account_path)
|
||||
|
||||
visit new_sms_path
|
||||
expect(page).to have_content "You have reached the maximum number of verification tries. Please try again later."
|
||||
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
|
||||
expect(current_path).to eq(account_path)
|
||||
end
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ feature 'Verification path' do
|
||||
visit verification_path
|
||||
|
||||
expect(current_path).to eq account_path
|
||||
expect(page).to have_content 'You are a verified user!'
|
||||
expect(page).to have_content 'Your account is already verified'
|
||||
end
|
||||
|
||||
scenario "User requested a letter" do
|
||||
@@ -95,7 +95,7 @@ feature 'Verification path' do
|
||||
visit step_path
|
||||
|
||||
expect(current_path).to eq account_path
|
||||
expect(page).to have_content 'You are a verified user!'
|
||||
expect(page).to have_content 'Your account is already verified'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -86,7 +86,7 @@ feature 'Verified users' do
|
||||
click_button "Send code"
|
||||
end
|
||||
|
||||
expect(page).to have_content 'We have send you a confirmation email to your email account: rock@example.com'
|
||||
expect(page).to have_content 'We have sent a confirmation email to your account: rock@example.com'
|
||||
expect(current_path).to eq(account_path)
|
||||
end
|
||||
|
||||
@@ -121,7 +121,7 @@ feature 'Verified users' do
|
||||
login_as(user)
|
||||
visit verified_user_path
|
||||
|
||||
click_link "Use another phone"
|
||||
click_link "Use other phone"
|
||||
|
||||
expect(current_path).to eq(new_sms_path)
|
||||
end
|
||||
|
||||
@@ -177,8 +177,6 @@ feature 'Votes' do
|
||||
expect(current_path).to eq(debates_path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
feature 'Proposals' do
|
||||
@@ -194,15 +192,15 @@ feature 'Votes' do
|
||||
|
||||
within("#proposals") do
|
||||
within("#proposal_#{proposal1.id}_votes") do
|
||||
expect(page).to have_content "You already supported this proposal, share it!"
|
||||
expect(page).to have_content "You have already supported this proposal. Share it!"
|
||||
end
|
||||
|
||||
within("#proposal_#{proposal2.id}_votes") do
|
||||
expect(page).to_not have_content "You already supported this proposal, share it!"
|
||||
expect(page).to_not have_content "You have already supported this proposal. Share it!"
|
||||
end
|
||||
|
||||
within("#proposal_#{proposal3.id}_votes") do
|
||||
expect(page).to_not have_content "You already supported this proposal, share it!"
|
||||
expect(page).to_not have_content "You have already supported this proposal. Share it!"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -246,7 +244,7 @@ feature 'Votes' do
|
||||
find('.in-favor a').click
|
||||
|
||||
expect(page).to have_content "1 support"
|
||||
expect(page).to have_content "You already supported this proposal, share it!"
|
||||
expect(page).to have_content "You have already supported this proposal. Share it!"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -258,7 +256,7 @@ feature 'Votes' do
|
||||
find('.in-favor a').click
|
||||
|
||||
expect(page).to have_content "1 support"
|
||||
expect(page).to have_content "You already supported this proposal, share it!"
|
||||
expect(page).to have_content "You have already supported this proposal. Share it!"
|
||||
end
|
||||
expect(current_path).to eq(proposals_path)
|
||||
end
|
||||
@@ -284,12 +282,6 @@ feature 'Votes' do
|
||||
find("div.votes").hover
|
||||
expect_message_you_need_to_sign_in
|
||||
end
|
||||
|
||||
visit debate_path(debate)
|
||||
within("#debate_#{debate.id}") do
|
||||
find("div.votes").hover
|
||||
expect_message_you_need_to_sign_in
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Not logged user trying to vote proposals', :js do
|
||||
|
||||
@@ -21,9 +21,9 @@ feature "Welcome screen" do
|
||||
fill_in 'user_email', with: user.email
|
||||
fill_in 'user_password', with: user.password
|
||||
|
||||
click_button 'Log in'
|
||||
click_button 'Enter'
|
||||
|
||||
expect(page).to have_content("You are now a verified user")
|
||||
expect(page).to have_content("You are a verified user")
|
||||
|
||||
expect(current_path).to eq(account_path)
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ describe UserHelper do
|
||||
|
||||
describe '#humanize_document_type' do
|
||||
it "should return a humanized document type" do
|
||||
expect(humanize_document_type("1")).to eq "Spanish ID"
|
||||
expect(humanize_document_type("1")).to eq "DNI"
|
||||
expect(humanize_document_type("2")).to eq "Passport"
|
||||
expect(humanize_document_type("3")).to eq "Residence card"
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ describe Verification::Residence do
|
||||
it "should validate user has allowed age" do
|
||||
residence = Verification::Residence.new({"date_of_birth(3i)"=>"1", "date_of_birth(2i)"=>"1", "date_of_birth(1i)"=>"#{5.year.ago.year}"})
|
||||
expect(residence).to_not be_valid
|
||||
expect(residence.errors[:date_of_birth]).to include("You need yo be at least 16 years old")
|
||||
expect(residence.errors[:date_of_birth]).to include("You must be at least 16 years old")
|
||||
end
|
||||
|
||||
describe "postal code" do
|
||||
@@ -48,7 +48,7 @@ describe Verification::Residence do
|
||||
residence.postal_code = "13280"
|
||||
residence.valid?
|
||||
expect(residence.errors[:postal_code].size).to eq(1)
|
||||
expect(residence.errors[:postal_code]).to include("To verify your account you need to be in the census of the Madrid town.")
|
||||
expect(residence.errors[:postal_code]).to include("In order to be verified, you must be registered in the municipality of Madrid.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ module CommonActions
|
||||
|
||||
def sign_up(email='manuela@madrid.es', password='judgementday')
|
||||
visit '/'
|
||||
click_link 'Sign up'
|
||||
|
||||
click_link 'Register'
|
||||
|
||||
fill_in 'user_username', with: "Manuela Carmena #{rand(99999)}"
|
||||
fill_in 'user_email', with: email
|
||||
@@ -11,17 +12,17 @@ module CommonActions
|
||||
fill_in 'user_captcha', with: correct_captcha_text
|
||||
check 'user_terms_of_service'
|
||||
|
||||
click_button 'Sign up'
|
||||
click_button 'Register'
|
||||
end
|
||||
|
||||
def login_through_form_as(user)
|
||||
visit root_path
|
||||
click_link 'Log in'
|
||||
click_link 'Sign in'
|
||||
|
||||
fill_in 'user_email', with: user.email
|
||||
fill_in 'user_password', with: user.password
|
||||
|
||||
click_button 'Log in'
|
||||
click_button 'Enter'
|
||||
end
|
||||
|
||||
def login_as_manager
|
||||
@@ -47,11 +48,11 @@ module CommonActions
|
||||
create(:user, email: 'manuela@madrid.es')
|
||||
|
||||
visit '/'
|
||||
click_link 'Log in'
|
||||
click_link 'Forgot your password?'
|
||||
click_link 'Sign in'
|
||||
click_link 'Forgotten your password?'
|
||||
|
||||
fill_in 'user_email', with: 'manuela@madrid.es'
|
||||
click_button 'Send me reset password'
|
||||
click_button 'Send instructions'
|
||||
end
|
||||
|
||||
def comment_on(commentable, user = nil)
|
||||
@@ -107,7 +108,7 @@ module CommonActions
|
||||
end
|
||||
|
||||
def error_message
|
||||
/\d errors? prohibited this (.*) from being saved:/
|
||||
/\d errors? prevented this (.*) from being saved:/
|
||||
end
|
||||
|
||||
def expect_to_be_signed_in
|
||||
@@ -123,7 +124,7 @@ module CommonActions
|
||||
end
|
||||
|
||||
def verify_residence
|
||||
select 'Spanish ID', from: 'residence_document_type'
|
||||
select 'DNI', from: 'residence_document_type'
|
||||
fill_in 'residence_document_number', with: "12345678Z"
|
||||
select_date '31-December-1980', from: 'residence_date_of_birth'
|
||||
fill_in 'residence_postal_code', with: '28013'
|
||||
@@ -137,27 +138,27 @@ module CommonActions
|
||||
fill_in 'sms_phone', with: "611111111"
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Phone confirmation'
|
||||
expect(page).to have_content 'Enter the confirmation code sent to you by text message'
|
||||
|
||||
user = User.last.reload
|
||||
fill_in 'sms_confirmation_code', with: user.sms_confirmation_code
|
||||
click_button 'Send'
|
||||
|
||||
expect(page).to have_content 'Correct code'
|
||||
expect(page).to have_content 'Code correct'
|
||||
end
|
||||
|
||||
def expect_message_you_need_to_sign_in
|
||||
expect(page).to have_content 'You need to sign in or sign up before continuing'
|
||||
expect(page).to have_content 'You must Sign in or Sign up to continue'
|
||||
expect(page).to have_selector('.in-favor a', visible: false)
|
||||
end
|
||||
|
||||
def expect_message_to_many_anonymous_votes
|
||||
expect(page).to have_content 'Too many anonymous votes, verify your account to vote.'
|
||||
expect(page).to have_content 'Too many anonymous votes to admit vote'
|
||||
expect(page).to have_selector('.in-favor a', visible: false)
|
||||
end
|
||||
|
||||
def expect_message_only_verified_can_vote_proposals
|
||||
expect(page).to have_content 'Proposals can only be voted by verified users, verify your account.'
|
||||
expect(page).to have_content 'Only verified users can vote on proposals'
|
||||
expect(page).to have_selector('.in-favor a', visible: false)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user