adds setting allow_images to specs
This commit is contained in:
@@ -9,6 +9,14 @@ feature 'Budget Investments' do
|
||||
let(:group) { create(:budget_group, name: "Health", budget: budget) }
|
||||
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
|
||||
|
||||
before do
|
||||
Setting['feature.allow_images'] = true
|
||||
end
|
||||
|
||||
after do
|
||||
Setting['feature.allow_images'] = nil
|
||||
end
|
||||
|
||||
scenario 'Index' do
|
||||
investments = [create(:budget_investment, heading: heading),
|
||||
create(:budget_investment, heading: heading),
|
||||
@@ -37,7 +45,7 @@ feature 'Budget Investments' do
|
||||
visit budget_investments_path(budget, heading_id: heading.id)
|
||||
|
||||
within("#budget_investment_#{investment.id}") do
|
||||
expect(page).to have_css("div.no-image")
|
||||
expect(page).to_not have_css("div.with-image")
|
||||
end
|
||||
within("#budget_investment_#{investment_with_image.id}") do
|
||||
expect(page).to have_css("img[alt='#{investment_with_image.image.title}']")
|
||||
|
||||
@@ -4,6 +4,15 @@ require 'rails_helper'
|
||||
feature 'Proposals' do
|
||||
|
||||
context 'Index' do
|
||||
|
||||
before do
|
||||
Setting['feature.allow_images'] = true
|
||||
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)]
|
||||
@@ -55,7 +64,7 @@ feature 'Proposals' do
|
||||
visit proposals_path(proposal)
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
expect(page).to have_css("div.no-image")
|
||||
expect(page).to_not have_css("div.with-image")
|
||||
end
|
||||
within("#proposal_#{proposal_with_image.id}") do
|
||||
expect(page).to have_css("img[alt='#{proposal_with_image.image.title}']")
|
||||
|
||||
@@ -9,6 +9,9 @@ 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
|
||||
@@ -16,6 +19,10 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user