slimmer 3.29.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 4.0.0
2
+
3
+ * Remove search-index header as there are no longer tabs on search
4
+
1
5
  # 3.29.0
2
6
 
3
7
  * Send processor exceptions to errbit via Airbrake gem if present
data/lib/slimmer.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #.....................................................
2
- #"""""" Look, Gradiented-Rounded corners.... It's 3.0 """""
2
+ #"""""" Look, Gradiented-Rounded corners.... """""
3
3
  #////////////////////////////////////////////////////////////////
4
4
  ###################################################################
5
5
 
@@ -30,7 +30,6 @@ module Slimmer
30
30
  PAGE_OWNER_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:page_owner]}"
31
31
  REMOVE_META_VIEWPORT = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:remove_meta_viewport]}"
32
32
  RESULT_COUNT_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:result_count]}"
33
- SEARCH_INDEX_HEADER = "#{HEADER_PREFIX}-Search-Index"
34
33
  SEARCH_PATH_HEADER = "#{HEADER_PREFIX}-Search-Path"
35
34
  SKIP_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:skip]}"
36
35
  TEMPLATE_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:template]}"
data/lib/slimmer/skin.rb CHANGED
@@ -129,7 +129,6 @@ module Slimmer
129
129
  Processors::RelatedItemsInserter.new(self, artefact),
130
130
  Processors::LogoClassInserter.new(artefact),
131
131
  Processors::ReportAProblemInserter.new(self, source_request.url, response.headers),
132
- Processors::SearchIndexSetter.new(response),
133
132
  Processors::MetaViewportRemover.new(response),
134
133
  Processors::BetaNoticeInserter.new(self, response.headers),
135
134
  Processors::BetaLabelInserter.new(self, response.headers)
@@ -1,3 +1,3 @@
1
1
  module Slimmer
2
- VERSION = '3.29.0'
2
+ VERSION = '4.0.0'
3
3
  end
data/test/test_helper.rb CHANGED
@@ -8,8 +8,6 @@ require 'mocha'
8
8
  require 'timecop'
9
9
  require 'gds_api/test_helpers/content_api'
10
10
 
11
- ENV['FACTER_govuk_platform'] = 'test'
12
-
13
11
  class MiniTest::Unit::TestCase
14
12
  def as_nokogiri(html_string)
15
13
  Nokogiri::HTML.parse(html_string.strip)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.29.0
4
+ version: 4.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-24 00:00:00.000000000 Z
13
+ date: 2014-05-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -287,7 +287,6 @@ files:
287
287
  - lib/slimmer/processors/beta_label_inserter.rb
288
288
  - lib/slimmer/processors/report_a_problem_inserter.rb
289
289
  - lib/slimmer/processors/title_inserter.rb
290
- - lib/slimmer/processors/search_index_setter.rb
291
290
  - lib/slimmer/processors/body_inserter.rb
292
291
  - lib/slimmer/processors/footer_remover.rb
293
292
  - lib/slimmer/processors/beta_notice_inserter.rb
@@ -313,7 +312,6 @@ files:
313
312
  - test/headers_test.rb
314
313
  - test/test_template_dependency_on_static_test.rb
315
314
  - test/test_helper.rb
316
- - test/processors/search_index_setter_test.rb
317
315
  - test/processors/header_context_inserter_test.rb
318
316
  - test/processors/body_inserter_test.rb
319
317
  - test/processors/navigation_mover_test.rb
@@ -341,7 +339,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
341
339
  version: '0'
342
340
  segments:
343
341
  - 0
344
- hash: -4427512240627220463
342
+ hash: -2385505635737276457
345
343
  required_rubygems_version: !ruby/object:Gem::Requirement
346
344
  none: false
347
345
  requirements:
@@ -350,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
350
348
  version: '0'
351
349
  segments:
352
350
  - 0
353
- hash: -4427512240627220463
351
+ hash: -2385505635737276457
354
352
  requirements: []
355
353
  rubyforge_project: slimmer
356
354
  rubygems_version: 1.8.23
@@ -374,7 +372,6 @@ test_files:
374
372
  - test/headers_test.rb
375
373
  - test/test_template_dependency_on_static_test.rb
376
374
  - test/test_helper.rb
377
- - test/processors/search_index_setter_test.rb
378
375
  - test/processors/header_context_inserter_test.rb
379
376
  - test/processors/body_inserter_test.rb
380
377
  - test/processors/navigation_mover_test.rb
@@ -1,32 +0,0 @@
1
- require 'uri'
2
-
3
- module Slimmer::Processors
4
- include ERB::Util
5
-
6
- class SearchIndexSetter
7
- def initialize(response)
8
- @response = response
9
- end
10
-
11
- def filter(content_document, page_template)
12
- if search_index && (form = page_template.at_css('form#search'))
13
- input_html = Nokogiri::HTML.fragment(tab_input_tag)
14
- form.add_child(input_html)
15
- end
16
- end
17
-
18
- private
19
-
20
- def tab_input_tag
21
- %Q{<input type="hidden" name="tab" value="#{search_index_tab}">}
22
- end
23
-
24
- def search_index_tab
25
- "#{search_index}-results"
26
- end
27
-
28
- def search_index
29
- @response.headers[Slimmer::Headers::SEARCH_INDEX_HEADER]
30
- end
31
- end
32
- end
@@ -1,39 +0,0 @@
1
- require "test_helper"
2
-
3
- module SearchIndexSetterTest
4
-
5
- DOCUMENT_WITH_SEARCH = <<-END
6
- <html>
7
- <head>
8
- </head>
9
- <body class="body_class">
10
- <div id="wrapper">
11
- <form id="search" action="/path/to/search">
12
- </form>
13
- </div>
14
- </body>
15
- </html>
16
- END
17
-
18
- class WithHeaderTest < SlimmerIntegrationTest
19
- headers = {
20
- "X-Slimmer-Search-Index" => "government",
21
- }
22
-
23
- given_response 200, DOCUMENT_WITH_SEARCH, headers
24
-
25
- def test_should_insert_index_field
26
- search_tab_field = Nokogiri::HTML.parse(last_response.body).at_css('input')['value']
27
- assert_equal "government-results", search_tab_field
28
- end
29
- end
30
-
31
- class WithoutHeaderTest < SlimmerIntegrationTest
32
- given_response 200, DOCUMENT_WITH_SEARCH, {}
33
-
34
- def test_should_not_insert_index_field
35
- search_tab_field = Nokogiri::HTML.parse(last_response.body).css('input')
36
- assert_equal 0, search_tab_field.length
37
- end
38
- end
39
- end