spreewald 0.5.20 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -128,7 +128,7 @@ Marks scenario as pending
128
128
  Print all sent emails to STDOUT.
129
129
 
130
130
 
131
- * **Then that e?mail should have the following lines in the body:**
131
+ * **Then that e?mail should( not)? have the following lines in the body:**
132
132
 
133
133
  Only works after you've retrieved the email using "Then an email should have been sent with:"
134
134
 
@@ -302,14 +302,21 @@ deprecation notice. Decide for yourself whether you want to use them:
302
302
 
303
303
 
304
304
 
305
- * **Then the "..." field( within ...)? should contain "..."**
305
+ * **Then the "..." field should (not )?contain "..."**
306
306
 
307
307
  Checks that an input field contains some value (allowing * as wildcard character)
308
308
 
309
309
 
310
- * **Then the "..." field( within ...)? should not contain "..."**
310
+ * **Then I should see a form with the following values:**
311
311
 
312
+ Checks that a list of label/value pairs are visible as control inputs.
312
313
 
314
+ Example:
315
+
316
+ Then I should see a form with the following values:
317
+ | E-mail | foo@bar.com |
318
+ | Role | Administrator |
319
+
313
320
 
314
321
 
315
322
  * **Then the "..." field should have the error "..."**
@@ -431,7 +438,7 @@ deprecation notice. Decide for yourself whether you want to use them:
431
438
  Click on some text that might not be a link
432
439
 
433
440
 
434
- * **Then "..." should link to "..."/**
441
+ * **Then "..." should link to "..."**
435
442
 
436
443
  Use this step to check external links.
437
444
 
@@ -490,6 +497,11 @@ deprecation notice. Decide for yourself whether you want to use them:
490
497
 
491
498
 
492
499
 
500
+ * **When I switch to the new tab**
501
+
502
+
503
+
504
+
493
505
  * **Then I should see in this order:?**
494
506
 
495
507
  Checks that these strings are rendered in the given order in a single line or in multiple lines
data/examples/paths.rb CHANGED
@@ -5,7 +5,7 @@ module NavigationHelpers
5
5
  #
6
6
  # When /^I go to (.+)$/ do |page_name|
7
7
  #
8
- # step definition in web_steps.rb
8
+ # step definition in web_steps.feature
9
9
  #
10
10
  def path_to(page_name)
11
11
  case page_name
@@ -4,7 +4,7 @@ module HtmlSelectorsHelpers
4
4
  #
5
5
  # When /^(.+) within (.+)$/ do |step, scope|
6
6
  #
7
- # step definitions in web_steps.rb
7
+ # step definitions in web_steps.feature
8
8
  #
9
9
  def selector_for(locator)
10
10
  case locator
@@ -149,13 +149,43 @@ end
149
149
  Then /^the "([^"]*)" field should (not )?contain "([^"]*)"$/ do |label, negate, expected_string|
150
150
  patiently do
151
151
  field = find_field(label)
152
- field_value = ((field.tag_name == 'textarea') && field.text.present?) ? field.text.strip : field.value
153
-
152
+ field_value = case field.tag_name
153
+ when 'textarea'
154
+ field.text.present? ? field.text.strip : ''
155
+ when 'select'
156
+ options = field.all('option')
157
+ selected_option = options.detect(&:selected?) || options.first
158
+ if selected_option && selected_option.text.present?
159
+ selected_option.text.strip
160
+ else
161
+ ''
162
+ end
163
+ else
164
+ field.value
165
+ end
154
166
  field_value.send(negate ? :should_not : :should, contain_with_wildcards(expected_string))
155
167
  end
156
168
  end
157
169
 
158
170
 
171
+ # Checks that a list of label/value pairs are visible as control inputs.
172
+ #
173
+ # Example:
174
+ #
175
+ # Then I should see a form with the following values:
176
+ # | E-mail | foo@bar.com |
177
+ # | Role | Administrator |
178
+ #
179
+ Then /^I should see a form with the following values:$/ do |table|
180
+ expectations = table.raw
181
+ expectations.each do |label, expected_value|
182
+ step %(the "#{label}" field should contain "#{expected_value}")
183
+ end
184
+ end
185
+
186
+
187
+
188
+
159
189
  # checks that an input field was wrapped with a validation error
160
190
  Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message|
161
191
  patiently do
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module Spreewald
4
- VERSION = "0.5.20"
4
+ VERSION = "0.6.0"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (0.5.17)
4
+ spreewald (0.5.20)
5
5
  capybara
6
6
  cucumber
7
7
  cucumber-rails
@@ -3,4 +3,5 @@ cucumber:
3
3
  adapter: mysql2
4
4
  host: localhost
5
5
  username: root
6
- password: secret
6
+ password: junior
7
+
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (0.5.17)
4
+ spreewald (0.5.20)
5
5
  capybara
6
6
  cucumber
7
7
  cucumber-rails
@@ -3,4 +3,5 @@ cucumber:
3
3
  adapter: mysql2
4
4
  host: localhost
5
5
  username: root
6
- password: secret
6
+ password: junior
7
+
@@ -0,0 +1,3 @@
1
+ class FormsController < ApplicationController
2
+
3
+ end
@@ -0,0 +1,15 @@
1
+ = form_tag do
2
+
3
+ = label_tag 'text_control', 'Text control'
4
+ = text_field_tag 'text_control', 'Text control value'
5
+
6
+ = label_tag 'select_control', 'Select control'
7
+ = select_tag 'select_control', options_for_select([['Label 1', 'value1'], ['Label 2', 'value2'], ['Label 3', 'value3']], 'value2')
8
+
9
+ = label_tag 'select_control_without_selection', 'Select control without selection'
10
+ = select_tag 'select_control_without_selection', options_for_select([['Label 1', 'value1'], ['Label 2', 'value2'], ['Label 3', 'value3']])
11
+
12
+ = label_tag 'textarea_control', 'Textarea control'
13
+ = text_area_tag 'textarea_control', 'Textarea control value'
14
+
15
+
@@ -0,0 +1,17 @@
1
+ Feature: Web steps
2
+
3
+ Background:
4
+ When I go to "/forms/form1"
5
+
6
+ Scenario: /^the "([^"]*)" field should (not )?contain "([^"]*)"$/
7
+ Then the "Text control" field should contain "Text control value"
8
+ Then the "Select control" field should contain "Label 2"
9
+ Then the "Select control without selection" field should contain "Label 1"
10
+ Then the "Textarea control" field should contain "Textarea control value"
11
+
12
+ Scenario: /^I should see a form with the following values:$/
13
+ Then I should see a form with the following values:
14
+ | Text control | Text control value |
15
+ | Select control | Label 2 |
16
+ | Select control without selection | Label 1 |
17
+ | Textarea control | Textarea control value |
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 20
10
- version: 0.5.20
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Kraze
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-07-26 00:00:00 +02:00
18
+ date: 2013-08-22 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -130,15 +130,18 @@ files:
130
130
  - tests/rails-3.2/features/support/paths.rb
131
131
  - tests/shared/app/controllers/application_controller.rb
132
132
  - tests/shared/app/controllers/emails_controller.rb
133
+ - tests/shared/app/controllers/forms_controller.rb
133
134
  - tests/shared/app/controllers/tables_controller.rb
134
135
  - tests/shared/app/models/mailer.rb
136
+ - tests/shared/app/views/forms/form1.html.haml
135
137
  - tests/shared/app/views/layouts/application.html.haml
136
138
  - tests/shared/app/views/tables/table1.html.haml
137
139
  - tests/shared/config/database.sample.yml
138
140
  - tests/shared/db/migrate/.gitignore
139
- - tests/shared/features/shared/emails.feature
141
+ - tests/shared/features/shared/email_steps.feature
140
142
  - tests/shared/features/shared/step_definitions/test_steps.rb
141
- - tests/shared/features/shared/tables.feature
143
+ - tests/shared/features/shared/table_steps.feature
144
+ - tests/shared/features/shared/web_steps.feature
142
145
  - tests/shared/features/support/paths.rb
143
146
  has_rdoc: true
144
147
  homepage: https://github.com/makandra/spreewald