diff --git a/lib/i18n_helpers.rb b/lib/i18n_helpers.rb index 256b7759..9dbe97e6 100644 --- a/lib/i18n_helpers.rb +++ b/lib/i18n_helpers.rb @@ -9,7 +9,7 @@ module I18nHelpers # @param loc [Symbol] The current locale # @param current_path [String] The current page. We give it as a parameter to it's easier to test. def current_path_for_locale(loc = I18n.locale, current_path = current_page.url) - url_regex = %r{\A/(?:(#{I18n.available_locales.join('|')})/)?} + url_regex = %r{\A/(?:(#{I18n.available_locales.join("|")})/)?} if current_path.gsub(url_regex, "").blank? home_for_locale(loc) else diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 636c2903..2a26fc6b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,13 +8,13 @@ require "middleman-blog" -middleman_app = ::Middleman::Application.new do +middleman_app = Middleman::Application.new do set :root, File.expand_path(File.join(File.dirname(__FILE__), "..")) set :environment, :test set :show_exceptions, false end -Capybara.app = ::Middleman::Rack.new(middleman_app).to_app +Capybara.app = Middleman::Rack.new(middleman_app).to_app RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate diff --git a/spec/system/index_spec.rb b/spec/system/index_spec.rb index ae1c7e56..ec4e165a 100644 --- a/spec/system/index_spec.rb +++ b/spec/system/index_spec.rb @@ -8,14 +8,14 @@ end it "has the correct title header" do - expect(page).to have_selector "h1" + expect(page).to have_css "h1" within "h1" do expect(page).to have_content(/Decidim is a digital platform for citizen participation/i) end end it "has a navigation with the languages" do - expect(page).to have_selector "nav details" + expect(page).to have_css "nav details" within "nav details" do expect(page).to have_text "Castellano" diff --git a/spec/system/language_selector_spec.rb b/spec/system/language_selector_spec.rb index 04ec108f..73d8eec7 100644 --- a/spec/system/language_selector_spec.rb +++ b/spec/system/language_selector_spec.rb @@ -8,14 +8,14 @@ end it "has the correct title header" do - expect(page).to have_selector "h1" + expect(page).to have_css "h1" within "h1" do expect(page).to have_content "Decidim és una plataforma digital de participació ciutadana" end end it "changes the locale" do - expect(page).to have_selector "nav details" + expect(page).to have_css "nav details" within "nav details" do expect(page).to have_text "Castellano" diff --git a/spec/system/pages_spec.rb b/spec/system/pages_spec.rb index 02af665c..c4b48d80 100644 --- a/spec/system/pages_spec.rb +++ b/spec/system/pages_spec.rb @@ -8,14 +8,14 @@ end it "has the correct title header" do - expect(page).to have_selector "h1" + expect(page).to have_css "h1" within "h1" do expect(page).to have_content(/Trademark policy/i) end end it "has the correct links" do - expect(page).to have_selector "main" + expect(page).to have_css "main" within "main" do expect(page).to have_link "Ruby on Rails", href: "https://rubyonrails.org/trademarks"