spreewald 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -19,10 +19,13 @@ Or install it yourself as:
19
19
  ## Usage
20
20
 
21
21
  Steps are grouped into a number of categories. You can pick and choose single categories by putting something like
22
+
22
23
  require 'spreewald/email_steps'
24
+
23
25
  into your `support/env.rb`
24
26
 
25
27
  Alternatively, you can require everything by doing
28
+
26
29
  require 'spreewald/all_steps'
27
30
 
28
31
  ## Steps
@@ -4,6 +4,10 @@ Before do
4
4
  ActionMailer::Base.deliveries.clear
5
5
  end
6
6
 
7
+ When /^I clear my emails$/ do
8
+ ActionMailer::Base.deliveries.clear
9
+ end
10
+
7
11
  Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/ do |mode, query|
8
12
  conditions = {}
9
13
  conditions[:to] = $1 if query =~ /to "([^"]+)"/
@@ -161,6 +161,13 @@ Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_me
161
161
  end
162
162
  end
163
163
 
164
+ Then /^the "([^\"]*)" field should( not)? have an error$/ do |field, negate|
165
+ patiently do
166
+ expectation = negate ? :should_not : :should
167
+ page.send(expectation, have_css('.field_with_errors', :text => field))
168
+ end
169
+ end
170
+
164
171
  Then /^the "([^"]*)" field should have no error$/ do |field|
165
172
  patiently do
166
173
  element = find_field(field)
@@ -188,6 +195,12 @@ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label
188
195
  end
189
196
  end
190
197
 
198
+ Then /^the radio button "([^"]*)" should( not)? be (?:checked\|selected)$/ do |field, negate|
199
+ patiently do
200
+ page.send((negate ? :has_no_checked_field? : :has_checked_field?), field)
201
+ end
202
+ end
203
+
191
204
  Then /^(?:|I )should be on (.+)$/ do |page_name|
192
205
  patiently do
193
206
  current_path = URI.parse(current_url).path
@@ -332,3 +345,26 @@ end
332
345
  Then /^I should get a text response$/ do
333
346
  step 'I should get a response with content-type "text/plain"'
334
347
  end
348
+
349
+ When /^I follow "([^"]*)" inside any "([^"]*)"$/ do |label, selector|
350
+ node = first("#{selector} a", :text => label)
351
+ node.click
352
+ end
353
+
354
+ Then /^I should( not)? see "([^"]*)" inside any "([^"]*)"$/ do |negate, text, selector|
355
+ expectation = negate ? :should_not : :should
356
+ page.send(expectation, have_css(selector, :text => text))
357
+ end
358
+
359
+ When /^I fill in "([^"]*)" with "([^"]*)" inside any "([^"]*)"$/ do |field, value, selector|
360
+ containers = all(:css, selector)
361
+ input = nil
362
+ containers.detect do |container|
363
+ input = container.first(:xpath, XPath::HTML.fillable_field(field))
364
+ end
365
+ if input
366
+ input.set(value)
367
+ else
368
+ raise "Could not find an input field \"#{field}\" inside any \"#{selector}\""
369
+ end
370
+ end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Kraze