Skip to content

Commit

Permalink
More spec files to go with the new footer
Browse files Browse the repository at this point in the history
  • Loading branch information
HHassig committed Jun 26, 2024
1 parent 3f84ae1 commit cd573ac
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
35 changes: 35 additions & 0 deletions spec/lib/overrides_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

require "rails_helper"

# We make sure that the checksum of the file overridden is the same
# as the expected. If this test fails, it means that the overridden
# file should be updated to match any change/bug fix introduced in the core
checksums = [
{
package: "decidim-core",
files: {
# views
"/app/views/layouts/decidim/footer/_mini.html.erb" => "cf7e273390b5a94b7df7167e37038ec4"
}
}
]

describe "Overridden files", type: :view do
checksums.each do |item|
spec = Gem::Specification.find_by_name(item[:package])
item[:files].each do |file, signature|
next unless spec

it "#{spec.gem_dir}#{file} matches checksum" do
expect(md5("#{spec.gem_dir}#{file}")).to eq(signature)
end
end
end

private

def md5(file)
Digest::MD5.hexdigest(File.read(file))
end
end
10 changes: 10 additions & 0 deletions spec/shared/visiting_organization_homepage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

shared_context "when visiting organization homepage" do
let(:organization) { create(:organization) }

before do
switch_to_host(organization.host)
visit decidim.root_path
end
end
11 changes: 11 additions & 0 deletions spec/system/eu_footer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

require "rails_helper"

describe "Has EU footer", perform_enqueued: true do
include_context "when visiting organization homepage"

it "renders the eu flag in the footer" do
expect(page).to have_xpath("//img[@alt='European Union flag: Funded by the European Union']")
end
end
11 changes: 11 additions & 0 deletions spec/system/platoniq_footer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

require "rails_helper"

describe "Has EU footer", perform_enqueued: true do
include_context "when visiting organization homepage"

it "renders the eu flag in the footer" do
expect(page).to have_xpath("//img[@alt='European Union flag: Funded by the European Union']")
end
end

0 comments on commit cd573ac

Please sign in to comment.