spreewald 1.1.2 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 591f1594fb0bfe42e56f28dbb8ef78251de952ee
4
- data.tar.gz: 7e2a69ce6ea063d0b60a0b0aa0d2aafe6a716a81
3
+ metadata.gz: 829cfaaa86ce9386294cc90361766b1fc52f79b2
4
+ data.tar.gz: 618cc0ccc9b30934d1b5a8183bed98c8f5785c9e
5
5
  SHA512:
6
- metadata.gz: bf05682d06bbb9a55b4be5aa00263ad53a63fb992ada8ae4f53f41583bdaea52bf652e37a4329e5db7a31b9c2a38836fdd6879b0970b5e563f7ff05ef05675bb
7
- data.tar.gz: 082c88d2a97193609a483614b4b81cba5e836af978b6060f2f69224bf9e8eebdf75e0f59aca0070385ef8b7fd93b0288db28dabc9dd11e4231e5eae0aabb454a
6
+ metadata.gz: b745e5075c5ac1fbf97f752353eea7e3c2934e7668fa91ab950b47c9716de24d5737a7f39987848ed1196bed144c98653aacea7d623641634f2441d86083b6e4
7
+ data.tar.gz: 6c7e4f3411c6f1e4505ddcc146e70eb22dcdf9a3aaea523069d535324c976918cf2b7e4d12f9cee55bee50d3cd2f269086868c556b327dbd0cc8cb4189812806
data/README.md CHANGED
@@ -67,15 +67,19 @@ More info [here](https://makandracards.com/makandra/12139-waiting-for-page-load-
67
67
 
68
68
  ## Contributing
69
69
 
70
- Test applications for various Rails versions live in `tests/`. There is a Rake task that will run all specs in those test Rails applications for all relevant Ruby versions. Invoke it with:
70
+ Test applications for various Rails versions live in `tests/`.
71
71
 
72
- bundle exec rake all:rubies
72
+ - Bundle all test apps with `bundle exec rake all:bundle`.
73
+ - Run features in all test apps with `bundle exec rake all:features`.
74
+ - Run features in all test apps in all rubies with `bundle exec rake all:rubies`.
75
+ - Run a single feature by setting the `SINGLE_FEATURE` environment variable.
76
+ Example: `SINGLE_FEATURE=web_steps.feature:63 bundle exec rake all:features`
73
77
 
74
78
  If you would like to contribute:
75
79
 
76
80
  - Fork the repository
77
81
  - Push your changes with specs
78
- - Make sure all specs pass
82
+ - Make sure `rake` passes
79
83
  - Regenerate the "Steps" section of this Readme with `rake update_readme`, if needed
80
84
  - Make a pull request
81
85
 
@@ -256,7 +260,7 @@ See [this article](https://makandracards.com/makandra/1222-useful-cucumber-steps
256
260
 
257
261
  ### web_steps.rb
258
262
 
259
- Most of cucumber-rails' original web steps plus a few of our own.
263
+ Most of cucumber-rails' original web steps plus a few of our own.
260
264
 
261
265
  Note that cucumber-rails deprecated all its steps quite a while ago with the following
262
266
  deprecation notice. Decide for yourself whether you want to use them:
@@ -631,5 +635,11 @@ deprecation notice. Decide for yourself whether you want to use them:
631
635
 
632
636
  * **When I go back**
633
637
 
634
- Go to the previously viewed page.
638
+ Goes to the previously viewed page.
639
+
640
+
641
+ * **Then the "..." select should( not)? be sorted**
642
+
643
+ Tests whether a select field is sorted. Uses Array#natural_sort, if defined;
644
+ Array#sort else.
635
645
 
data/Rakefile CHANGED
@@ -25,10 +25,7 @@ namespace :all do
25
25
  task :features do
26
26
  success = true
27
27
  for_each_directory_of('tests/**/Rakefile') do |directory|
28
- Bundler.with_clean_env do
29
- env = "FEATURE=../../#{ENV['FEATURE']}" if ENV['FEATURE']
30
- success &= system("cd #{directory} && bundle exec rake features #{env}")
31
- end
28
+ success &= Bundler.clean_system("cd #{directory} && bundle exec rake features")
32
29
  end
33
30
  fail "Tests failed" unless success
34
31
  end
@@ -64,7 +61,7 @@ def run_for_all_rubies(version_manager)
64
61
  %w[
65
62
  1.8.7
66
63
  1.9.3
67
- 2.0.0
64
+ 2.1.2
68
65
  ].all? do |ruby_version|
69
66
  announce "Running features for Ruby #{ruby_version}", 2
70
67
 
@@ -666,7 +666,7 @@ When /^I perform basic authentication as "([^\"]*)\/([^\"]*)" and go to (.*)$/ d
666
666
  end
667
667
  end
668
668
 
669
- # Go to the previously viewed page.
669
+ # Goes to the previously viewed page.
670
670
  When /^I go back$/ do
671
671
  case Capybara::current_driver
672
672
  when :selenium, :webkit
@@ -679,3 +679,13 @@ When /^I go back$/ do
679
679
  end
680
680
  end
681
681
  end
682
+
683
+ # Tests whether a select field is sorted. Uses Array#natural_sort, if defined;
684
+ # Array#sort else.
685
+ Then /^the "(.*?)" select should( not)? be sorted$/ do |label, negate|
686
+ select = find_field(label)
687
+ options = select.all('option').reject { |o| o.value.blank? }
688
+ option_texts = options.collect(&:text)
689
+
690
+ option_texts.send((negate ? :should_not : :should), be_sorted)
691
+ end
@@ -19,4 +19,12 @@ module CustomMatchers
19
19
  end
20
20
  end
21
21
 
22
+ rspec::Matchers.define :be_sorted do
23
+ match do |array|
24
+ sort_method = defined?(array.natural_sort) ? :natural_sort : :sort
25
+
26
+ array == array.send(sort_method)
27
+ end
28
+ end
29
+
22
30
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '1.1.2'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (1.1.2)
4
+ spreewald (1.2.0)
5
5
  capybara
6
6
  cucumber
7
7
  cucumber-rails
@@ -6,7 +6,12 @@ task :default => :features
6
6
 
7
7
  desc 'Run all specs for rails 2.3'
8
8
  Cucumber::Rake::Task.new(:features) do |t|
9
+ feature = if ENV['SINGLE_FEATURE']
10
+ "../shared/features/shared/#{ ENV['SINGLE_FEATURE'] }"
11
+ else
12
+ 'features/shared'
13
+ end
14
+
9
15
  # tell cucumber where it finds it files (subdirectories and symlinks are confusing it)
10
- feature = ENV['FEATURE'] || "features/shared"
11
16
  t.cucumber_opts = "--require features --require features/shared #{feature}"
12
17
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- spreewald (1.1.2)
4
+ spreewald (1.2.0)
5
5
  capybara
6
6
  cucumber
7
7
  cucumber-rails
@@ -6,8 +6,13 @@ task :default => :features
6
6
 
7
7
  desc 'Run all specs for rails 3.2'
8
8
  Cucumber::Rake::Task.new(:features) do |t|
9
+ feature = if ENV['SINGLE_FEATURE']
10
+ "../../shared/features/shared/#{ ENV['SINGLE_FEATURE'] }"
11
+ else
12
+ 'features/shared'
13
+ end
14
+
9
15
  # tell cucumber where it finds it files (subdirectories and symlinks are confusing it)
10
- feature = ENV['FEATURE'] || "features/shared"
11
16
  t.cucumber_opts = "--require features --require features/shared #{feature}"
12
17
  end
13
18
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- spreewald (1.1.2)
4
+ spreewald (1.2.0)
5
5
  capybara
6
6
  cucumber
7
7
  cucumber-rails
@@ -6,8 +6,13 @@ task :default => :features
6
6
 
7
7
  desc 'Run all specs for rails 3.2'
8
8
  Cucumber::Rake::Task.new(:features) do |t|
9
+ feature = if ENV['SINGLE_FEATURE']
10
+ "../../shared/features/shared/#{ ENV['SINGLE_FEATURE'] }"
11
+ else
12
+ 'features/shared'
13
+ end
14
+
9
15
  # tell cucumber where it finds it files (subdirectories and symlinks are confusing it)
10
- feature = ENV['FEATURE'] || "features/shared"
11
16
  t.cucumber_opts = "--require features --require features/shared #{feature}"
12
17
  end
13
18
 
@@ -0,0 +1,7 @@
1
+ = form_tag do
2
+
3
+ = label_tag 'sorted', 'Sorted select'
4
+ = select_tag 'sorted', options_for_select([['prompt', nil], ['Anton', 'value'], ['Berta', 'value'], ['Clara', 'value'], ['Dario', 'value']])
5
+
6
+ = label_tag 'unsorted', 'Unsorted select'
7
+ = select_tag 'unsorted', options_for_select([['prompt', nil], ['Xaver', 'value'], ['Berta', 'value'], ['Konstantin', 'value'], ['Maria', 'value']])
@@ -58,3 +58,9 @@ Feature: Web steps
58
58
  When I go to "/static_pages/click_on"
59
59
  And I click on "Nested"
60
60
  And I click on "Button"
61
+
62
+
63
+ Scenario: /^the "(.*?)" select should( not)? be sorted$/
64
+ When I go to "/forms/select_fields"
65
+ Then the "sorted" select should be sorted
66
+ But the "unsorted" select should not be sorted
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: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-14 00:00:00.000000000 Z
11
+ date: 2015-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-rails
@@ -132,6 +132,7 @@ files:
132
132
  - tests/shared/app/views/forms/checkbox_form.html.haml
133
133
  - tests/shared/app/views/forms/form1.html.haml
134
134
  - tests/shared/app/views/forms/form2.html.haml
135
+ - tests/shared/app/views/forms/select_fields.html.haml
135
136
  - tests/shared/app/views/layouts/application.html.haml
136
137
  - tests/shared/app/views/static_pages/click_on.html.haml
137
138
  - tests/shared/app/views/static_pages/home.html.haml
@@ -216,6 +217,7 @@ test_files:
216
217
  - tests/shared/app/views/forms/checkbox_form.html.haml
217
218
  - tests/shared/app/views/forms/form1.html.haml
218
219
  - tests/shared/app/views/forms/form2.html.haml
220
+ - tests/shared/app/views/forms/select_fields.html.haml
219
221
  - tests/shared/app/views/layouts/application.html.haml
220
222
  - tests/shared/app/views/static_pages/click_on.html.haml
221
223
  - tests/shared/app/views/static_pages/home.html.haml