spreewald 2.2.0 → 2.2.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/spreewald/web_steps.rb +16 -6
- data/lib/spreewald_support/path_selector_fallbacks.rb +2 -2
- data/lib/spreewald_support/version.rb +1 -1
- data/tests/rails-3_capybara-1/Gemfile.lock +1 -1
- data/tests/rails-3_capybara-2/Gemfile.lock +1 -1
- data/tests/rails-4_capybara-3/Gemfile.lock +1 -1
- data/tests/shared/app/views/static_pages/numbers.html.haml +10 -0
- data/tests/shared/db/test.sqlite3 +0 -0
- data/tests/shared/features/shared/web_steps.feature +15 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 356289403f9035cb4de73481fbe3fe874dfaa64e
|
4
|
+
data.tar.gz: eb92d6018a939b0ac4046323e69b14a05435a556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 045cf38593b6bc640a02474401d5416a06310045e53b26dfe0a9b834cfb3d4114fd0b93ee522a886fd346fd0bf502ef356f0fe3f481eb024717f96bedafc0ecf
|
7
|
+
data.tar.gz: b0891a0aa08f0e811cad30834965edfd939b58d2b3b5255af7c8b3a6875a4045092c838ceaa2cbf78499944ac8e8d628a3b572bfed3fde69117c68ff5a16b191
|
data/CHANGELOG.md
CHANGED
@@ -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,
|
data/lib/spreewald/web_steps.rb
CHANGED
@@ -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
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
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.
|
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
|
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.
|
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
|
+
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
|