Skip to content

Commit

Permalink
Remove support for Static-based components
Browse files Browse the repository at this point in the history
  • Loading branch information
tijmenb committed Jun 18, 2018
1 parent 773ce62 commit 2c18604
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
2 changes: 0 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class ApplicationController < ActionController::Base
include Slimmer::GovukComponents

# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery except: :service_sign_in_options
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_travel_advice_summary.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
direction: page_text_direction %>
<% end %>

<%= render 'govuk_component/metadata', content_item.metadata %>
<%= render 'govuk_publishing_components/components/metadata', content_item.metadata %>
<% if content_item.map %>
<figure class="map">
<img src="<%= content_item.map["url"] %>" alt="<%= content_item.map["alt_text"] %>" class="map-image">
Expand Down
35 changes: 0 additions & 35 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'capybara/rails'
require 'slimmer/test_helpers/govuk_components'
require 'mocha/mini_test'
require 'faker'

Expand All @@ -23,11 +22,6 @@ def teardown

class ActiveSupport::TestCase
include GovukContentSchemaExamples
include Slimmer::TestHelpers::GovukComponents

def setup
stub_shared_component_locales
end
end

# Note: This is so that slimmer is skipped, preventing network requests for
Expand All @@ -43,37 +37,8 @@ def set_skip_slimmer_header
class ActionDispatch::IntegrationTest
# Make the Capybara DSL available in all integration tests
include Capybara::DSL
include Slimmer::TestHelpers::GovukComponents

def setup
stub_shared_component_locales
end

def assert_no_component(name)
assert page.has_no_css?(shared_component_selector(name)), "Found a component named #{name}"
end

def assert_component_locals(name, locals)
within shared_component_selector(name) do
assert_equal locals, JSON.parse(page.text).deep_symbolize_keys
end
end

def assert_has_component_metadata_pair(label, value)
end

def assert_has_component_document_footer_pair(label, value)
assert_component_parameter("document_footer", label, value)
end

def assert_component_parameter(component, label, value)
within shared_component_selector(component) do
# Flatten top level / "other" args, for consistent hash access
component_args = JSON.parse(page.text).tap do |args|
args.merge!(args.delete("other")) if args.key?("other")
end
assert_equal value, component_args.fetch(label)
end
assert page.has_content?(label)
assert page.has_content?(value)
end
Expand Down

0 comments on commit 2c18604

Please sign in to comment.