cucumber-rails 0.3.2 → 0.4.0.beta.1
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.
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +2 -0
- data/History.txt +7 -0
- data/README.rdoc +2 -2
- data/Rakefile +3 -19
- data/cucumber-rails.gemspec +25 -106
- data/dev_tasks/rspec.rake +6 -11
- data/features/rails2.feature +5 -24
- data/features/rails3.feature +82 -56
- data/features/step_definitions/cucumber_rails_steps.rb +3 -25
- data/features/support/env.rb +3 -1
- data/generators/cucumber/cucumber_generator.rb +1 -17
- data/lib/cucumber/rails.rb +29 -0
- data/lib/cucumber/rails/capybara/javascript_emulation.rb +83 -0
- data/lib/cucumber/rails/capybara/select_dates_and_times.rb +43 -0
- data/lib/cucumber/rails/hooks/allow_rescue.rb +8 -0
- data/lib/cucumber/rails/hooks/database_cleaner.rb +25 -0
- data/lib/cucumber/rails/hooks/mail.rb +5 -0
- data/lib/cucumber/rails/rspec.rb +0 -3
- data/lib/cucumber/rails/version.rb +15 -0
- data/lib/cucumber/rails/world.rb +2 -36
- data/lib/cucumber/rails2.rb +16 -0
- data/lib/cucumber/rails2/action_controller.rb +29 -0
- data/lib/cucumber/rails3.rb +16 -0
- data/lib/cucumber/rails3/action_controller.rb +12 -0
- data/lib/cucumber/rails3/application.rb +17 -0
- data/lib/generators/cucumber/feature/feature_generator.rb +1 -1
- data/lib/generators/cucumber/install/install_base.rb +40 -53
- data/lib/generators/cucumber/install/install_generator.rb +10 -22
- data/spec/cucumber/web/tableish_spec.rb +47 -0
- data/spec/generators/cucumber/install/install_base_spec.rb +0 -9
- data/spec/spec_helper.rb +1 -4
- data/templates/install/step_definitions/capybara_steps.rb.erb +1 -1
- data/templates/install/step_definitions/web_steps_da.rb.erb +1 -1
- data/templates/install/step_definitions/web_steps_no.rb.erb +1 -1
- data/templates/install/step_definitions/web_steps_pt-BR.rb.erb +2 -1
- data/templates/install/support/_rails_each_run.rb.erb +16 -15
- data/templates/install/support/_rails_prefork.rb.erb +1 -12
- data/templates/install/support/capybara.rb +0 -4
- metadata +137 -30
- data/lib/cucumber/rails/action_controller.rb +0 -65
- data/lib/cucumber/rails/active_record.rb +0 -34
- data/lib/cucumber/rails/capybara_javascript_emulation.rb +0 -72
- data/lib/cucumber/rails/test_unit.rb +0 -7
- data/spec/spec.opts +0 -2
@@ -1,12 +1,10 @@
|
|
1
|
+
require 'rbconfig'
|
1
2
|
require File.join(File.dirname(__FILE__), 'install_base')
|
2
3
|
|
3
4
|
module Cucumber
|
4
|
-
class InstallGenerator < Rails::Generators::Base
|
5
|
-
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
6
|
include Cucumber::Generators::InstallBase
|
7
7
|
|
8
|
-
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
9
|
-
|
10
8
|
argument :language, :type => :string, :banner => "LANG", :optional => true
|
11
9
|
|
12
10
|
class_option :webrat, :type => :boolean, :desc => "Use Webrat"
|
@@ -25,13 +23,7 @@ module Cucumber
|
|
25
23
|
end
|
26
24
|
|
27
25
|
def generate
|
28
|
-
|
29
|
-
create_templates
|
30
|
-
create_scripts
|
31
|
-
create_step_definitions
|
32
|
-
create_feature_support
|
33
|
-
create_tasks
|
34
|
-
create_database unless options[:skip_database]
|
26
|
+
install_cucumber_rails(self)
|
35
27
|
end
|
36
28
|
|
37
29
|
def self.gem_root
|
@@ -42,22 +34,18 @@ module Cucumber
|
|
42
34
|
File.join(gem_root, 'templates/install')
|
43
35
|
end
|
44
36
|
|
45
|
-
def cucumber_rails_env
|
46
|
-
'test'
|
47
|
-
end
|
48
|
-
|
49
37
|
private
|
50
|
-
|
38
|
+
|
51
39
|
def framework_from_options
|
52
|
-
return
|
53
|
-
return
|
54
|
-
return
|
40
|
+
return 'rspec-rails' if options[:rspec]
|
41
|
+
return 'testunit' if options[:testunit]
|
42
|
+
return 'rspec-rails'
|
55
43
|
end
|
56
44
|
|
57
45
|
def driver_from_options
|
58
|
-
return
|
59
|
-
return
|
60
|
-
return
|
46
|
+
return 'webrat' if options[:webrat]
|
47
|
+
return 'capybara' if options[:capybara]
|
48
|
+
return 'capybara'
|
61
49
|
end
|
62
50
|
|
63
51
|
end
|
@@ -11,6 +11,53 @@ module Cucumber
|
|
11
11
|
include Tableish
|
12
12
|
|
13
13
|
unless RUBY_PLATFORM =~ /java/
|
14
|
+
it "should convert a table" do
|
15
|
+
html = <<-HTML
|
16
|
+
<div class="admin-table">
|
17
|
+
<table>
|
18
|
+
<thead>
|
19
|
+
<tr>
|
20
|
+
<th>Name</th>
|
21
|
+
<th><span>Edit</span></th>
|
22
|
+
<th><span>Delete</span></th>
|
23
|
+
</tr>
|
24
|
+
</thead>
|
25
|
+
<tbody>
|
26
|
+
<tr>
|
27
|
+
<td><strong>Guybrush Threepwood</strong></td>
|
28
|
+
<td><a href="/users/1/edit">Edit</a></td>
|
29
|
+
<td>
|
30
|
+
<form method="post" action="/users/1" class="button-to">
|
31
|
+
<div>
|
32
|
+
<input type="hidden" name="_method" value="delete" />
|
33
|
+
<input value="Delete" type="submit" />
|
34
|
+
</div>
|
35
|
+
</form>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
</tbody>
|
39
|
+
</table>
|
40
|
+
</div>
|
41
|
+
HTML
|
42
|
+
|
43
|
+
header = _tableish(html, '.admin-table table thead tr', 'th')
|
44
|
+
|
45
|
+
column_selector = lambda do |tr|
|
46
|
+
tds = tr.search('td')
|
47
|
+
[
|
48
|
+
tds[0].text,
|
49
|
+
tds[1].text,
|
50
|
+
tds[2].css('input:nth-child(2)').first.attributes['value']
|
51
|
+
]
|
52
|
+
end
|
53
|
+
body = _tableish(html, '.admin-table table tbody tr', column_selector)
|
54
|
+
|
55
|
+
(header + body).should == [
|
56
|
+
['Name', 'Edit', 'Delete'],
|
57
|
+
['Guybrush Threepwood', 'Edit', 'Delete']
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
14
61
|
it "should convert a table" do
|
15
62
|
html = <<-HTML
|
16
63
|
<table id="tools">
|
@@ -1,12 +1,3 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
|
2
|
-
|
3
|
-
# TODO using this seam as an interim way to get the file to load
|
4
|
-
module Config
|
5
|
-
CONFIG = {
|
6
|
-
'bindir' => 'foo',
|
7
|
-
'ruby_install_name' => 'bar'
|
8
|
-
}
|
9
|
-
end
|
10
1
|
require 'generators/cucumber/install/install_base'
|
11
2
|
|
12
3
|
module Cucumber
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
5
5
|
|
6
|
-
Dado /^que eu
|
6
|
+
Dado /^que eu estou na (.+)$/ do |page_name|
|
7
7
|
Given %{I am on #{page_name}}
|
8
8
|
end
|
9
9
|
|
@@ -138,3 +138,4 @@ end
|
|
138
138
|
Então /^mostre-me a página$/ do
|
139
139
|
Then %{show me the page}
|
140
140
|
end
|
141
|
+
|
@@ -1,12 +1,18 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
1
|
+
# By default, any exception happening in your Rails application will bubble up
|
2
|
+
# to Cucumber so that your scenario will fail. This is a different from how
|
3
|
+
# your application behaves in the production environment, where an error page will
|
4
|
+
# be rendered instead.
|
5
|
+
#
|
6
|
+
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
7
|
+
# exceptions and display an error page (just like when the app is running in production).
|
8
|
+
# Typical scenarios where you want to do this is when you test your error pages.
|
9
|
+
# There are two ways to allow Rails to rescue exceptions:
|
10
|
+
#
|
11
|
+
# 1) Tag your scenario (or feature) with @allow-rescue
|
12
|
+
#
|
13
|
+
# 2) Set the value below to true. Beware that doing this globally is not
|
14
|
+
# recommended as it will mask a lot of errors for you!
|
5
15
|
#
|
6
|
-
# If you set this to true, Rails will rescue all errors and render error
|
7
|
-
# pages, more or less in the same way your application would behave in the
|
8
|
-
# default production environment. It's not recommended to do this for all
|
9
|
-
# of your scenarios, as this makes it hard to discover errors in your application.
|
10
16
|
ActionController::Base.allow_rescue = false
|
11
17
|
|
12
18
|
<% unless options[:skip_database] -%>
|
@@ -23,13 +29,8 @@ ActionController::Base.allow_rescue = false
|
|
23
29
|
# subsequent scenarios. If you do this, we recommend you create a Before
|
24
30
|
# block that will explicitly put your database in a known state.
|
25
31
|
Cucumber::Rails::World.use_transactional_fixtures = true
|
32
|
+
|
26
33
|
<% end -%>
|
27
34
|
# How to clean your database when transactions are turned off. See
|
28
35
|
# http://github.com/bmabey/database_cleaner for more info.
|
29
|
-
|
30
|
-
begin
|
31
|
-
require 'database_cleaner'
|
32
|
-
DatabaseCleaner.strategy = :truncation
|
33
|
-
rescue LoadError => ignore_if_database_cleaner_not_present
|
34
|
-
end
|
35
|
-
end
|
36
|
+
# DatabaseCleaner.strategy = :truncation
|
@@ -1,12 +1 @@
|
|
1
|
-
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
3
|
-
|
4
|
-
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
5
|
-
<% if framework == :rspec -%>
|
6
|
-
require 'cucumber/rails/rspec'
|
7
|
-
<% end -%>
|
8
|
-
require 'cucumber/rails/world'
|
9
|
-
<% unless options[:skip_database] -%>
|
10
|
-
require 'cucumber/rails/active_record'
|
11
|
-
<% end -%>
|
12
|
-
require 'cucumber/web/tableish'
|
1
|
+
require 'cucumber/rails'
|
@@ -1,7 +1,3 @@
|
|
1
|
-
require 'capybara/rails'
|
2
|
-
require 'capybara/cucumber'
|
3
|
-
require 'capybara/session'
|
4
|
-
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
|
5
1
|
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
6
2
|
# order to ease the transition to Capybara we set the default here. If you'd
|
7
3
|
# prefer to use XPath just remove this line and adjust any selectors in your
|
metadata
CHANGED
@@ -1,57 +1,146 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
4
|
+
prerelease: true
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
- beta
|
10
|
+
- 1
|
11
|
+
version: 0.4.0.beta.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
|
-
- "Dennis Bl\xC3\xB6te"
|
14
14
|
- "Aslak Helles\xC3\xB8y"
|
15
|
+
- "Dennis Bl\xC3\xB6te"
|
15
16
|
- Rob Holland
|
16
17
|
autorequire:
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
20
|
|
20
|
-
date: 2010-
|
21
|
+
date: 2010-12-09 00:00:00 +00:00
|
21
22
|
default_executable:
|
22
23
|
dependencies:
|
23
24
|
- !ruby/object:Gem::Dependency
|
24
25
|
name: cucumber
|
25
|
-
prerelease: false
|
26
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
27
|
none: false
|
28
28
|
requirements:
|
29
|
-
- -
|
29
|
+
- - ~>
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
hash: 63
|
32
31
|
segments:
|
33
32
|
- 0
|
34
|
-
-
|
33
|
+
- 10
|
35
34
|
- 0
|
36
|
-
version: 0.
|
35
|
+
version: 0.10.0
|
37
36
|
type: :runtime
|
37
|
+
prerelease: false
|
38
38
|
version_requirements: *id001
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: aruba
|
41
|
-
prerelease: false
|
42
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
43
42
|
none: false
|
44
43
|
requirements:
|
45
|
-
- -
|
44
|
+
- - ~>
|
46
45
|
- !ruby/object:Gem::Version
|
47
|
-
hash: 9
|
48
46
|
segments:
|
49
47
|
- 0
|
50
|
-
-
|
51
|
-
-
|
52
|
-
version: 0.
|
48
|
+
- 2
|
49
|
+
- 7
|
50
|
+
version: 0.2.7
|
53
51
|
type: :development
|
52
|
+
prerelease: false
|
54
53
|
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rails
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 3
|
63
|
+
- 0
|
64
|
+
- 3
|
65
|
+
version: 3.0.3
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3-ruby
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
segments:
|
77
|
+
- 1
|
78
|
+
- 3
|
79
|
+
- 2
|
80
|
+
version: 1.3.2
|
81
|
+
type: :development
|
82
|
+
prerelease: false
|
83
|
+
version_requirements: *id004
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rspec-rails
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ~>
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
segments:
|
92
|
+
- 2
|
93
|
+
- 2
|
94
|
+
- 0
|
95
|
+
version: 2.2.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: *id005
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: capybara
|
101
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ~>
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
- 4
|
109
|
+
- 0
|
110
|
+
version: 0.4.0
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *id006
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: webrat
|
116
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ~>
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
- 7
|
124
|
+
- 2
|
125
|
+
version: 0.7.2
|
126
|
+
type: :development
|
127
|
+
prerelease: false
|
128
|
+
version_requirements: *id007
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: database_cleaner
|
131
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ~>
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
segments:
|
137
|
+
- 0
|
138
|
+
- 6
|
139
|
+
- 0
|
140
|
+
version: 0.6.0
|
141
|
+
type: :development
|
142
|
+
prerelease: false
|
143
|
+
version_requirements: *id008
|
55
144
|
description: Cucumber Generators and Runtime for Rails
|
56
145
|
email: cukes@googlegroups.com
|
57
146
|
executables: []
|
@@ -61,8 +150,12 @@ extensions: []
|
|
61
150
|
extra_rdoc_files:
|
62
151
|
- LICENSE
|
63
152
|
- README.rdoc
|
153
|
+
- History.txt
|
64
154
|
files:
|
65
155
|
- .gitignore
|
156
|
+
- .rspec
|
157
|
+
- .rvmrc
|
158
|
+
- Gemfile
|
66
159
|
- HACKING.rdoc
|
67
160
|
- History.txt
|
68
161
|
- LICENSE
|
@@ -83,12 +176,20 @@ files:
|
|
83
176
|
- generators/cucumber/cucumber_generator.rb
|
84
177
|
- generators/feature/USAGE
|
85
178
|
- generators/feature/feature_generator.rb
|
86
|
-
- lib/cucumber/rails
|
87
|
-
- lib/cucumber/rails/
|
88
|
-
- lib/cucumber/rails/
|
179
|
+
- lib/cucumber/rails.rb
|
180
|
+
- lib/cucumber/rails/capybara/javascript_emulation.rb
|
181
|
+
- lib/cucumber/rails/capybara/select_dates_and_times.rb
|
182
|
+
- lib/cucumber/rails/hooks/allow_rescue.rb
|
183
|
+
- lib/cucumber/rails/hooks/database_cleaner.rb
|
184
|
+
- lib/cucumber/rails/hooks/mail.rb
|
89
185
|
- lib/cucumber/rails/rspec.rb
|
90
|
-
- lib/cucumber/rails/
|
186
|
+
- lib/cucumber/rails/version.rb
|
91
187
|
- lib/cucumber/rails/world.rb
|
188
|
+
- lib/cucumber/rails2.rb
|
189
|
+
- lib/cucumber/rails2/action_controller.rb
|
190
|
+
- lib/cucumber/rails3.rb
|
191
|
+
- lib/cucumber/rails3/action_controller.rb
|
192
|
+
- lib/cucumber/rails3/application.rb
|
92
193
|
- lib/cucumber/web/tableish.rb
|
93
194
|
- lib/generators/cucumber/feature/USAGE
|
94
195
|
- lib/generators/cucumber/feature/feature_base.rb
|
@@ -99,7 +200,6 @@ files:
|
|
99
200
|
- lib/generators/cucumber/install/install_generator.rb
|
100
201
|
- spec/cucumber/web/tableish_spec.rb
|
101
202
|
- spec/generators/cucumber/install/install_base_spec.rb
|
102
|
-
- spec/spec.opts
|
103
203
|
- spec/spec_helper.rb
|
104
204
|
- templates/feature/feature.erb
|
105
205
|
- templates/feature/steps.erb
|
@@ -126,7 +226,7 @@ files:
|
|
126
226
|
- templates/install/support/webrat.rb
|
127
227
|
- templates/install/tasks/cucumber.rake.erb
|
128
228
|
has_rdoc: true
|
129
|
-
homepage: http://
|
229
|
+
homepage: http://cukes.info
|
130
230
|
licenses: []
|
131
231
|
|
132
232
|
post_install_message:
|
@@ -139,27 +239,34 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
239
|
requirements:
|
140
240
|
- - ">="
|
141
241
|
- !ruby/object:Gem::Version
|
142
|
-
hash:
|
242
|
+
hash: 1549397738381464085
|
143
243
|
segments:
|
144
244
|
- 0
|
145
245
|
version: "0"
|
146
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
247
|
none: false
|
148
248
|
requirements:
|
149
|
-
- - "
|
249
|
+
- - ">"
|
150
250
|
- !ruby/object:Gem::Version
|
151
|
-
hash: 3
|
152
251
|
segments:
|
153
|
-
-
|
154
|
-
|
252
|
+
- 1
|
253
|
+
- 3
|
254
|
+
- 1
|
255
|
+
version: 1.3.1
|
155
256
|
requirements: []
|
156
257
|
|
157
258
|
rubyforge_project:
|
158
259
|
rubygems_version: 1.3.7
|
159
260
|
signing_key:
|
160
261
|
specification_version: 3
|
161
|
-
summary:
|
262
|
+
summary: cucumber-rails-0.4.0.beta.1
|
162
263
|
test_files:
|
264
|
+
- features/rails2.feature
|
265
|
+
- features/rails3.feature
|
266
|
+
- features/rerun_profile.feature
|
267
|
+
- features/step_definitions/cucumber_rails_steps.rb
|
268
|
+
- features/support/env.rb
|
269
|
+
- features/support/matchers/files.rb
|
163
270
|
- spec/cucumber/web/tableish_spec.rb
|
164
271
|
- spec/generators/cucumber/install/install_base_spec.rb
|
165
272
|
- spec/spec_helper.rb
|