spreewald 2.2.0 → 2.2.1

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: c6344c3e67a52d140623e262f62163db7c50d4c8
4
- data.tar.gz: 615431258c8bacd8e28459adf8726987226cb348
3
+ metadata.gz: 356289403f9035cb4de73481fbe3fe874dfaa64e
4
+ data.tar.gz: eb92d6018a939b0ac4046323e69b14a05435a556
5
5
  SHA512:
6
- metadata.gz: d831672bf55cb2b5cdc5fb239dfbc1ac494092e00dc518d8d868513f615416d84dd96b2ea49ac7f1fd9c0f5792c402c9ee36812bdb74aaf25532b5870405ba2b
7
- data.tar.gz: dd374015482e0fa3403e4d18ee4885635db1d6295e7f2f2c2626bac6acc4804d0c9cbdce6a41a0d56b08bd4046f13032173dce5b49a6de9cb34c38cc61c22ebb
6
+ metadata.gz: 045cf38593b6bc640a02474401d5416a06310045e53b26dfe0a9b834cfb3d4114fd0b93ee522a886fd346fd0bf502ef356f0fe3f481eb024717f96bedafc0ecf
7
+ data.tar.gz: b0891a0aa08f0e811cad30834965edfd939b58d2b3b5255af7c8b3a6875a4045092c838ceaa2cbf78499944ac8e8d628a3b572bfed3fde69117c68ff5a16b191
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## 2.2.1
7
+ - Refactor the `I should see the (number|amount)` step. (see issues [#43](https://github.com/makandra/spreewald/issues/43) and [#44](https://github.com/makandra/spreewald/issues/44))
8
+ * It can now be composed with the 'within' step
9
+ * It can now truly match negative numbers
10
+ * It dropped the hidden dependency on the HTMLEntities gem
11
+ * Fix URLs to the GitHub repository of Spreewald as part of the `_path_to` and `_selector_for` error handling. (see issue [#82](https://github.com/makandra/spreewald/issues/82))
12
+
6
13
  ## 2.2.0
7
14
  - Add a new step `I should( not)? see a link labeled "STRING"`.
8
15
  - Refer to Capybara 3's new flag `Capybara.default_normalize_ws = true` in the READNE,
@@ -217,14 +217,24 @@ end.overridable
217
217
  #
218
218
  # See [here](https://makandracards.com/makandra/1225-test-that-a-number-or-money-amount-is-shown-with-cucumber) for details
219
219
  Then /^I should( not)? see the (?:number|amount) ([\-\d,\.]+)(?: (.*?))?$/ do |negate, amount, unit|
220
- no_minus = amount.starts_with?('-') ? '' : '[^\\-]'
221
- nbsp = " "
222
- regexp = Regexp.new(no_minus + "\\b" + Regexp.quote(amount) + (unit ? "( |#{nbsp}| )(#{unit}|#{Regexp.quote(HTMLEntities.new.encode(unit, :named))})" :"\\b"))
223
- expectation = negate ? :not_to : :to
220
+ expect_to_match = negate ? :not_to : :to
221
+ is_negative = amount.start_with?('-')
222
+ absolute_amount = amount.gsub(/^-/, '')
223
+ expect_minus = is_negative ? '-' : '(?:[^\\-]|^)'
224
+ word_boundary = '\b'
225
+ unit_or_boundary = if unit
226
+ nbsp = " "
227
+ "( |#{nbsp})(#{unit})"
228
+ else
229
+ word_boundary
230
+ end
231
+
232
+ regexp = Regexp.new(expect_minus + word_boundary + Regexp.quote(absolute_amount) + unit_or_boundary)
233
+
224
234
  patiently do
225
- expect(page.body).send(expectation, match(regexp))
235
+ expect(page.text).send(expect_to_match, match(regexp))
226
236
  end
227
- end.overridable
237
+ end.overridable(priority: -5) # priority lower than within
228
238
 
229
239
  # Like `Then I should see`, but with single instead of double quotes. In case
230
240
  # the expected string contains quotes as well.
@@ -8,7 +8,7 @@ module PathSelectorFallbacks
8
8
  $1
9
9
  else
10
10
  raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
11
- "Add and require a selectors.rb file (compare #{Spreewald.github_url}/examples/selectors.rb)"
11
+ "Add and require a selectors.rb file (compare #{Spreewald.github_url}/blob/master/examples/selectors.rb)"
12
12
  end
13
13
  end
14
14
 
@@ -22,7 +22,7 @@ module PathSelectorFallbacks
22
22
  self.send(path_components.push('path').join('_').to_sym)
23
23
  rescue NoMethodError, ArgumentError
24
24
  raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
25
- "Add and require a paths.rb file (compare #{Spreewald.github_url}/examples/paths.rb)"
25
+ "Add and require a paths.rb file (compare #{Spreewald.github_url}/blob/master/examples/paths.rb)"
26
26
  end
27
27
  end
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.1.3)
4
+ spreewald (2.2.1)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.1.3)
4
+ spreewald (2.2.1)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.2.0)
4
+ spreewald (2.2.1)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -0,0 +1,10 @@
1
+ %span 1
2
+ %ul
3
+ %li 2.3
4
+ %li 4,5
5
+ %li -60,72 €
6
+ %li 13 €
7
+ %li
8
+ .nested-number -10,000.99 EUR
9
+
10
+ .unrelated-element
Binary file
@@ -253,3 +253,18 @@ Feature: Web steps
253
253
  And I should see a link labeled "Also matches via the title attribute"
254
254
  But I should not see a link labeled "Nonexistent Link"
255
255
  And I should not see a link labeled "First visible link" within ".unrelated-element"
256
+
257
+
258
+ Scenario: /^I should( not)? see the (?:number|amount) ([\-\d,\.]+)(?: (.*?))?$/
259
+ When I am on "/static_pages/numbers"
260
+ Then I should see the number 1
261
+ And I should see the number 2.3
262
+ And I should see the number 4,5
263
+ And I should see the amount -60,72 €
264
+ And I should see the amount 13 €
265
+ And I should see the amount -10,000.99 EUR within ".nested-number"
266
+ But I should not see the number 2,3
267
+ And I should not see the number 4.5
268
+ And I should not see the number 60,72
269
+ And I should not see the amount -60,7 €
270
+ And I should not see the amount -10,000.99 EUR within ".unrelated-element"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-11 00:00:00.000000000 Z
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -284,6 +284,7 @@ files:
284
284
  - tests/shared/app/views/static_pages/home.html.haml
285
285
  - tests/shared/app/views/static_pages/link_to_home.html.haml
286
286
  - tests/shared/app/views/static_pages/links.html.haml
287
+ - tests/shared/app/views/static_pages/numbers.html.haml
287
288
  - tests/shared/app/views/static_pages/overridden.html.haml
288
289
  - tests/shared/app/views/static_pages/see_element.html.haml
289
290
  - tests/shared/app/views/static_pages/visibility.html.haml
@@ -439,6 +440,7 @@ test_files:
439
440
  - tests/shared/app/views/static_pages/home.html.haml
440
441
  - tests/shared/app/views/static_pages/link_to_home.html.haml
441
442
  - tests/shared/app/views/static_pages/links.html.haml
443
+ - tests/shared/app/views/static_pages/numbers.html.haml
442
444
  - tests/shared/app/views/static_pages/overridden.html.haml
443
445
  - tests/shared/app/views/static_pages/see_element.html.haml
444
446
  - tests/shared/app/views/static_pages/visibility.html.haml