slimmer 9.3.2 → 9.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d5c3207c4bf5ea390a1ea416f0c784c52b7747b
4
- data.tar.gz: 3515b2b3a43ac282609b0dd57d461b40ef1001ef
3
+ metadata.gz: feeccdc994ab71fb94e5e3a77822dbc49bd3062d
4
+ data.tar.gz: 6c43c756c881f13449f9a1273d06da371a67cd2d
5
5
  SHA512:
6
- metadata.gz: 46785c3a9f016774622517c990e6e2f968525e59c5dd387ffb6959e973606d26e960a0a84a1d894b0075175cf687189a683206456492c6626395a081d644c424
7
- data.tar.gz: c866f1183b302ce713287450a00e5a7950e840577531d2f3034bb46c6a35a1b1a48817da79faf7b9b437de6167770b70085b50676e79c5a8b9bd0d7695a9bb72
6
+ metadata.gz: 66fede6589d4bd54a7f1a81b081187c023583b18b5790560b3d9c1f94475bc414373ff4cff1f1287e91bf41e0ee58bfc5c50e06208bfb4caf38c7b46f19d13e1
7
+ data.tar.gz: 8dbb7ef4d9fffa253a1ff2bc0f294de258cdec69f53314b5827845b7200137afcda9f137f0afd19261e3bd661da1d8883174eba7db38a78e745ca917b1d460fc
@@ -1,3 +1,13 @@
1
+ # 9.4.0
2
+
3
+ * Adds an RSpec helper that makes it easy for host applications to
4
+ configure Slimmer correctly under test.
5
+
6
+ Fixes `stub_shared_component_locales` helper to correctly stub HTTP
7
+ requests to fetch locale information when rendering its templates.
8
+
9
+ (PR #159 https://github.com/alphagov/slimmer/pull/159)
10
+
1
11
  # 9.3.2
2
12
 
3
13
  * Bugfix: Over time, the I18n backend would be chained in each request,
data/README.md CHANGED
@@ -149,6 +149,14 @@ within(shared_component_selector('title')) do
149
149
  end
150
150
  ```
151
151
 
152
+ ### RSpec
153
+
154
+ Add the following code to spec/spec_helper:
155
+
156
+ ```rb
157
+ require 'slimmer/rspec'
158
+ ```
159
+
152
160
  ## The name
153
161
 
154
162
  Slimmer was extracted from a much larger project called 'skinner'. 'slimmer' referred to the size
@@ -0,0 +1,11 @@
1
+ require 'rspec/core'
2
+
3
+ require 'slimmer'
4
+ require 'slimmer/test'
5
+ require 'slimmer/test_helpers/shared_templates'
6
+
7
+ RSpec.configure do |config|
8
+ config.include Slimmer::TestHelpers::SharedTemplates
9
+
10
+ config.before { stub_shared_component_locales }
11
+ end
@@ -1,12 +1,12 @@
1
+ require 'webmock'
2
+
1
3
  module Slimmer
2
4
  module TestHelpers
3
5
  module SharedTemplates
4
6
  def stub_shared_component_locales
5
- stub_request(:get, /https:\/\/\S+.gov.uk\/templates\/locales\/.+/).
6
- with(headers: { 'Accept' => '*/*; q=0.5, application/xml', 'Accept-Encoding' => 'gzip, deflate', 'User-Agent' => 'Ruby' }).
7
+ stub_request(:get, /https?:\/\/\S+.gov.uk\/templates\/locales\/.+/).
7
8
  to_return(status: 400, headers: {})
8
- stub_request(:get, /https:\/\/\S+.gov.uk\/templates\/locales\/en/).
9
- with(headers: { 'Accept' => '*/*; q=0.5, application/xml', 'Accept-Encoding' => ' gzip, deflate', 'User-Agent' => 'Ruby' }).
9
+ stub_request(:get, /https?:\/\/\S+.gov.uk\/templates\/locales/).
10
10
  to_return(status: 200, body: '{}', headers: {})
11
11
  end
12
12
 
@@ -1,3 +1,3 @@
1
1
  module Slimmer
2
- VERSION = '9.3.2'
2
+ VERSION = '9.4.0'
3
3
  end
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: 9.3.2
4
+ version: 9.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Griffiths
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-05 00:00:00.000000000 Z
12
+ date: 2016-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -279,6 +279,7 @@ files:
279
279
  - lib/slimmer/processors/tag_mover.rb
280
280
  - lib/slimmer/processors/title_inserter.rb
281
281
  - lib/slimmer/railtie.rb
282
+ - lib/slimmer/rspec.rb
282
283
  - lib/slimmer/shared_templates.rb
283
284
  - lib/slimmer/skin.rb
284
285
  - lib/slimmer/template.rb