cucumber-rails 0.1.1.rc2 → 0.1.1.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/cucumber-rails.gemspec +23 -10
- data/generators/cucumber/cucumber_generator.rb +63 -20
- data/generators/cucumber/templates/capybara_env.rb +24 -0
- data/generators/cucumber/templates/cucumber_environment.rb +8 -1
- data/generators/cucumber/templates/env.rb +0 -22
- data/generators/cucumber/templates/web_steps/capybara_steps.rb +247 -0
- data/generators/cucumber/templates/web_steps/web_steps_de.rb +139 -0
- data/generators/cucumber/templates/web_steps/web_steps_no.rb +117 -0
- data/generators/cucumber/templates/web_steps/web_steps_pt-BR.rb +143 -0
- data/generators/cucumber/templates/{webrat_steps/webrat_steps_en.rb → web_steps/webrat_steps.rb} +84 -68
- data/generators/cucumber/templates/webrat_env.rb +22 -0
- data/generators/feature/feature_generator.rb +1 -0
- data/generators/feature/templates/feature.erb +5 -1
- data/generators/feature/templates/steps.erb +1 -1
- data/lib/cucumber/rails/world.rb +1 -1
- data/lib/cucumber/web/tableish.rb +27 -0
- data/spec/cucumber/web/tableish_spec.rb +103 -0
- data/spec/spec_helper.rb +6 -0
- data/tasks/rspec.rake +13 -0
- metadata +20 -9
- data/generators/cucumber/templates/webrat_steps/webrat_steps_de.rb +0 -241
- data/lib/cucumber-rails.rb +0 -3
@@ -0,0 +1,139 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# IMPORTANT: This file was generated.
|
3
|
+
# Edit at your own peril - it's recommended to regenerate this file
|
4
|
+
# in the future when you upgrade to a newer version of Cucumber.
|
5
|
+
# Consider adding your own code to a new file instead of editing this one.
|
6
|
+
|
7
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
8
|
+
|
9
|
+
Given /^(?:|ich )bin auf (.+)$/ do |page_name|
|
10
|
+
Given %{I am on #{page_name}}
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^(?:|ich )auf (.+) gehe$/ do |page_name|
|
14
|
+
When %{I go to #{page_name}}
|
15
|
+
end
|
16
|
+
|
17
|
+
When /^(?:|ich )auf "([^\"]*)" drücke$/ do |button|
|
18
|
+
When %{I press "#{button}"}
|
19
|
+
end
|
20
|
+
|
21
|
+
When /^(?:|ich )auf "([^\"]*)" klicke$/ do |link|
|
22
|
+
When %{I follow "#{link}"}
|
23
|
+
end
|
24
|
+
|
25
|
+
When /^(?:|ich )auf "([^\"]*)" innerhalb "([^\"]*)" klicke$/ do |link, parent|
|
26
|
+
When %{I follow "#{link}" within "#{parent}"}
|
27
|
+
end
|
28
|
+
|
29
|
+
When /^(?:|ich )"([^\"]*)" mit "([^\"]*)" ausfülle$/ do |field, value|
|
30
|
+
When %{I fill in "#{field}" with "#{value}"}
|
31
|
+
end
|
32
|
+
|
33
|
+
When /^(?:|ich )"([^\"]*)" in "([^\"]*)" eingebe$/ do |value, field|
|
34
|
+
When %{I fill in "#{value}" for "#{field}"}
|
35
|
+
end
|
36
|
+
|
37
|
+
When /^(?:|ich )folgendes eingebe:$/ do |fields|
|
38
|
+
When %{I fill in the following:}, fields
|
39
|
+
end
|
40
|
+
|
41
|
+
When /^(?:|ich )"([^\"]*)" in "([^\"]*)" auswähle$/ do |value, field|
|
42
|
+
When %{I select "#{value}" from "#{field}"}
|
43
|
+
end
|
44
|
+
|
45
|
+
When /^(?:|ich )"([^\"]*)" als Datum und Uhrzeit auswähle$/ do |time|
|
46
|
+
When %{I select "#{time}" as the date and time}
|
47
|
+
end
|
48
|
+
|
49
|
+
When /^(?:|ich )"([^\"]*)" als "([^\"]*)" Datum und Uhrzeit auswähle$/ do |datetime, datetime_label|
|
50
|
+
When %{I select "#{detetime}" as the "#{datetime_label}" date and time}
|
51
|
+
end
|
52
|
+
|
53
|
+
When /^(?:|ich )"([^\"]*)" als Uhrzeit auswähle$/ do |time|
|
54
|
+
When %{I select "#{time}" as the time}
|
55
|
+
end
|
56
|
+
|
57
|
+
When /^(?:|ich )"([^\"]*)" als "([^\"]*)" Uhrzeit auswähle$/ do |time, time_label|
|
58
|
+
When %{I select "#{time}" as the "#{time_label}" time}
|
59
|
+
end
|
60
|
+
|
61
|
+
When /^(?:|ich )"([^\"]*)" als Datum auswähle$/ do |date|
|
62
|
+
When %{I select "#{date}" as the date}
|
63
|
+
end
|
64
|
+
|
65
|
+
When /^(?:|ich )"([^\"]*)" als "([^\"]*)" Datum auswähle$/ do |date, date_label|
|
66
|
+
When %{I select "#{date}" as the "#{date_label}" date}
|
67
|
+
end
|
68
|
+
|
69
|
+
When /^(?:|ich )"([^\"]*)" anhake$/ do |field|
|
70
|
+
When %{I check "#{field}"}
|
71
|
+
end
|
72
|
+
|
73
|
+
When /^(?:|ich )"([^\"]*)" abhake$/ do |field|
|
74
|
+
When %{I uncheck "#{field}"}
|
75
|
+
end
|
76
|
+
|
77
|
+
When /^(?:|ich )"([^\"]*)" auswähle$/ do |field|
|
78
|
+
When %{I choose "#{field}"}
|
79
|
+
end
|
80
|
+
|
81
|
+
When /^(?:|ich )die Datei "([^\"]*)" als "([^\"]*)" anhänge$/ do |path, field|
|
82
|
+
When %{I attach the file at "#{path}" to "#{field}"}
|
83
|
+
end
|
84
|
+
|
85
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)"([^\"]*)" sehen$/ do |text|
|
86
|
+
Then %{I should see "#{text}"}
|
87
|
+
end
|
88
|
+
|
89
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)"([^\"]*)" innerhalb "([^\"]*)" sehen$/ do |text, selector|
|
90
|
+
Then %{I should see "#{text}" within "#{selector}"}
|
91
|
+
end
|
92
|
+
|
93
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)\/([^\/]*)\/ sehen$/ do |regexp|
|
94
|
+
Then %{I should see /#{text}/}
|
95
|
+
end
|
96
|
+
|
97
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)\/([^\/]*)\/ innerhalb "([^\"]*)" sehen$/ do |regexp, selector|
|
98
|
+
Then %{I should see /#{text}/ within "#{selector}"}
|
99
|
+
end
|
100
|
+
|
101
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)nicht "([^\"]*)" sehen$/ do |text|
|
102
|
+
Then %{I should not see "#{text}"}
|
103
|
+
end
|
104
|
+
|
105
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)nicht "([^\"]*)" innerhalb "([^\"]*)" sehen$/ do |text, selector|
|
106
|
+
Then %{I should not see "#{text}" within "#{selector}"}
|
107
|
+
end
|
108
|
+
|
109
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)nicht \/([^\/]*)\/ sehen$/ do |regexp|
|
110
|
+
Then %{I should not see /#{text}/}
|
111
|
+
end
|
112
|
+
|
113
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)nicht \/([^\/]*)\/ innerhalb "([^\"]*)" sehen$/ do |regexp, selector|
|
114
|
+
Then %{I should not see /#{text}/ within "#{selector}"}
|
115
|
+
end
|
116
|
+
|
117
|
+
Then /^sollte das "([^\"]*)" Feld "([^\"]*)" enthalten$/ do |field, value|
|
118
|
+
Then %{the "#{field}" field should contain "#{value}"}
|
119
|
+
end
|
120
|
+
|
121
|
+
Then /^sollte das "([^\"]*)" Feld nicht "([^\"]*)" enthalten$/ do |field, value|
|
122
|
+
Then %{the "#{field}" field should not contain "#{value}"}
|
123
|
+
end
|
124
|
+
|
125
|
+
Then /^sollte die "([^\"]*)" Checkbox angehakt sein$/ do |label|
|
126
|
+
Then %{the "#{label}" checkbox should be checked"}
|
127
|
+
end
|
128
|
+
|
129
|
+
Then /^sollte die "([^\"]*)" Checkbox nicht angehakt sein$/ do |label|
|
130
|
+
Then %{the "#{label}" checkbox should not be checked"}
|
131
|
+
end
|
132
|
+
|
133
|
+
Then /^(?:|ich sollte |sollte (?:|ich )?)auf (.+) sein$/ do |page_name|
|
134
|
+
Then %{I should be on #{page_name}}
|
135
|
+
end
|
136
|
+
|
137
|
+
Then /^zeig mir die Seite$/ do
|
138
|
+
Then %{show me the page}
|
139
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# IMPORTANT: This file was generated.
|
3
|
+
# Edit at your own peril - it's recommended to regenerate this file
|
4
|
+
# in the future When you upgrade to a newer version of Cucumber.
|
5
|
+
# Consider adding your own code to a new file instead of editing this one.
|
6
|
+
|
7
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
8
|
+
|
9
|
+
Gitt /^(?:at )jeg står på (.*)$/ do |page_name|
|
10
|
+
Given %{I am on #{page_name}}
|
11
|
+
end
|
12
|
+
|
13
|
+
Når /^jeg går til (.*)$/ do |page_name|
|
14
|
+
When %{I go to #{page_name}}
|
15
|
+
end
|
16
|
+
|
17
|
+
Når /^jeg trykker "([^\"]*)"$/ do |button|
|
18
|
+
When %{I press "#{button}"}
|
19
|
+
end
|
20
|
+
|
21
|
+
Når /^jeg klikker "([^\"]*)"$/ do |link|
|
22
|
+
When %{I follow "#{link}"}
|
23
|
+
end
|
24
|
+
|
25
|
+
Når /^jeg klikker "([^\"]*)" under "([^\"]*)"$/ do |link, parent|
|
26
|
+
When %{I follow "#{link}" within "#{parent}"}
|
27
|
+
end
|
28
|
+
|
29
|
+
Når /^jeg fyller inn "([^\"]*)" med "([^\"]*)"$/ do |field, value|
|
30
|
+
When %{I fill in "#{field}" with "#{value}"}
|
31
|
+
end
|
32
|
+
|
33
|
+
Når /^jeg fyller inn "([^\"]*)" for "([^\"]*)"$/ do |value, field|
|
34
|
+
When %{I fill in "#{value}" for "#{field}"}
|
35
|
+
end
|
36
|
+
|
37
|
+
Når /^jeg fyller inn følgende:$/ do |fields|
|
38
|
+
When %{I fill in the following:}, fields
|
39
|
+
end
|
40
|
+
|
41
|
+
Når /^jeg velger "([^\"]*)" fra "([^\"]*)"$/ do |value, field|
|
42
|
+
When %{I select "#{value}" from "#{field}"}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Missing: date stuff
|
46
|
+
|
47
|
+
Når /^jeg krysser av "([^\"]*)"$/ do |field|
|
48
|
+
When %{I check "#{field}"}
|
49
|
+
end
|
50
|
+
|
51
|
+
Når /^jeg fjerner avkrysning for "([^\"]*)"$/ do |field|
|
52
|
+
When %{I uncheck "#{field}"}
|
53
|
+
end
|
54
|
+
|
55
|
+
Når /^jeg velger "([^\"]*)"$/ do |field|
|
56
|
+
When %{I choose "#{field}"}
|
57
|
+
end
|
58
|
+
|
59
|
+
Når /^jeg legger ved filen "([^\"]*)" til "([^\"]*)"$/ do |path, field|
|
60
|
+
When %{I attach the file at "#{path}" to "#{field}"}
|
61
|
+
end
|
62
|
+
|
63
|
+
Så /^(?:skal jeg|jeg skal) se "([^\"]*)"$/ do |text|
|
64
|
+
Then %{I should see "#{text}"}
|
65
|
+
end
|
66
|
+
|
67
|
+
Så /^(?:skal jeg|jeg skal) se "([^\"]*)" under "([^\"]*)"$/ do |text, selector|
|
68
|
+
Then %{I should see "#{text}" within "#{selector}"}
|
69
|
+
end
|
70
|
+
|
71
|
+
Så /^(?:skal jeg|jeg skal) se \/([^\/]*)\/$/ do |text|
|
72
|
+
Then %{I should see /#{text}/}
|
73
|
+
end
|
74
|
+
|
75
|
+
Så /^(?:skal jeg|jeg skal) se \/([^\/]*)\/ under "([^\"]*)"$/ do |text, selector|
|
76
|
+
Then %{I should see /#{text}/ within "#{selector}"}
|
77
|
+
end
|
78
|
+
|
79
|
+
Så /^(?:skal jeg|jeg skal) ikke se "([^\"]*)"$/ do |text|
|
80
|
+
Then %{I should not see "#{text}"}
|
81
|
+
end
|
82
|
+
|
83
|
+
Så /^(?:skal jeg|jeg skal) ikke se "([^\"]*)" under "([^\"]*)"$/ do |text, selector|
|
84
|
+
Then %{I should not see "#{text}" within "#{selector}"}
|
85
|
+
end
|
86
|
+
|
87
|
+
Så /^(?:skal jeg|jeg skal) ikke se \/([^\/]*)\/$/ do |text|
|
88
|
+
Then %{I should not see /#{text}/}
|
89
|
+
end
|
90
|
+
|
91
|
+
Så /^(?:skal jeg|jeg skal) ikke se \/([^\/]*)\/ under "([^\"]*)"$/ do |text, selector|
|
92
|
+
Then %{I should not see /#{text}/ within "#{selector}"}
|
93
|
+
end
|
94
|
+
|
95
|
+
Så /^(?:skal )"([^\"]*)" feltet (?:skal )inneholde "([^\"]*)"$/ do |field, value|
|
96
|
+
Then %{the "#{field}" field should contain "#{value}"}
|
97
|
+
end
|
98
|
+
|
99
|
+
Så /^(?:skal ) "([^\"]*)" feltet (?:skal )ikke inneholde "([^\"]*)"$/ do |field, value|
|
100
|
+
Then %{the "#{field}" field should not contain "#{value}"}
|
101
|
+
end
|
102
|
+
|
103
|
+
Så /^(?:skal ) "([^\"]*)" avkrysningsboksen (?:skal )være krysset av$/ do |label|
|
104
|
+
Then %{the "#{label}" checkbox should be checked"}
|
105
|
+
end
|
106
|
+
|
107
|
+
Så /^(?:skal ) "([^\"]*)" avkrysningsboksen (?:skal )ikke være krysset av$/ do |label|
|
108
|
+
Then %{the "#{label}" checkbox should not be checked"}
|
109
|
+
end
|
110
|
+
|
111
|
+
Så /^(?:skal jeg|jeg skal) komme til (.+)$/ do |page_name|
|
112
|
+
Then %{I should be on #{page_name}}
|
113
|
+
end
|
114
|
+
|
115
|
+
Så /^vil jeg se siden$/ do |page_name|
|
116
|
+
Then %{show me the page}
|
117
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# IMPORTANT: This file was generated.
|
3
|
+
# Edit at your own peril - it's recommended to regenerate this file
|
4
|
+
# in the future when you upgrade to a newer version of Cucumber.
|
5
|
+
# Consider adding your own code to a new file instead of editing this one.
|
6
|
+
|
7
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
8
|
+
|
9
|
+
Dado /^que eu esteja na (.+)$/ do |page_name|
|
10
|
+
Given %{I am on #{page_name}}
|
11
|
+
end
|
12
|
+
|
13
|
+
Quando /^eu vou para (.+)$/ do |page_name|
|
14
|
+
When %{I go to #{page_name}}
|
15
|
+
end
|
16
|
+
|
17
|
+
Quando /^eu aperto "([^\"]*)"$/ do |button|
|
18
|
+
When %{I press "#{button}"}
|
19
|
+
end
|
20
|
+
|
21
|
+
Quando /^eu clico "([^\"]*)"$/ do |link|
|
22
|
+
When %{I follow "#{link}"}
|
23
|
+
end
|
24
|
+
|
25
|
+
Quando /^eu clico "([^\"]*)" dentro de "([^\"]*)"$/ do |link, parent|
|
26
|
+
When %{I follow "#{link}" within "#{parent}"}
|
27
|
+
end
|
28
|
+
|
29
|
+
Quando /^eu preencho "([^\"]*)" com "([^\"]*)"$/ do |field, value|
|
30
|
+
When %{I fill in "#{field}" with "#{value}"}
|
31
|
+
end
|
32
|
+
|
33
|
+
Quando /^eu preencho "([^\"]*)" para "([^\"]*)"$/ do |value, field|
|
34
|
+
When %{I fill in "#{value}" for "#{field}"}
|
35
|
+
end
|
36
|
+
|
37
|
+
Quando /^eu preencho o seguinte:$/ do |fields|
|
38
|
+
When %{I fill in the following:}, fields
|
39
|
+
end
|
40
|
+
|
41
|
+
Quando /^eu seleciono "([^\"]*)" de "([^\"]*)"$/ do |value, field|
|
42
|
+
When %{I select "#{value}" from "#{field}"}
|
43
|
+
end
|
44
|
+
|
45
|
+
Quando /^eu seleciono "([^\"]*)" como a data e a hora$/ do |time|
|
46
|
+
When %{I select "#{time}" as the date and time}
|
47
|
+
end
|
48
|
+
|
49
|
+
Quando /^eu seleciono "([^\"]*)" como a data e a hora "([^\"]*)"$/ do |datetime, datetime_label|
|
50
|
+
When %{I select "#{detetime}" as the "#{datetime_label}" date and time}
|
51
|
+
end
|
52
|
+
|
53
|
+
Quando /^eu seleciono "([^\"]*)" como a hora$/ do |time|
|
54
|
+
When %{I select "#{time}" as the time}
|
55
|
+
end
|
56
|
+
|
57
|
+
Quando /^eu seleciono "([^\"]*)" como a hora "([^\"]*)"$/ do |time, time_label|
|
58
|
+
When %{I select "#{time}" as the "#{time_label}" time}
|
59
|
+
end
|
60
|
+
|
61
|
+
Quando /^eu seleciono "([^\"]*)" como a data$/ do |date|
|
62
|
+
When %{I select "#{date}" as the date}
|
63
|
+
end
|
64
|
+
|
65
|
+
Quando /^eu seleciono "([^\"]*)" como a data "([^\"]*)"$/ do |date, date_label|
|
66
|
+
When %{I select "#{date}" as the "#{date_label}" date}
|
67
|
+
end
|
68
|
+
|
69
|
+
Quando /^eu seleciono "([^\"]*)" como "([^\"]*)"$/ do |date, date_label|
|
70
|
+
When %{I select "#{date}" as the "#{date_label}" date}
|
71
|
+
end
|
72
|
+
|
73
|
+
Quando /^eu marco "([^\"]*)"$/ do |field|
|
74
|
+
When %{I check "#{field}"}
|
75
|
+
end
|
76
|
+
|
77
|
+
Quando /^eu desmarco "([^\"]*)"$/ do |field|
|
78
|
+
When %{I uncheck "#{field}"}
|
79
|
+
end
|
80
|
+
|
81
|
+
Quando /^eu escolho "([^\"]*)"$/ do |field|
|
82
|
+
When %{I choose "#{field}"}
|
83
|
+
end
|
84
|
+
|
85
|
+
Quando /^eu anexo o arquivo em "([^\"]*)" a "([^\"]*)"$/ do |path, field|
|
86
|
+
When %{I attach the file at "#{path}" to "#{field}"}
|
87
|
+
end
|
88
|
+
|
89
|
+
Então /^eu devo ver "([^\"]*)"$/ do |text|
|
90
|
+
Then %{I should see "#{text}"}
|
91
|
+
end
|
92
|
+
|
93
|
+
Então /^eu devo ver "([^\"]*)" dentro de "([^\"]*)"$/ do |text, selector|
|
94
|
+
Then %{I should see "#{text}" within "#{selector}"}
|
95
|
+
end
|
96
|
+
|
97
|
+
Então /^eu devo ver \/([^\/]*)\/$/ do |regexp|
|
98
|
+
Then %{I should see /#{text}/}
|
99
|
+
end
|
100
|
+
|
101
|
+
Então /^eu devo ver \/([^\/]*)\/ dentro de "([^\"]*)"$/ do |regexp, selector|
|
102
|
+
Then %{I should see /#{text}/ within "#{selector}"}
|
103
|
+
end
|
104
|
+
|
105
|
+
Então /^eu não devo ver "([^\"]*)"$/ do |text|
|
106
|
+
Then %{I should not see "#{text}"}
|
107
|
+
end
|
108
|
+
|
109
|
+
Então /^eu não devo ver "([^\"]*)" dentro de "([^\"]*)"$/ do |text, selector|
|
110
|
+
Then %{I should not see "#{text}" within "#{selector}"}
|
111
|
+
end
|
112
|
+
|
113
|
+
Então /^eu não devo ver \/([^\/]*)\/$/ do |regexp|
|
114
|
+
Then %{I should not see /#{text}/}
|
115
|
+
end
|
116
|
+
|
117
|
+
Então /^eu não devo ver \/([^\/]*)\/ dentro de "([^\"]*)"$/ do |regexp, selector|
|
118
|
+
Then %{I should not see /#{text}/ within "#{selector}"}
|
119
|
+
end
|
120
|
+
|
121
|
+
Então /^o campo "([^\"]*)" deve conter "([^\"]*)"$/ do |field, value|
|
122
|
+
Then %{the "#{field}" field should contain "#{value}"}
|
123
|
+
end
|
124
|
+
|
125
|
+
Então /^o campo "([^\"]*)" não deve conter "([^\"]*)"$/ do |field, value|
|
126
|
+
Then %{the "#{field}" field should not contain "#{value}"}
|
127
|
+
end
|
128
|
+
|
129
|
+
Então /^o checkbox "([^\"]*)" deve estar marcado$/ do |label|
|
130
|
+
Then %{the "#{label}" checkbox should be checked"}
|
131
|
+
end
|
132
|
+
|
133
|
+
Então /^o checkbox "([^\"]*)" não deve estar marcado$/ do |label|
|
134
|
+
Then %{the "#{label}" checkbox should not be checked"}
|
135
|
+
end
|
136
|
+
|
137
|
+
Então /^eu devo estar na (.+)$/ do |page_name|
|
138
|
+
Then %{I should be on #{page_name}}
|
139
|
+
end
|
140
|
+
|
141
|
+
Então /^mostre-me a página$/ do
|
142
|
+
Then %{show me the page}
|
143
|
+
end
|
data/generators/cucumber/templates/{webrat_steps/webrat_steps_en.rb → web_steps/webrat_steps.rb}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
# IMPORTANT: This file was generated
|
1
|
+
# IMPORTANT: This file was generated.
|
2
2
|
# Edit at your own peril - it's recommended to regenerate this file
|
3
3
|
# in the future when you upgrade to a newer version of Cucumber.
|
4
4
|
# Consider adding your own code to a new file instead of editing this one.
|
@@ -116,124 +116,140 @@ When /^(?:|I )choose "([^\"]*)"$/ do |field|
|
|
116
116
|
choose(field)
|
117
117
|
end
|
118
118
|
|
119
|
-
|
120
|
-
|
119
|
+
# Adds support for validates_attachment_content_type. Without the mime-type getting
|
120
|
+
# passed to attach_file() you will get a "Photo file is not one of the allowed file types."
|
121
|
+
# error message
|
122
|
+
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
123
|
+
type = path.split(".")[1]
|
124
|
+
|
125
|
+
case type
|
126
|
+
when "jpg"
|
127
|
+
type = "image/jpg"
|
128
|
+
when "jpeg"
|
129
|
+
type = "image/jpeg"
|
130
|
+
when "png"
|
131
|
+
type = "image/png"
|
132
|
+
when "gif"
|
133
|
+
type = "image/gif"
|
134
|
+
end
|
135
|
+
|
136
|
+
attach_file(field, path, type)
|
121
137
|
end
|
122
138
|
|
123
139
|
Then /^(?:|I )should see "([^\"]*)"$/ do |text|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
140
|
+
if defined?(Spec::Rails::Matchers)
|
141
|
+
response.should contain(text)
|
142
|
+
else
|
143
|
+
assert_contain text
|
144
|
+
end
|
129
145
|
end
|
130
146
|
|
131
147
|
Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
132
148
|
within(selector) do |content|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
149
|
+
if defined?(Spec::Rails::Matchers)
|
150
|
+
content.should contain(text)
|
151
|
+
else
|
152
|
+
assert content.include?(text)
|
153
|
+
end
|
138
154
|
end
|
139
155
|
end
|
140
156
|
|
141
157
|
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
142
158
|
regexp = Regexp.new(regexp)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
159
|
+
if defined?(Spec::Rails::Matchers)
|
160
|
+
response.should contain(regexp)
|
161
|
+
else
|
162
|
+
assert_contain regexp
|
163
|
+
end
|
148
164
|
end
|
149
165
|
|
150
166
|
Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
151
167
|
within(selector) do |content|
|
152
168
|
regexp = Regexp.new(regexp)
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
169
|
+
if defined?(Spec::Rails::Matchers)
|
170
|
+
content.should contain(regexp)
|
171
|
+
else
|
172
|
+
assert content =~ regexp
|
173
|
+
end
|
158
174
|
end
|
159
175
|
end
|
160
176
|
|
161
177
|
Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
178
|
+
if defined?(Spec::Rails::Matchers)
|
179
|
+
response.should_not contain(text)
|
180
|
+
else
|
181
|
+
assert_not_contain text
|
182
|
+
end
|
167
183
|
end
|
168
184
|
|
169
185
|
Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
170
186
|
within(selector) do |content|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
187
|
+
if defined?(Spec::Rails::Matchers)
|
188
|
+
content.should_not contain(text)
|
189
|
+
else
|
190
|
+
assert !content.include?(text)
|
191
|
+
end
|
176
192
|
end
|
177
193
|
end
|
178
194
|
|
179
195
|
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
180
196
|
regexp = Regexp.new(regexp)
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
197
|
+
if defined?(Spec::Rails::Matchers)
|
198
|
+
response.should_not contain(regexp)
|
199
|
+
else
|
200
|
+
assert_not_contain regexp
|
201
|
+
end
|
186
202
|
end
|
187
203
|
|
188
204
|
Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
189
205
|
within(selector) do |content|
|
190
206
|
regexp = Regexp.new(regexp)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
207
|
+
if defined?(Spec::Rails::Matchers)
|
208
|
+
content.should_not contain(regexp)
|
209
|
+
else
|
210
|
+
assert content !~ regexp
|
211
|
+
end
|
196
212
|
end
|
197
213
|
end
|
198
214
|
|
199
215
|
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
216
|
+
if defined?(Spec::Rails::Matchers)
|
217
|
+
field_labeled(field).value.should =~ /#{value}/
|
218
|
+
else
|
219
|
+
assert_match(/#{value}/, field_labeled(field).value)
|
220
|
+
end
|
205
221
|
end
|
206
222
|
|
207
223
|
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
224
|
+
if defined?(Spec::Rails::Matchers)
|
225
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
226
|
+
else
|
227
|
+
assert_no_match(/#{value}/, field_labeled(field).value)
|
228
|
+
end
|
213
229
|
end
|
214
230
|
|
215
231
|
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
232
|
+
if defined?(Spec::Rails::Matchers)
|
233
|
+
field_labeled(label).should be_checked
|
234
|
+
else
|
235
|
+
assert field_labeled(label).checked?
|
236
|
+
end
|
221
237
|
end
|
222
238
|
|
223
239
|
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
240
|
+
if defined?(Spec::Rails::Matchers)
|
241
|
+
field_labeled(label).should_not be_checked
|
242
|
+
else
|
243
|
+
assert !field_labeled(label).checked?
|
244
|
+
end
|
229
245
|
end
|
230
246
|
|
231
247
|
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
248
|
+
if defined?(Spec::Rails::Matchers)
|
249
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
250
|
+
else
|
251
|
+
assert_equal path_to(page_name), URI.parse(current_url).path
|
252
|
+
end
|
237
253
|
end
|
238
254
|
|
239
255
|
Then /^show me the page$/ do
|