Merge pull request #3702 from consul/remove_after_blocks
Simplify after blocks in specs
This commit is contained in:
@@ -7,10 +7,6 @@ describe RemotelyTranslatable do
|
||||
Setting["feature.remote_translations"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_translations"] = nil
|
||||
end
|
||||
|
||||
describe "#detect_remote_translations" do
|
||||
|
||||
describe "Should detect remote_translations" do
|
||||
|
||||
@@ -31,10 +31,6 @@ describe DebatesController do
|
||||
end
|
||||
|
||||
describe "Vote with too many anonymous votes" do
|
||||
after do
|
||||
Setting["max_ratio_anon_votes_on_debates"] = 50
|
||||
end
|
||||
|
||||
it "allows vote if user is allowed" do
|
||||
Setting["max_ratio_anon_votes_on_debates"] = 100
|
||||
debate = create(:debate)
|
||||
|
||||
@@ -13,22 +13,12 @@ describe InstallationController, type: :request do
|
||||
let(:seeds_feature_settings) { Setting.where("key LIKE 'feature.%'") }
|
||||
|
||||
before do
|
||||
@current_feature_settings = seeds_feature_settings.pluck(:key, :value).to_h
|
||||
seeds_feature_settings.destroy_all
|
||||
test_feature_settings.each do |feature_name, feature_value|
|
||||
Setting["feature.#{feature_name}"] = feature_value
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
test_feature_settings.each_key do |feature_name|
|
||||
Setting.find_by(key: "feature.#{feature_name}").destroy
|
||||
end
|
||||
@current_feature_settings.each do |feature_name, feature_value|
|
||||
Setting[feature_name] = feature_value
|
||||
end
|
||||
end
|
||||
|
||||
specify "with query string inside query params" do
|
||||
get "/consul.json"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ require "rails_helper"
|
||||
|
||||
describe RemoteTranslationsController do
|
||||
|
||||
describe "POST create" do
|
||||
describe "POST create", :delay_jobs do
|
||||
let(:debate) { create(:debate) }
|
||||
|
||||
before do
|
||||
@@ -10,11 +10,6 @@ describe RemoteTranslationsController do
|
||||
remote_translatable_type: debate.class.to_s,
|
||||
locale: :es }].to_json
|
||||
request.env["HTTP_REFERER"] = "any_path"
|
||||
Delayed::Worker.delay_jobs = true
|
||||
end
|
||||
|
||||
after do
|
||||
Delayed::Worker.delay_jobs = false
|
||||
end
|
||||
|
||||
it "create correctly remote translation" do
|
||||
|
||||
@@ -176,19 +176,6 @@ describe "Account" do
|
||||
end
|
||||
|
||||
context "Recommendations" do
|
||||
|
||||
before do
|
||||
Setting["feature.user.recommendations"] = true
|
||||
Setting["feature.user.recommendations_on_debates"] = true
|
||||
Setting["feature.user.recommendations_on_proposals"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.user.recommendations"] = nil
|
||||
Setting["feature.user.recommendations_on_debates"] = nil
|
||||
Setting["feature.user.recommendations_on_proposals"] = nil
|
||||
end
|
||||
|
||||
scenario "are enabled by default" do
|
||||
visit account_path
|
||||
|
||||
|
||||
@@ -20,10 +20,6 @@ describe "Admin budget groups" do
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
expect do
|
||||
visit admin_budget_groups_path(budget)
|
||||
|
||||
@@ -21,10 +21,6 @@ describe "Admin budget headings" do
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
expect do
|
||||
visit admin_budget_group_headings_path(budget, group)
|
||||
|
||||
@@ -28,10 +28,6 @@ describe "Admin budget investments" do
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
expect { visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
@@ -8,8 +8,6 @@ describe "Admin debates" do
|
||||
login_as(admin.user)
|
||||
|
||||
expect { visit admin_hidden_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting["process.debates"] = true
|
||||
end
|
||||
|
||||
before do
|
||||
|
||||
@@ -287,7 +287,6 @@ describe "Admin collaborative legislation" do
|
||||
let!(:process) { create(:legislation_process) }
|
||||
|
||||
before { Setting["feature.translation_interface"] = true }
|
||||
after { Setting["feature.translation_interface"] = nil }
|
||||
|
||||
scenario "Cant manage translations on homepage form" do
|
||||
visit edit_admin_legislation_process_homepage_path(process)
|
||||
|
||||
@@ -138,10 +138,6 @@ describe "Admin settings" do
|
||||
Setting["feature.remote_census"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
end
|
||||
|
||||
scenario "Should not be able when remote census feature deactivated" do
|
||||
Setting["feature.remote_census"] = nil
|
||||
admin = create(:administrator).user
|
||||
@@ -178,10 +174,6 @@ describe "Admin settings" do
|
||||
Setting["feature.remote_census"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
end
|
||||
|
||||
scenario "On #tab-remote-census-configuration", :js do
|
||||
remote_census_setting = create(:setting, key: "remote_census.general.whatever")
|
||||
admin = create(:administrator).user
|
||||
@@ -221,10 +213,6 @@ describe "Admin settings" do
|
||||
Setting["feature.map"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.map"] = nil
|
||||
end
|
||||
|
||||
scenario "On #tab-map-configuration", :js do
|
||||
map_setting = Setting.create(key: "map.whatever")
|
||||
admin = create(:administrator).user
|
||||
|
||||
@@ -89,12 +89,6 @@ describe "Signature sheets" do
|
||||
Setting["remote_census.response.valid"] = access_user_data
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
Setting["remote_census.request.date_of_birth"] = nil
|
||||
Setting["remote_census.request.postal_code"] = nil
|
||||
end
|
||||
|
||||
scenario "Proposal" do
|
||||
proposal = create(:proposal)
|
||||
visit new_admin_signature_sheet_path
|
||||
|
||||
@@ -13,14 +13,6 @@ describe "Budget Investments" do
|
||||
:budget_investment,
|
||||
"budget_investment_path"
|
||||
|
||||
before do
|
||||
Setting["feature.allow_images"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.allow_images"] = nil
|
||||
end
|
||||
|
||||
context "Concerns" do
|
||||
it_behaves_like "notifiable in-app", Budget::Investment
|
||||
it_behaves_like "relationable", Budget::Investment
|
||||
@@ -1107,8 +1099,6 @@ describe "Budget Investments" do
|
||||
investment = create(:budget_investment, heading: heading)
|
||||
visit budget_investment_path(budget, id: investment.id)
|
||||
expect(page).to have_content "Access the community"
|
||||
|
||||
Setting["feature.community"] = false
|
||||
end
|
||||
|
||||
scenario "Can not access the community" do
|
||||
|
||||
@@ -326,8 +326,6 @@ describe "Commenting topics from proposals" do
|
||||
end
|
||||
|
||||
scenario "Flagging turbolinks sanity check", :js do
|
||||
Setting["feature.community"] = true
|
||||
|
||||
community = proposal.community
|
||||
topic = create(:topic, community: community, title: "Should we change the world?")
|
||||
comment = create(:comment, commentable: topic)
|
||||
@@ -340,8 +338,6 @@ describe "Commenting topics from proposals" do
|
||||
page.find("#flag-expand-comment-#{comment.id}").click
|
||||
expect(page).to have_selector("#flag-comment-#{comment.id}")
|
||||
end
|
||||
|
||||
Setting["feature.community"] = nil
|
||||
end
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
@@ -879,8 +875,6 @@ describe "Commenting topics from budget investments" do
|
||||
end
|
||||
|
||||
scenario "Flagging turbolinks sanity check", :js do
|
||||
Setting["feature.community"] = true
|
||||
|
||||
community = investment.community
|
||||
topic = create(:topic, community: community, title: "Should we change the world?")
|
||||
comment = create(:comment, commentable: topic)
|
||||
@@ -893,8 +887,6 @@ describe "Commenting topics from budget investments" do
|
||||
page.find("#flag-expand-comment-#{comment.id}").click
|
||||
expect(page).to have_selector("#flag-comment-#{comment.id}")
|
||||
end
|
||||
|
||||
Setting["feature.community"] = nil
|
||||
end
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
|
||||
@@ -2,14 +2,6 @@ require "rails_helper"
|
||||
|
||||
describe "Communities" do
|
||||
|
||||
before do
|
||||
Setting["feature.community"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.community"] = nil
|
||||
end
|
||||
|
||||
context "Show" do
|
||||
|
||||
scenario "Should display default content" do
|
||||
|
||||
@@ -455,16 +455,6 @@ describe "Debates" do
|
||||
let!(:medium_debate) { create(:debate, title: "Medium", cached_votes_total: 5, tag_list: "Sport") }
|
||||
let!(:worst_debate) { create(:debate, title: "Worst", cached_votes_total: 1, tag_list: "Sport") }
|
||||
|
||||
before do
|
||||
Setting["feature.user.recommendations"] = true
|
||||
Setting["feature.user.recommendations_on_debates"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.user.recommendations"] = nil
|
||||
Setting["feature.user.recommendations_on_debates"] = nil
|
||||
end
|
||||
|
||||
scenario "can't be sorted if there's no logged user" do
|
||||
visit debates_path
|
||||
expect(page).not_to have_selector("a", text: "recommendations")
|
||||
@@ -980,9 +970,6 @@ describe "Debates" do
|
||||
end
|
||||
|
||||
scenario "Reorder by recommendations results maintaing search" do
|
||||
Setting["feature.user.recommendations"] = true
|
||||
Setting["feature.user.recommendations_on_debates"] = true
|
||||
|
||||
user = create(:user, recommended_debates: true)
|
||||
login_as(user)
|
||||
|
||||
@@ -1005,9 +992,6 @@ describe "Debates" do
|
||||
expect(page).not_to have_content "Do not display with same tag"
|
||||
expect(page).not_to have_content "Do not display"
|
||||
end
|
||||
|
||||
Setting["feature.user.recommendations"] = nil
|
||||
Setting["feature.user.recommendations_on_debates"] = nil
|
||||
end
|
||||
|
||||
scenario "After a search do not show featured debates" do
|
||||
|
||||
@@ -350,11 +350,6 @@ describe "Emails" do
|
||||
end
|
||||
|
||||
context "Budgets" do
|
||||
|
||||
before do
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
let(:author) { create(:user, :level_two) }
|
||||
let(:budget) { create(:budget) }
|
||||
let(:group) { create(:budget_group, name: "Health", budget: budget) }
|
||||
|
||||
@@ -25,17 +25,12 @@ describe "Home" do
|
||||
describe "Recommended" do
|
||||
|
||||
before do
|
||||
Setting["feature.user.recommendations"] = true
|
||||
user = create(:user)
|
||||
proposal = create(:proposal, tag_list: "Sport")
|
||||
create(:follow, followable: proposal, user: user)
|
||||
login_as(user)
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.user.recommendations"] = nil
|
||||
end
|
||||
|
||||
scenario "Display recommended section when feature flag recommended is active" do
|
||||
debate = create(:debate, tag_list: "Sport")
|
||||
visit root_path
|
||||
|
||||
@@ -73,12 +73,6 @@ describe "DocumentVerifications" do
|
||||
Setting["remote_census.response.valid"] = access_user_data
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
Setting["remote_census.request.date_of_birth"] = nil
|
||||
Setting["remote_census.request.postal_code"] = nil
|
||||
end
|
||||
|
||||
scenario "Verifying a user which does not exist and is not in the census shows an error" do
|
||||
|
||||
expect_any_instance_of(Verification::Management::Document).to receive(:in_census?).
|
||||
|
||||
@@ -98,10 +98,6 @@ describe "Moderation" do
|
||||
Setting["org_name"] = "OrgName"
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["org_name"] = "CONSUL"
|
||||
end
|
||||
|
||||
scenario "Contains correct elements" do
|
||||
create(:moderator, user: user)
|
||||
login_as(user)
|
||||
|
||||
@@ -181,7 +181,7 @@ describe "Notifications" do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#send_pending" do
|
||||
describe "#send_pending", :delay_jobs do
|
||||
let!(:user1) { create(:user) }
|
||||
let!(:user2) { create(:user) }
|
||||
let!(:user3) { create(:user) }
|
||||
@@ -192,11 +192,6 @@ describe "Notifications" do
|
||||
create(:notification, notifiable: proposal_notification, user: user2)
|
||||
create(:notification, notifiable: proposal_notification, user: user3)
|
||||
reset_mailer
|
||||
Delayed::Worker.delay_jobs = true
|
||||
end
|
||||
|
||||
after do
|
||||
Delayed::Worker.delay_jobs = false
|
||||
end
|
||||
|
||||
it "sends pending proposal notifications" do
|
||||
|
||||
@@ -127,12 +127,6 @@ describe "Residence", :with_frozen_time do
|
||||
visit officing_root_path
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
Setting["remote_census.request.date_of_birth"] = nil
|
||||
Setting["remote_census.request.postal_code"] = nil
|
||||
end
|
||||
|
||||
describe "Display form fields according to the remote census configuration" do
|
||||
|
||||
scenario "by default (without custom census) not display date_of_birth and postal_code" do
|
||||
|
||||
@@ -381,10 +381,6 @@ describe "Proposal Notifications" do
|
||||
Setting[:proposal_notification_minimum_interval_in_days] = 0
|
||||
end
|
||||
|
||||
after do
|
||||
Setting[:proposal_notification_minimum_interval_in_days] = 3
|
||||
end
|
||||
|
||||
scenario "for the same proposal", :js do
|
||||
author = create(:user)
|
||||
user = create(:user)
|
||||
|
||||
@@ -38,15 +38,10 @@ describe "Proposals" do
|
||||
context "Index" do
|
||||
|
||||
before do
|
||||
Setting["feature.allow_images"] = true
|
||||
Setting["feature.featured_proposals"] = true
|
||||
Setting["featured_proposals_number"] = 3
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.allow_images"] = nil
|
||||
end
|
||||
|
||||
scenario "Lists featured and regular proposals" do
|
||||
featured_proposals = create_featured_proposals
|
||||
proposals = [create(:proposal), create(:proposal), create(:proposal)]
|
||||
@@ -632,7 +627,6 @@ describe "Proposals" do
|
||||
|
||||
context "Special interface translation behaviour" do
|
||||
before { Setting["feature.translation_interface"] = true }
|
||||
after { Setting["feature.translation_interface"] = nil }
|
||||
|
||||
scenario "Cant manage translations" do
|
||||
proposal = create(:proposal)
|
||||
@@ -771,16 +765,6 @@ describe "Proposals" do
|
||||
let!(:medium_proposal) { create(:proposal, title: "Medium", cached_votes_up: 5, tag_list: "Sport") }
|
||||
let!(:worst_proposal) { create(:proposal, title: "Worst", cached_votes_up: 1, tag_list: "Sport") }
|
||||
|
||||
before do
|
||||
Setting["feature.user.recommendations"] = true
|
||||
Setting["feature.user.recommendations_on_proposals"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.user.recommendations"] = nil
|
||||
Setting["feature.user.recommendations_on_proposals"] = nil
|
||||
end
|
||||
|
||||
scenario "can't be sorted if there's no logged user" do
|
||||
visit proposals_path
|
||||
expect(page).not_to have_selector("a", text: "recommendations")
|
||||
@@ -1519,9 +1503,6 @@ describe "Proposals" do
|
||||
end
|
||||
|
||||
scenario "Reorder by recommendations results maintaing search" do
|
||||
Setting["feature.user.recommendations"] = true
|
||||
Setting["feature.user.recommendations_for_proposals"] = true
|
||||
|
||||
user = create(:user, recommended_proposals: true)
|
||||
login_as(user)
|
||||
|
||||
@@ -1544,9 +1525,6 @@ describe "Proposals" do
|
||||
expect(page).not_to have_content "Do not display with same tag"
|
||||
expect(page).not_to have_content "Do not display"
|
||||
end
|
||||
|
||||
Setting["feature.user.recommendations"] = nil
|
||||
Setting["feature.user.recommendations_for_proposals"] = nil
|
||||
end
|
||||
|
||||
scenario "After a search do not show featured proposals" do
|
||||
@@ -1959,10 +1937,6 @@ describe "Successful proposals" do
|
||||
Setting["feature.user.skip_verification"] = "true"
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.user.skip_verification"] = nil
|
||||
end
|
||||
|
||||
scenario "Create" do
|
||||
author = create(:user)
|
||||
login_as(author)
|
||||
|
||||
@@ -10,12 +10,6 @@ describe "Remote Translations" do
|
||||
and_return(available_locales_response)
|
||||
end
|
||||
|
||||
after do
|
||||
allow(I18n).to receive(:available_locales).and_call_original
|
||||
allow(I18n.fallbacks).to receive(:[]).and_call_original
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
end
|
||||
|
||||
describe "Display remote translation button when locale is included in microsoft translate client" do
|
||||
|
||||
context "with locale that has :en fallback" do
|
||||
|
||||
@@ -23,16 +23,6 @@ describe "Social media meta tags" do
|
||||
Setting["org_name"] = org_name
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["meta_keywords"] = nil
|
||||
Setting["meta_title"] = nil
|
||||
Setting["meta_description"] = nil
|
||||
Setting["twitter_handle"] = nil
|
||||
Setting["url"] = "http://example.com"
|
||||
Setting["facebook_handle"] = nil
|
||||
Setting["org_name"] = "CONSUL"
|
||||
end
|
||||
|
||||
scenario "Social media meta tags partial render settings content" do
|
||||
|
||||
visit root_path
|
||||
|
||||
@@ -117,8 +117,6 @@ describe "Welcome screen" do
|
||||
4.times do |i|
|
||||
expect(page).to have_css "li:nth-child(#{i + 1})"
|
||||
end
|
||||
|
||||
Setting["feature.user.skip_verification"] = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -17,10 +17,6 @@ describe SignatureSheetsHelper do
|
||||
Setting["feature.remote_census"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
end
|
||||
|
||||
it "returns text help when date_of_birth and postal_code are not required" do
|
||||
text_help_1 = "To verify a user, your application needs: Document number"
|
||||
text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons."
|
||||
|
||||
@@ -12,10 +12,6 @@ describe "Dashboards Rake" do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["dashboard.emails"] = nil
|
||||
end
|
||||
|
||||
let :run_rake_task do
|
||||
Rake::Task["dashboards:send_notifications"].reenable
|
||||
Rake.application.invoke_task "dashboards:send_notifications"
|
||||
|
||||
@@ -13,10 +13,6 @@ describe Dashboard::Mailer do
|
||||
Setting["dashboard.emails"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["dashboard.emails"] = nil
|
||||
end
|
||||
|
||||
describe "#forward" do
|
||||
let!(:proposal) { create(:proposal) }
|
||||
|
||||
|
||||
@@ -274,10 +274,6 @@ describe Budget do
|
||||
end
|
||||
|
||||
describe "#formatted_amount" do
|
||||
after do
|
||||
I18n.locale = :en
|
||||
end
|
||||
|
||||
it "correctly formats Euros with Spanish" do
|
||||
budget.update(currency_symbol: "€")
|
||||
I18n.locale = :es
|
||||
|
||||
@@ -21,12 +21,6 @@ shared_examples_for "globalizable" do |factory_name|
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
allow(I18n).to receive(:available_locales).and_call_original
|
||||
allow(I18n.fallbacks).to receive(:[]).and_call_original
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
end
|
||||
|
||||
context "With a defined fallback" do
|
||||
before do
|
||||
allow(I18n.fallbacks).to receive(:[]).and_return([:fr, :es])
|
||||
|
||||
@@ -77,7 +77,6 @@ describe Debate do
|
||||
let(:debate) { create(:debate) }
|
||||
|
||||
before { Setting["max_votes_for_debate_edit"] = 3 }
|
||||
after { Setting["max_votes_for_debate_edit"] = 1000 }
|
||||
|
||||
it "is true if debate has no votes yet" do
|
||||
expect(debate.total_votes).to eq(0)
|
||||
@@ -101,7 +100,6 @@ describe Debate do
|
||||
let(:debate) { create(:debate) }
|
||||
|
||||
before { Setting["max_votes_for_debate_edit"] = 1 }
|
||||
after { Setting["max_votes_for_debate_edit"] = 1000 }
|
||||
|
||||
it "is true if user is the author and debate is editable" do
|
||||
expect(debate.editable_by?(debate.author)).to be true
|
||||
|
||||
@@ -64,7 +64,7 @@ describe Newsletter do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#deliver" do
|
||||
describe "#deliver", :delay_jobs do
|
||||
let!(:proposals) { Array.new(3) { create(:proposal) } }
|
||||
|
||||
let!(:recipients) { proposals.map(&:author).map(&:email) }
|
||||
@@ -73,11 +73,6 @@ describe Newsletter do
|
||||
before do
|
||||
create(:debate)
|
||||
reset_mailer
|
||||
Delayed::Worker.delay_jobs = true
|
||||
end
|
||||
|
||||
after do
|
||||
Delayed::Worker.delay_jobs = false
|
||||
end
|
||||
|
||||
it "sends an email with the newsletter to every recipient" do
|
||||
|
||||
@@ -54,12 +54,6 @@ describe Officing::Residence do
|
||||
Setting["remote_census.response.valid"] = access_user_data
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
Setting["remote_census.request.date_of_birth"] = nil
|
||||
Setting["remote_census.request.postal_code"] = nil
|
||||
end
|
||||
|
||||
it "is valid" do
|
||||
expect(custom_residence).to be_valid
|
||||
end
|
||||
|
||||
@@ -178,7 +178,6 @@ describe Proposal do
|
||||
let(:proposal) { create(:proposal) }
|
||||
|
||||
before { Setting["max_votes_for_proposal_edit"] = 5 }
|
||||
after { Setting["max_votes_for_proposal_edit"] = 1000 }
|
||||
|
||||
it "is true if proposal has no votes yet" do
|
||||
expect(proposal.total_votes).to eq(0)
|
||||
@@ -1083,10 +1082,6 @@ describe Proposal do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["dashboard.emails"] = nil
|
||||
end
|
||||
|
||||
it "send notification after create when there are new actived actions" do
|
||||
create(:dashboard_action, :proposed_action, :active, day_offset: 0, published_proposal: false)
|
||||
create(:dashboard_action, :resource, :active, day_offset: 0, published_proposal: false)
|
||||
@@ -1114,10 +1109,6 @@ describe Proposal do
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["dashboard.emails"] = nil
|
||||
end
|
||||
|
||||
it "send notification after published when there are new actived actions" do
|
||||
create(:dashboard_action, :proposed_action, :active, day_offset: 0, published_proposal: true)
|
||||
create(:dashboard_action, :resource, :active, day_offset: 0, published_proposal: true)
|
||||
|
||||
@@ -28,16 +28,7 @@ describe RemoteTranslation do
|
||||
expect(remote_translation).not_to be_valid
|
||||
end
|
||||
|
||||
describe "#enqueue_remote_translation" do
|
||||
|
||||
before do
|
||||
Delayed::Worker.delay_jobs = true
|
||||
end
|
||||
|
||||
after do
|
||||
Delayed::Worker.delay_jobs = false
|
||||
end
|
||||
|
||||
describe "#enqueue_remote_translation", :delay_jobs do
|
||||
it "after create enqueue Delayed Job" do
|
||||
expect { remote_translation.save }.to change { Delayed::Job.count }.by(1)
|
||||
end
|
||||
|
||||
@@ -82,10 +82,6 @@ describe SignatureSheet do
|
||||
Setting["feature.remote_census"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
end
|
||||
|
||||
it "creates signatures for each group with document_number" do
|
||||
required_fields_to_verify = "123A; 456B"
|
||||
signature_sheet = create(:signature_sheet, required_fields_to_verify: required_fields_to_verify)
|
||||
|
||||
@@ -41,12 +41,6 @@ describe Signature do
|
||||
Setting["remote_census.request.postal_code"] = "some.value"
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
Setting["remote_census.request.date_of_birth"] = nil
|
||||
Setting["remote_census.request.postal_code"] = nil
|
||||
end
|
||||
|
||||
it "is valid" do
|
||||
expect(signature).to be_valid
|
||||
end
|
||||
@@ -255,12 +249,6 @@ describe Signature do
|
||||
Setting["remote_census.response.valid"] = access_user_data
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
Setting["remote_census.request.date_of_birth"] = nil
|
||||
Setting["remote_census.request.postal_code"] = nil
|
||||
end
|
||||
|
||||
it "calls assign_vote_to_user" do
|
||||
signature = create(:signature, document_number: "12345678Z",
|
||||
date_of_birth: "31/12/1980",
|
||||
|
||||
@@ -43,12 +43,6 @@ describe Verification::Management::Document do
|
||||
Setting["remote_census.response.valid"] = access_user_data
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_census"] = nil
|
||||
Setting["remote_census.request.date_of_birth"] = nil
|
||||
Setting["remote_census.request.postal_code"] = nil
|
||||
end
|
||||
|
||||
it "is valid" do
|
||||
expect(verification_document).to be_valid
|
||||
end
|
||||
|
||||
@@ -22,10 +22,6 @@ describe "Retrieves number of supports for the successful proposal" do
|
||||
sign_in(proposal.author)
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["proposals.successful_proposal_id"] = @successful_proposal_id
|
||||
end
|
||||
|
||||
it "returns the number of supports grouped by day" do
|
||||
get proposal_dashboard_successful_supports_path(proposal, format: :json)
|
||||
|
||||
|
||||
@@ -71,10 +71,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
|
||||
Setting["feature.allow_attached_documents"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.allow_attached_documents"] = false
|
||||
end
|
||||
|
||||
scenario "Documents list should be available" do
|
||||
login_as(user)
|
||||
visit send(documentable_path, arguments)
|
||||
@@ -98,10 +94,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
|
||||
Setting["feature.allow_attached_documents"] = false
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.allow_attached_documents"] = true
|
||||
end
|
||||
|
||||
scenario "Documents list should not be available" do
|
||||
login_as(create(:user))
|
||||
visit send(documentable_path, arguments)
|
||||
|
||||
@@ -297,10 +297,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
Setting["feature.allow_attached_documents"] = false
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.allow_attached_documents"] = true
|
||||
end
|
||||
|
||||
scenario "Add new document button should not be available" do
|
||||
login_as user_to_login
|
||||
visit send(path, arguments)
|
||||
|
||||
@@ -9,9 +9,6 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
let!(:imageable) { create(imageable_factory_name) }
|
||||
|
||||
before do
|
||||
|
||||
Setting["feature.allow_images"] = true
|
||||
|
||||
imageable_path_arguments&.each do |argument_name, path_to_value|
|
||||
arguments.merge!("#{argument_name}": imageable.send(path_to_value))
|
||||
end
|
||||
@@ -19,10 +16,6 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
||||
imageable.update(author: user) if imageable.respond_to?(:author)
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.allow_images"] = nil
|
||||
end
|
||||
|
||||
describe "at #{path}" do
|
||||
|
||||
scenario "Should show new image link when imageable has not an associated image defined" do
|
||||
|
||||
@@ -12,10 +12,6 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
|
||||
Setting["feature.remote_translations"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.remote_translations"] = false
|
||||
end
|
||||
|
||||
context "Button to request remote translation" do
|
||||
|
||||
scenario "should not be present when current locale translation exists", :js do
|
||||
@@ -52,10 +48,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
|
||||
expect(page).not_to have_button("Translate page")
|
||||
end
|
||||
|
||||
describe "with delayed job active" do
|
||||
before { Delayed::Worker.delay_jobs = true }
|
||||
after { Delayed::Worker.delay_jobs = false }
|
||||
|
||||
describe "with delayed job active", :delay_jobs do
|
||||
scenario "should not be present when an equal RemoteTranslation is enqueued", :js do
|
||||
create(:remote_translation, remote_translatable: resource, locale: :de)
|
||||
visit path
|
||||
@@ -158,16 +151,7 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
|
||||
|
||||
context "After click remote translations button" do
|
||||
|
||||
describe "with delayed jobs" do
|
||||
|
||||
before do
|
||||
Delayed::Worker.delay_jobs = true
|
||||
end
|
||||
|
||||
after do
|
||||
Delayed::Worker.delay_jobs = false
|
||||
end
|
||||
|
||||
describe "with delayed jobs", :delay_jobs do
|
||||
scenario "the remote translation button should not be present", :js do
|
||||
visit path
|
||||
select("Deutsch", from: "locale-switcher")
|
||||
|
||||
@@ -8,10 +8,6 @@ shared_examples "map validations" do
|
||||
Setting["feature.map"] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.map"] = nil
|
||||
end
|
||||
|
||||
it "is valid with a map location" do
|
||||
mappable.map_location = build(:map_location)
|
||||
mappable.skip_map = nil
|
||||
|
||||
@@ -45,9 +45,7 @@ RSpec.configure do |config|
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
I18n.locale = :en
|
||||
Globalize.locale = I18n.locale
|
||||
unless %i[controller feature request].include? example.metadata[:type]
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
end
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
load Rails.root.join("db", "seeds.rb").to_s
|
||||
Setting["feature.user.skip_verification"] = nil
|
||||
end
|
||||
@@ -95,6 +93,14 @@ RSpec.configure do |config|
|
||||
Bullet.end_request
|
||||
end
|
||||
|
||||
config.before(:each, :delay_jobs) do
|
||||
Delayed::Worker.delay_jobs = true
|
||||
end
|
||||
|
||||
config.after(:each, :delay_jobs) do
|
||||
Delayed::Worker.delay_jobs = false
|
||||
end
|
||||
|
||||
config.before(:each, :with_frozen_time) do
|
||||
travel_to Time.now # TODO: use `freeze_time` after migrating to Rails 5.
|
||||
end
|
||||
|
||||
@@ -187,10 +187,6 @@ shared_examples_for "verifiable" do
|
||||
Setting["feature.user.skip_verification"] = "true"
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.user.skip_verification"] = nil
|
||||
end
|
||||
|
||||
describe "#residence_verified?" do
|
||||
it "is true if skipped" do
|
||||
expect(user.residence_verified?).to eq(true)
|
||||
|
||||
Reference in New Issue
Block a user