File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,8 +4,6 @@ def format_date(date)
44 return nil if date . blank?
55
66 Date . iso8601 ( date ) . strftime ( "%-d/%-m/%Y" )
7- rescue ArgumentError , TypeError
8- nil
97end
108
119def process_visualisation_data ( chart_json )
@@ -99,7 +97,9 @@ namespace :markdown do
9997
10098 FileUtils . mkdir_p ( output_path . dirname )
10199
102- puts ( "Rendering #{ path . basename } to => #{ output_path } " )
100+ unless Rails . env . test?
101+ puts ( "Rendering #{ path . basename } to => #{ output_path } " )
102+ end
103103
104104 html = ApplicationController . renderer . render (
105105 partial : "v2/collection/content" ,
Original file line number Diff line number Diff line change 11require "rails_helper"
22
33RSpec . describe "Charts" , type : :system , js : true do
4- before ( :all ) do
5- Rake . application . rake_require ( "tasks/markdown_to_static_html" )
6- Rake ::Task . define_task ( :environment )
7- Rails . configuration . x . markdown_collections_output_location = "app/views/generated/collections"
8- Rails . configuration . x . markdown_collections_location_glob = "app/content/collections/**/*.md"
9- Rails . configuration . x . visualisations_data_location = "app/content/data"
10- Rake ::Task [ "markdown:render" ] . invoke
11- end
12-
13- after ( :all ) do
14- FileUtils . rm_rf ( "app/views/generated" )
15- end
4+ # Setup and teardown for generated views is handled globally in rails_helper.rb
165
176 scenario "I can see a single series line chart on a collection page" do
187 given_i_visit_a_collection_page_with_a_single_series_line_chart
Original file line number Diff line number Diff line change 11require "rails_helper"
22
33RSpec . feature "collections" , type : :feature do
4- before ( :all ) do
5- Rake . application . rake_require ( "tasks/markdown_to_static_html" )
6- Rake ::Task . define_task ( :environment )
7- Rails . configuration . x . markdown_collections_output_location = "app/views/generated/collections"
8- Rails . configuration . x . markdown_collections_location_glob = "app/content/collections/**/*.md"
9- Rails . configuration . x . visualisations_data_location = "app/content/data"
10- Rake ::Task [ "markdown:render" ] . invoke
11- end
12-
13- after ( :all ) do
14- FileUtils . rm_rf ( "app/views/generated" )
15- end
4+ # Setup and teardown for generated views is handled globally in rails_helper.rb
165
176 scenario "I visit a collection page" do
187 given_i_am_on_a_collection_page
Original file line number Diff line number Diff line change 6868 config . include FactoryBot ::Syntax ::Methods
6969end
7070
71+ RSpec . configure do |config |
72+ config . before ( :suite ) do
73+ Rake . application . rake_require ( "tasks/markdown_to_static_html" )
74+ Rake ::Task . define_task ( :environment )
75+ Rails . configuration . x . markdown_collections_output_location = "app/views/generated/collections"
76+ Rails . configuration . x . markdown_collections_location_glob = "app/content/collections/**/*.md"
77+ Rails . configuration . x . visualisations_data_location = "app/content/data"
78+ Rake ::Task [ "markdown:render" ] . reenable
79+ Rake ::Task [ "markdown:render" ] . invoke
80+ end
81+
82+ config . after ( :suite ) do
83+ FileUtils . rm_rf ( "app/views/generated" )
84+ end
85+ end
86+
7187# Setup chrome headless driver
7288GovukTest . configure
7389
You can’t perform that action at this time.
0 commit comments