Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
andreslucena committed Dec 14, 2023
1 parent f33199c commit 16cfd1d
Showing 1 changed file with 91 additions and 34 deletions.
125 changes: 91 additions & 34 deletions spec/features/proposals_answers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,118 @@
require "decidim/proposals/test/factories"

describe "Views the proposals answers overrides", type: :system do
let!(:accepted_proposal) { create :proposal, :accepted, component: }
let!(:evaluating_proposal) { create :proposal, :evaluating, component: }
let!(:finished_proposal) { create :proposal, :accepted, component:, title: { en: "This proposal has finished" } }
let!(:progressing_proposal) { create :proposal, :evaluating, component:, title: { en: "This proposal is in progress" } }

include_context "with a component"
let(:manifest_name) { "proposals" }

before do
visit_component
end

it "views the overrided colors" do
within "main" do
# Capybara understands rgba instead of hexadecimal colors
expect(page.find("span.label.finished")).to match_style("background-color" => "rgba(204, 190, 230, 1)")
expect(page.find("span.label.finished")).to match_style("color" => "rgba(102, 57, 186, 1)")
expect(page.find("span.label.progressing")).to match_style("background-color" => "rgba(196, 236, 208, 1)")
expect(page.find("span.label.progressing")).to match_style("color" => "rgba(22, 89, 46, 1)")
describe "index" do
before do
visit_component
end
end

context "with the english locale" do
it "views the overrided strings" do
it "views the overrided colors" do
within "main" do
expect(page).to have_content("Finished")
expect(page).to have_content("Accepted / In progress")
# Capybara understands rgba instead of hexadecimal colors
expect(page.find("span.label.finished")).to match_style("background-color" => "rgba(246, 245, 252, 1)")
expect(page.find("span.label.finished")).to match_style("color" => "rgba(102, 57, 186, 1)")
expect(page.find("span.label.progressing")).to match_style("background-color" => "rgba(196, 236, 208, 1)")
expect(page.find("span.label.progressing")).to match_style("color" => "rgba(22, 89, 34, 1)")
end
end
end

context "with the catalan locale" do
before do
within_language_menu do
click_link "Català"
context "with the english locale" do
it "views the overrided strings" do
within "main" do
expect(page).to have_content("Finished")
expect(page).to have_content("Accepted / In progress")
end
end
end

it "views the overrided strings" do
within "main" do
expect(page).to have_content("Finalitzada")
expect(page).to have_content("Acceptada / En curs")
context "with another locale" do
before do
within_language_menu do
click_link "Català"
end
end

it "views the overrided strings" do
within "main" do
expect(page).to have_content("Finalitzada")
expect(page).to have_content("Acceptada / En curs")
end
end
end
end

context "with the spanish locale" do
describe "show" do
before do
within_language_menu do
click_link "Castellano"
visit Decidim::EngineRouter.main_proxy(component).proposal_path(proposal)
end

context "with the finished proposal" do
let(:proposal) { finished_proposal }

it "views the overrided colors" do
within "main" do
# Capybara understands rgba instead of hexadecimal colors
expect(page.find("div.flash.finished")).to match_style("background-color" => "rgba(246, 245, 252, 1)")
expect(page.find("div.flash.finished")).to match_style("border-color" => "rgb(102, 57, 186)")
end
end

it "views the overrided strings" do
within "main div.flash.finished" do
expect(page).to have_content("This proposal has been implemented")
end
end

context "with another locale" do
before do
within_language_menu do
click_link "Castellano"
end
end

it "views the overrided strings" do
within "main div.flash.finished" do
expect(page).to have_content("Esta propuesta ha sido implementada")
end
end
end
end

it "views the overrided strings" do
within "main" do
expect(page).to have_content("Finalizada")
expect(page).to have_content("Aceptada / En curso")
context "with the progressing proposal" do
let(:proposal) { progressing_proposal }

it "views the overrided colors" do
within "main" do
# Capybara understands rgba instead of hexadecimal colors
expect(page.find("div.flash.progressing")).to match_style("background-color" => "rgba(196, 236, 208, 1)")
expect(page.find("div.flash.progressing")).to match_style("border-color" => "rgb(22, 89, 34)")
end
end

it "views the overrided strings" do
within "main div.flash.progressing" do
expect(page).to have_content("This proposal has been accepted")
end
end

context "with another locale" do
before do
within_language_menu do
click_link "Català"
end
end

it "views the overrided strings" do
within "main div.flash.progressing" do
expect(page).to have_content("Aquesta proposta ha sigut acceptada")
end
end
end
end
end
Expand Down

0 comments on commit 16cfd1d

Please sign in to comment.