-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More spec files to go with the new footer
- Loading branch information
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |