mechanical-cuke 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -2,13 +2,23 @@ Feature: Missing Fields
2
2
  In order to provide reliable tests
3
3
  Steps referering to elements not found on a form should fail
4
4
 
5
- Scenario: Failing Steps
5
+ Scenario: Missing Fields
6
6
  Given I am on the blank form
7
7
  When I fill in a nonexistent text field an error should be raised
8
8
  When I select a nonexistent select field an error should be raised
9
9
  When I choose a nonexistent radio button an error should be raised
10
- When I check a nonexistent check box an error should be raised
10
+ When I check a nonexistent checkbox an error should be raised
11
11
  When I press a nonexistent button an error should be raised
12
12
  When I select a missing option from an existing select an error should be raised
13
+
14
+ Scenario: Missing Link
15
+ Given I am on the blank form
13
16
  When I follow a nonexistent link an error should be raised
14
17
 
18
+ Scenario: Checking Values of Missing Fields
19
+ Given I am on the blank form
20
+ When I test the value of a nonexistent field contains an error should be raised
21
+ When I test state of a nonexistent checkbox contains an error should be raised
22
+
23
+
24
+
@@ -13,7 +13,7 @@ When /^I (?:fill in|select|choose|check|press) a nonexistent (.+) an error shoul
13
13
  assert_raise(RuntimeError) do
14
14
  When %{I choose "nonexistent"}
15
15
  end
16
- when "check box" then
16
+ when "checkbox" then
17
17
  assert_raise(RuntimeError) do
18
18
  When %{I check "nonexistent"}
19
19
  end
@@ -36,3 +36,23 @@ When /^I select a missing option from an existing select an error should be rais
36
36
  When %{I select "nonexistent" from "Exists"}
37
37
  end
38
38
  end
39
+
40
+ When /^I test the value of a nonexistent field contains an error should be raised$/ do
41
+ assert_raise(RuntimeError) do
42
+ When %{the "nonexistent" field should contain "Anything"}
43
+ end
44
+
45
+ assert_raise(RuntimeError) do
46
+ When %{the "nonexistent" field should not contain "Anything"}
47
+ end
48
+ end
49
+
50
+ When /^I test state of a nonexistent checkbox contains an error should be raised$/ do
51
+ assert_raise(RuntimeError) do
52
+ When %{the "nonexistent" checkbox should be checked}
53
+ end
54
+
55
+ assert_raise(RuntimeError) do
56
+ When %{the "nonexistent" checkbox should not be checked}
57
+ end
58
+ end
@@ -104,6 +104,7 @@ end
104
104
 
105
105
  Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
106
106
  f = find_field(field)
107
+ raise "Can't find field \"#{field}\"" if f.nil?
107
108
  if defined?(Spec::Rails::Matchers)
108
109
  f.should == field
109
110
  else
@@ -113,6 +114,7 @@ end
113
114
 
114
115
  Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
115
116
  f = find_field(field)
117
+ raise "Can't find field \"#{field}\"" if f.nil?
116
118
  if defined?(Spec::Rails::Matchers)
117
119
  f.should_not == value
118
120
  else
@@ -122,6 +124,7 @@ end
122
124
 
123
125
  Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
124
126
  cb = find_checkbox(label)
127
+ raise "Can't find check box \"#{label}\"" if cb.nil?
125
128
  if defined?(Spec::Rails::Matchers)
126
129
  cb.checked.should be true
127
130
  else
@@ -131,6 +134,7 @@ end
131
134
 
132
135
  Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
133
136
  cb = find_checkbox(label)
137
+ raise "Can't find check box \"#{label}\"" if cb.nil?
134
138
  if defined?(Spec::Rails::Matchers)
135
139
  cb.checked.should be true
136
140
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mechanical-cuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spike Ilacqua