Skip to content

Commit

Permalink
Merge pull request #805 from alphagov/test-components-against-fixtures
Browse files Browse the repository at this point in the history
Add component smoke testing, using fixtures
  • Loading branch information
gpeng authored Jun 22, 2016
2 parents 2991e46 + 6f5dc5c commit 2a13734
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/govuk_component/component_smoke_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'test_helper'

class ComponentsTest < ActionView::TestCase
test "each component fixture can be rendered without errors being raised" do
doc_files = Rails.root.join('app', 'views', 'govuk_component', 'docs', '*.yml')
components = Dir[doc_files].sort.map do |file|
{ id: File.basename(file, '.yml') }.merge(YAML::load_file(file)).deep_symbolize_keys
end

components.each do |component|
component[:fixtures].each do |_, fixture|
render file: "govuk_component/#{component[:id]}.raw", locals: fixture
end
end
end
end

0 comments on commit 2a13734

Please sign in to comment.