Enable RSpec/LetSetup cop & fix issues
Read more about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
This commit is contained in:
@@ -117,4 +117,7 @@ RSpec/LeadingSubject:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
RSpec/LetBeforeExamples:
|
RSpec/LetBeforeExamples:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
RSpec/LetSetup:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@@ -11,7 +11,9 @@ feature 'Results' do
|
|||||||
let!(:investment3) { create(:budget_investment, :incompatible, heading: heading, price: 500, ballot_lines_count: 700) }
|
let!(:investment3) { create(:budget_investment, :incompatible, heading: heading, price: 500, ballot_lines_count: 700) }
|
||||||
let!(:investment4) { create(:budget_investment, :selected, heading: heading, price: 600, ballot_lines_count: 600) }
|
let!(:investment4) { create(:budget_investment, :selected, heading: heading, price: 600, ballot_lines_count: 600) }
|
||||||
|
|
||||||
let!(:results) { Budget::Result.new(budget, heading).calculate_winners }
|
background do
|
||||||
|
Budget::Result.new(budget, heading).calculate_winners
|
||||||
|
end
|
||||||
|
|
||||||
scenario "Diplays winner investments" do
|
scenario "Diplays winner investments" do
|
||||||
create(:budget_heading, group: group)
|
create(:budget_heading, group: group)
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ feature 'Emails' do
|
|||||||
login_as(author)
|
login_as(author)
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select 'Health: More hospitals', from: 'budget_investment_heading_id'
|
select "#{group.name}: #{heading.name}", from: 'budget_investment_heading_id'
|
||||||
fill_in 'budget_investment_title', with: 'Build a hospital'
|
fill_in 'budget_investment_title', with: 'Build a hospital'
|
||||||
fill_in 'budget_investment_description', with: 'We have lots of people that require medical attention'
|
fill_in 'budget_investment_description', with: 'We have lots of people that require medical attention'
|
||||||
fill_in 'budget_investment_external_url', with: 'http://http://hospitalsforallthepeople.com/'
|
fill_in 'budget_investment_external_url', with: 'http://http://hospitalsforallthepeople.com/'
|
||||||
|
|||||||
@@ -5,8 +5,11 @@ feature "Voter" do
|
|||||||
context "Origin" do
|
context "Origin" do
|
||||||
|
|
||||||
let(:poll) { create(:poll, :current) }
|
let(:poll) { create(:poll, :current) }
|
||||||
|
let(:question) { create(:poll_question, poll: poll) }
|
||||||
let(:booth) { create(:poll_booth) }
|
let(:booth) { create(:poll_booth) }
|
||||||
let(:officer) { create(:poll_officer) }
|
let(:officer) { create(:poll_officer) }
|
||||||
|
let!(:answer_yes) { create(:poll_question_answer, question: question, title: 'Yes') }
|
||||||
|
let!(:answer_no) { create(:poll_question_answer, question: question, title: 'No') }
|
||||||
|
|
||||||
background do
|
background do
|
||||||
create(:geozone, :in_census)
|
create(:geozone, :in_census)
|
||||||
@@ -16,20 +19,14 @@ feature "Voter" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Voting via web - Standard", :js do
|
scenario "Voting via web - Standard", :js do
|
||||||
poll = create(:poll)
|
|
||||||
|
|
||||||
question = create(:poll_question, poll: poll)
|
|
||||||
answer1 = create(:poll_question_answer, question: question, title: 'Yes')
|
|
||||||
answer2 = create(:poll_question_answer, question: question, title: 'No')
|
|
||||||
|
|
||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
|
|
||||||
login_as user
|
login_as user
|
||||||
visit poll_path(poll)
|
visit poll_path(poll)
|
||||||
|
|
||||||
within("#poll_question_#{question.id}_answers") do
|
within("#poll_question_#{question.id}_answers") do
|
||||||
click_link 'Yes'
|
click_link answer_yes.title
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link(answer_yes.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
find(:css, ".js-token-message").should be_visible
|
find(:css, ".js-token-message").should be_visible
|
||||||
@@ -42,20 +39,14 @@ feature "Voter" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Voting via web as unverified user", :js do
|
scenario "Voting via web as unverified user", :js do
|
||||||
poll = create(:poll)
|
|
||||||
|
|
||||||
question = create(:poll_question, poll: poll)
|
|
||||||
answer1 = create(:poll_question_answer, question: question, title: 'Yes')
|
|
||||||
answer2 = create(:poll_question_answer, question: question, title: 'No')
|
|
||||||
|
|
||||||
user = create(:user, :incomplete_verification)
|
user = create(:user, :incomplete_verification)
|
||||||
|
|
||||||
login_as user
|
login_as user
|
||||||
visit poll_path(poll)
|
visit poll_path(poll)
|
||||||
|
|
||||||
within("#poll_question_#{question.id}_answers") do
|
within("#poll_question_#{question.id}_answers") do
|
||||||
expect(page).to_not have_link('Yes', href: "/questions/#{question.id}/answer?answer=Yes&token=")
|
expect(page).to_not have_link(answer_yes.title, href: "/questions/#{question.id}/answer?answer=#{answer_yes.title}&token=")
|
||||||
expect(page).to_not have_link('No', href: "/questions/#{question.id}/answer?answer=No&token=")
|
expect(page).to_not have_link(answer_no.title, href: "/questions/#{question.id}/answer?answer=#{answer_no.title}&token=")
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content("You must verify your account in order to answer")
|
expect(page).to have_content("You must verify your account in order to answer")
|
||||||
@@ -85,17 +76,14 @@ feature "Voter" do
|
|||||||
|
|
||||||
context "Trying to vote the same poll in booth and web" do
|
context "Trying to vote the same poll in booth and web" do
|
||||||
|
|
||||||
let(:poll) { create(:poll) }
|
|
||||||
|
|
||||||
let(:question) { create(:poll_question, poll: poll) }
|
|
||||||
let!(:answer1) { create(:poll_question_answer, question: question, title: 'Yes') }
|
|
||||||
let!(:answer2) { create(:poll_question_answer, question: question, title: 'No') }
|
|
||||||
|
|
||||||
let!(:user) { create(:user, :in_census) }
|
let!(:user) { create(:user, :in_census) }
|
||||||
|
|
||||||
|
background do
|
||||||
|
end
|
||||||
|
|
||||||
scenario "Trying to vote in web and then in booth", :js do
|
scenario "Trying to vote in web and then in booth", :js do
|
||||||
login_as user
|
login_as user
|
||||||
vote_for_poll_via_web(poll, question, 'Yes')
|
vote_for_poll_via_web(poll, question, answer_yes.title)
|
||||||
expect(Poll::Voter.count).to eq(1)
|
expect(Poll::Voter.count).to eq(1)
|
||||||
|
|
||||||
click_link "Sign out"
|
click_link "Sign out"
|
||||||
@@ -121,14 +109,14 @@ feature "Voter" do
|
|||||||
login_as user
|
login_as user
|
||||||
visit poll_path(poll)
|
visit poll_path(poll)
|
||||||
|
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link(answer_yes.title)
|
||||||
expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
|
expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
|
||||||
expect(Poll::Voter.count).to eq(1)
|
expect(Poll::Voter.count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Trying to vote in web again", :js do
|
scenario "Trying to vote in web again", :js do
|
||||||
login_as user
|
login_as user
|
||||||
vote_for_poll_via_web(poll, question, 'Yes')
|
vote_for_poll_via_web(poll, question, answer_yes.title)
|
||||||
expect(Poll::Voter.count).to eq(1)
|
expect(Poll::Voter.count).to eq(1)
|
||||||
|
|
||||||
visit poll_path(poll)
|
visit poll_path(poll)
|
||||||
@@ -137,7 +125,7 @@ feature "Voter" do
|
|||||||
|
|
||||||
expect(page).to have_content "You have already participated in this poll. If you vote again it will be overwritten."
|
expect(page).to have_content "You have already participated in this poll. If you vote again it will be overwritten."
|
||||||
within("#poll_question_#{question.id}_answers") do
|
within("#poll_question_#{question.id}_answers") do
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link(answer_yes.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
click_link "Sign out"
|
click_link "Sign out"
|
||||||
@@ -146,8 +134,8 @@ feature "Voter" do
|
|||||||
visit poll_path(poll)
|
visit poll_path(poll)
|
||||||
|
|
||||||
within("#poll_question_#{question.id}_answers") do
|
within("#poll_question_#{question.id}_answers") do
|
||||||
expect(page).to have_link('Yes')
|
expect(page).to have_link(answer_yes.title)
|
||||||
expect(page).to have_link('No')
|
expect(page).to have_link(answer_no.title)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -155,10 +143,6 @@ feature "Voter" do
|
|||||||
scenario "Voting in poll and then verifiying account", :js do
|
scenario "Voting in poll and then verifiying account", :js do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
|
|
||||||
question = create(:poll_question, poll: poll)
|
|
||||||
answer1 = create(:poll_question_answer, question: question, title: 'Yes')
|
|
||||||
answer2 = create(:poll_question_answer, question: question, title: 'No')
|
|
||||||
|
|
||||||
login_through_form_as_officer(officer.user)
|
login_through_form_as_officer(officer.user)
|
||||||
vote_for_poll_via_booth
|
vote_for_poll_via_booth
|
||||||
|
|
||||||
@@ -174,7 +158,7 @@ feature "Voter" do
|
|||||||
|
|
||||||
visit poll_path(poll)
|
visit poll_path(poll)
|
||||||
|
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link(answer_yes.title)
|
||||||
expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
|
expect(page).to have_content "You have already participated in a physical booth. You can not participate again."
|
||||||
expect(Poll::Voter.count).to eq(1)
|
expect(Poll::Voter.count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,19 +6,21 @@ feature 'Tags' do
|
|||||||
let(:budget) { create(:budget, name: "Big Budget") }
|
let(:budget) { create(:budget, name: "Big Budget") }
|
||||||
let(:group) { create(:budget_group, name: "Health", budget: budget) }
|
let(:group) { create(:budget_group, name: "Health", budget: budget) }
|
||||||
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
|
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
|
||||||
|
let!(:tag_medio_ambiente) { create(:tag, :category, name: 'Medio Ambiente') }
|
||||||
|
let!(:tag_economia) { create(:tag, :category, name: 'Economía') }
|
||||||
|
|
||||||
scenario 'Index' do
|
scenario 'Index' do
|
||||||
earth = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente')
|
earth = create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name)
|
||||||
money = create(:budget_investment, heading: heading, tag_list: 'Economía')
|
money = create(:budget_investment, heading: heading, tag_list: tag_economia.name)
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within "#budget_investment_#{earth.id}" do
|
within "#budget_investment_#{earth.id}" do
|
||||||
expect(page).to have_content "Medio Ambiente"
|
expect(page).to have_content(tag_medio_ambiente.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
within "#budget_investment_#{money.id}" do
|
within "#budget_investment_#{money.id}" do
|
||||||
expect(page).to have_content "Economía"
|
expect(page).to have_content(tag_economia.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -49,12 +51,12 @@ feature 'Tags' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Show' do
|
scenario 'Show' do
|
||||||
investment = create(:budget_investment, heading: heading, tag_list: 'Hacienda, Economía')
|
investment = create(:budget_investment, heading: heading, tag_list: "#{tag_medio_ambiente.name}, #{tag_economia.name}")
|
||||||
|
|
||||||
visit budget_investment_path(budget, investment)
|
visit budget_investment_path(budget, investment)
|
||||||
|
|
||||||
expect(page).to have_content "Economía"
|
expect(page).to have_content(tag_medio_ambiente.name)
|
||||||
expect(page).to have_content "Hacienda"
|
expect(page).to have_content(tag_economia.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Create with custom tags' do
|
scenario 'Create with custom tags' do
|
||||||
@@ -62,41 +64,38 @@ feature 'Tags' do
|
|||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select 'Health: More hospitals', from: 'budget_investment_heading_id'
|
select "#{group.name}: #{heading.name}", from: 'budget_investment_heading_id'
|
||||||
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
||||||
fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds'
|
fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds'
|
||||||
check 'budget_investment_terms_of_service'
|
check 'budget_investment_terms_of_service'
|
||||||
|
|
||||||
fill_in 'budget_investment_tag_list', with: 'Economía, Hacienda'
|
fill_in 'budget_investment_tag_list', with: "#{tag_medio_ambiente.name}, #{tag_economia.name}"
|
||||||
|
|
||||||
click_button 'Create Investment'
|
click_button 'Create Investment'
|
||||||
|
|
||||||
expect(page).to have_content 'Investment created successfully.'
|
expect(page).to have_content 'Investment created successfully.'
|
||||||
expect(page).to have_content 'Economía'
|
expect(page).to have_content tag_economia.name
|
||||||
expect(page).to have_content 'Hacienda'
|
expect(page).to have_content tag_medio_ambiente.name
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Category with category tags', :js do
|
scenario 'Category with category tags', :js do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
education = create(:tag, :category, name: 'Education')
|
|
||||||
health = create(:tag, :category, name: 'Health')
|
|
||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select 'Health: More hospitals', from: 'budget_investment_heading_id'
|
select "#{group.name}: #{heading.name}", from: 'budget_investment_heading_id'
|
||||||
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
||||||
fill_in_ckeditor 'budget_investment_description', with: 'If I had a gym near my place I could go do Zumba'
|
fill_in_ckeditor 'budget_investment_description', with: 'If I had a gym near my place I could go do Zumba'
|
||||||
check 'budget_investment_terms_of_service'
|
check 'budget_investment_terms_of_service'
|
||||||
|
|
||||||
find('.js-add-tag-link', text: 'Education').click
|
find('.js-add-tag-link', text: tag_economia.name).click
|
||||||
click_button 'Create Investment'
|
click_button 'Create Investment'
|
||||||
|
|
||||||
expect(page).to have_content 'Investment created successfully.'
|
expect(page).to have_content 'Investment created successfully.'
|
||||||
|
|
||||||
within "#tags_budget_investment_#{Budget::Investment.last.id}" do
|
within "#tags_budget_investment_#{Budget::Investment.last.id}" do
|
||||||
expect(page).to have_content 'Education'
|
expect(page).to have_content tag_economia.name
|
||||||
expect(page).to_not have_content 'Health'
|
expect(page).to_not have_content tag_medio_ambiente.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -105,7 +104,7 @@ feature 'Tags' do
|
|||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select 'Health: More hospitals', from: 'budget_investment_heading_id'
|
select "#{group.name}: #{heading.name}", from: 'budget_investment_heading_id'
|
||||||
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
||||||
fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds'
|
fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds'
|
||||||
check 'budget_investment_terms_of_service'
|
check 'budget_investment_terms_of_service'
|
||||||
@@ -123,7 +122,7 @@ feature 'Tags' do
|
|||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget_id: budget.id)
|
||||||
|
|
||||||
select 'Health: More hospitals', from: 'budget_investment_heading_id'
|
select "#{group.name}: #{heading.name}", from: 'budget_investment_heading_id'
|
||||||
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
fill_in 'budget_investment_title', with: 'Build a skyscraper'
|
||||||
fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds'
|
fill_in 'budget_investment_description', with: 'I want to live in a high tower over the clouds'
|
||||||
check 'budget_investment_terms_of_service'
|
check 'budget_investment_terms_of_service'
|
||||||
@@ -143,13 +142,13 @@ feature 'Tags' do
|
|||||||
|
|
||||||
scenario "From index" do
|
scenario "From index" do
|
||||||
|
|
||||||
investment1 = create(:budget_investment, heading: heading, tag_list: 'Education')
|
investment1 = create(:budget_investment, heading: heading, tag_list: tag_economia.name)
|
||||||
investment2 = create(:budget_investment, heading: heading, tag_list: 'Health')
|
investment2 = create(:budget_investment, heading: heading, tag_list: 'Health')
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within "#budget_investment_#{investment1.id}" do
|
within "#budget_investment_#{investment1.id}" do
|
||||||
click_link "Education"
|
click_link tag_economia.name
|
||||||
end
|
end
|
||||||
|
|
||||||
within("#budget-investments") do
|
within("#budget-investments") do
|
||||||
@@ -159,12 +158,12 @@ feature 'Tags' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "From show" do
|
scenario "From show" do
|
||||||
investment1 = create(:budget_investment, heading: heading, tag_list: 'Education')
|
investment1 = create(:budget_investment, heading: heading, tag_list: tag_economia.name)
|
||||||
investment2 = create(:budget_investment, heading: heading, tag_list: 'Health')
|
investment2 = create(:budget_investment, heading: heading, tag_list: 'Health')
|
||||||
|
|
||||||
visit budget_investment_path(budget, investment1)
|
visit budget_investment_path(budget, investment1)
|
||||||
|
|
||||||
click_link "Education"
|
click_link tag_economia.name
|
||||||
|
|
||||||
within("#budget-investments") do
|
within("#budget-investments") do
|
||||||
expect(page).to have_css('.budget-investment', count: 1)
|
expect(page).to have_css('.budget-investment', count: 1)
|
||||||
@@ -176,9 +175,11 @@ feature 'Tags' do
|
|||||||
|
|
||||||
context 'Tag cloud' do
|
context 'Tag cloud' do
|
||||||
|
|
||||||
let!(:investment1) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
|
let(:new_tag) { "New Tag" }
|
||||||
let!(:investment2) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
|
let(:newer_tag) { "Newer" }
|
||||||
let!(:investment3) { create(:budget_investment, heading: heading, tag_list: 'Economía') }
|
let!(:investment1) { create(:budget_investment, heading: heading, tag_list: new_tag) }
|
||||||
|
let!(:investment2) { create(:budget_investment, heading: heading, tag_list: new_tag) }
|
||||||
|
let!(:investment3) { create(:budget_investment, heading: heading, tag_list: newer_tag) }
|
||||||
|
|
||||||
scenario 'Display user tags' do
|
scenario 'Display user tags' do
|
||||||
Budget::PHASES.each do |phase|
|
Budget::PHASES.each do |phase|
|
||||||
@@ -187,8 +188,8 @@ feature 'Tags' do
|
|||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within "#tag-cloud" do
|
within "#tag-cloud" do
|
||||||
expect(page).to have_content "Medio Ambiente"
|
expect(page).to have_content(new_tag)
|
||||||
expect(page).to have_content "Economía"
|
expect(page).to have_content(newer_tag)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -207,7 +208,7 @@ feature 'Tags' do
|
|||||||
click_link group.name
|
click_link group.name
|
||||||
|
|
||||||
within "#tag-cloud" do
|
within "#tag-cloud" do
|
||||||
click_link "Medio Ambiente"
|
click_link new_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_css ".budget-investment", count: 2
|
expect(page).to have_css ".budget-investment", count: 2
|
||||||
@@ -221,12 +222,9 @@ feature 'Tags' do
|
|||||||
|
|
||||||
context "Categories" do
|
context "Categories" do
|
||||||
|
|
||||||
let!(:tag1) { create(:tag, :category, name: 'Medio Ambiente') }
|
let!(:investment1) { create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name) }
|
||||||
let!(:tag2) { create(:tag, :category, name: 'Economía') }
|
let!(:investment2) { create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name) }
|
||||||
|
let!(:investment3) { create(:budget_investment, heading: heading, tag_list: tag_economia.name) }
|
||||||
let!(:investment1) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
|
|
||||||
let!(:investment2) { create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') }
|
|
||||||
let!(:investment3) { create(:budget_investment, heading: heading, tag_list: 'Economía') }
|
|
||||||
|
|
||||||
scenario 'Display category tags' do
|
scenario 'Display category tags' do
|
||||||
Budget::PHASES.each do |phase|
|
Budget::PHASES.each do |phase|
|
||||||
@@ -235,8 +233,8 @@ feature 'Tags' do
|
|||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within "#categories" do
|
within "#categories" do
|
||||||
expect(page).to have_content "Medio Ambiente"
|
expect(page).to have_content(tag_medio_ambiente.name)
|
||||||
expect(page).to have_content "Economía"
|
expect(page).to have_content(tag_economia.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -255,7 +253,7 @@ feature 'Tags' do
|
|||||||
click_link group.name
|
click_link group.name
|
||||||
|
|
||||||
within "#categories" do
|
within "#categories" do
|
||||||
click_link "Medio Ambiente"
|
click_link tag_medio_ambiente.name
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_css ".budget-investment", count: 2
|
expect(page).to have_css ".budget-investment", count: 2
|
||||||
@@ -295,4 +293,4 @@ feature 'Tags' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
shared_examples "documentable" do |documentable_factory_name, documentable_path, documentable_path_arguments|
|
shared_examples "documentable" do |documentable_factory_name, documentable_path, documentable_path_arguments|
|
||||||
include ActionView::Helpers
|
include ActionView::Helpers
|
||||||
|
|
||||||
let!(:administrator) { create(:user) }
|
let(:administrator) { create(:user) }
|
||||||
let!(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let!(:arguments) { {} }
|
let(:arguments) { {} }
|
||||||
let!(:documentable) { create(documentable_factory_name, author: user) }
|
let(:documentable) { create(documentable_factory_name, author: user) }
|
||||||
|
let!(:document) { create(:document, documentable: documentable, user: documentable.author) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
create(:administrator, user: administrator)
|
create(:administrator, user: administrator)
|
||||||
@@ -16,8 +17,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
|
|||||||
|
|
||||||
context "Show documents tab" do
|
context "Show documents tab" do
|
||||||
|
|
||||||
let!(:document) { create(:document, documentable: documentable, user: documentable.author)}
|
|
||||||
|
|
||||||
scenario "Download action should be able to anyone" do
|
scenario "Download action should be able to anyone" do
|
||||||
visit send(documentable_path, arguments)
|
visit send(documentable_path, arguments)
|
||||||
|
|
||||||
@@ -76,8 +75,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
|
|||||||
|
|
||||||
context "Destroy" do
|
context "Destroy" do
|
||||||
|
|
||||||
let!(:document) { create(:document, documentable: documentable, user: documentable.author) }
|
|
||||||
|
|
||||||
scenario "Should show success notice after successfull document upload" do
|
scenario "Should show success notice after successfull document upload" do
|
||||||
login_as documentable.author
|
login_as documentable.author
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ shared_examples "imageable" do |imageable_factory_name, imageable_path, imageabl
|
|||||||
|
|
||||||
context "Destroy" do
|
context "Destroy" do
|
||||||
|
|
||||||
let!(:image) { create(:image, imageable: imageable, user: imageable.author) }
|
background do
|
||||||
|
create(:image, imageable: imageable, user: imageable.author)
|
||||||
|
end
|
||||||
|
|
||||||
scenario "Should show success notice after successfull deletion by an admin" do
|
scenario "Should show success notice after successfull deletion by an admin" do
|
||||||
login_as administrator
|
login_as administrator
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
|
|||||||
|
|
||||||
include ActionView::Helpers
|
include ActionView::Helpers
|
||||||
|
|
||||||
let!(:user) { create(:user, :level_two) }
|
let!(:user) { create(:user, :level_two) }
|
||||||
|
let!(:arguments) { {} }
|
||||||
|
let!(:mappable) { create(mappable_factory_name.to_s.to_sym) }
|
||||||
|
let!(:map_location) { create(:map_location, "#{mappable_factory_name}_map_location".to_sym, "#{mappable_association_name}": mappable) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Setting['feature.map'] = true
|
Setting['feature.map'] = true
|
||||||
@@ -10,10 +13,6 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
|
|||||||
|
|
||||||
describe "At #{mappable_new_path}" do
|
describe "At #{mappable_new_path}" do
|
||||||
|
|
||||||
let!(:arguments) { {} }
|
|
||||||
let!(:mappable) { create(mappable_factory_name.to_s.to_sym) }
|
|
||||||
let!(:map_location) { create(:map_location, "#{mappable_factory_name}_map_location".to_sym, "#{mappable_association_name}": mappable) }
|
|
||||||
|
|
||||||
before { set_arguments(arguments, mappable, mappable_path_arguments) }
|
before { set_arguments(arguments, mappable, mappable_path_arguments) }
|
||||||
|
|
||||||
scenario "Should not show marker by default on create #{mappable_factory_name}", :js do
|
scenario "Should not show marker by default on create #{mappable_factory_name}", :js do
|
||||||
@@ -113,9 +112,6 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
|
|||||||
|
|
||||||
describe "At #{mappable_edit_path}" do
|
describe "At #{mappable_edit_path}" do
|
||||||
|
|
||||||
let!(:mappable) { create(mappable_factory_name.to_s.to_sym) }
|
|
||||||
let!(:map_location) { create(:map_location, "#{mappable_factory_name}_map_location".to_sym, "#{mappable_association_name}": mappable) }
|
|
||||||
|
|
||||||
before { skip } if mappable_edit_path.blank?
|
before { skip } if mappable_edit_path.blank?
|
||||||
|
|
||||||
scenario "Should edit map on #{mappable_factory_name} and contain default values", :js do
|
scenario "Should edit map on #{mappable_factory_name} and contain default values", :js do
|
||||||
@@ -200,10 +196,6 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
|
|||||||
|
|
||||||
describe "At #{mappable_show_path}" do
|
describe "At #{mappable_show_path}" do
|
||||||
|
|
||||||
let!(:arguments) { {} }
|
|
||||||
let!(:mappable) { create(mappable_factory_name.to_s.to_sym) }
|
|
||||||
let!(:map_location) { create(:map_location, "#{mappable_factory_name}_map_location".to_sym, "#{mappable_association_name}": mappable) }
|
|
||||||
|
|
||||||
before { set_arguments(arguments, mappable, mappable_path_arguments) }
|
before { set_arguments(arguments, mappable, mappable_path_arguments) }
|
||||||
|
|
||||||
scenario "Should display map on #{mappable_factory_name} show page", :js do
|
scenario "Should display map on #{mappable_factory_name} show page", :js do
|
||||||
|
|||||||
Reference in New Issue
Block a user