cucumber-rails 0.3.0 → 0.3.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.
Files changed (35) hide show
  1. data/HACKING.rdoc +7 -17
  2. data/History.txt +30 -0
  3. data/README.rdoc +16 -10
  4. data/Rakefile +2 -2
  5. data/VERSION +1 -1
  6. data/cucumber-rails.gemspec +12 -10
  7. data/features/rails2.feature +51 -8
  8. data/features/rails3.feature +55 -14
  9. data/features/rerun_profile.feature +38 -0
  10. data/features/step_definitions/cucumber_rails_steps.rb +23 -0
  11. data/lib/cucumber/rails/capybara_javascript_emulation.rb +2 -2
  12. data/lib/cucumber/rails/rspec.rb +3 -5
  13. data/lib/cucumber/rails/test_unit.rb +4 -6
  14. data/lib/cucumber/rails/world.rb +1 -1
  15. data/lib/cucumber/web/tableish.rb +50 -9
  16. data/lib/generators/cucumber/skeleton/skeleton_base.rb +4 -4
  17. data/rvm.yml +2 -2
  18. data/spec/cucumber/web/tableish_spec.rb +36 -6
  19. data/templates/feature/feature.erb +10 -12
  20. data/templates/feature/steps.erb +1 -1
  21. data/templates/skeleton/config/cucumber.yml.erb +4 -3
  22. data/templates/skeleton/environments/cucumber.rb.erb +1 -1
  23. data/templates/skeleton/step_definitions/capybara_steps.rb.erb +40 -23
  24. data/templates/skeleton/step_definitions/web_steps_de.rb.erb +33 -33
  25. data/templates/skeleton/step_definitions/web_steps_ja.rb.erb +139 -0
  26. data/templates/skeleton/step_definitions/web_steps_ko.rb.erb +141 -0
  27. data/templates/skeleton/step_definitions/webrat_steps.rb.erb +36 -28
  28. data/templates/skeleton/support/{_rails_each_run.rb → _rails_each_run.rb.erb} +2 -1
  29. data/templates/skeleton/support/_rails_prefork.rb.erb +2 -0
  30. data/templates/skeleton/support/paths.rb +10 -4
  31. data/templates/skeleton/support/rails.rb.erb +1 -1
  32. data/templates/skeleton/support/rails_spork.rb.erb +1 -1
  33. data/templates/skeleton/tasks/cucumber.rake.erb +6 -0
  34. metadata +11 -9
  35. data/generators/cucumber/templates/step_definitions/web_steps_ja.rb.erb +0 -136
@@ -9,6 +9,7 @@
9
9
  # of your scenarios, as this makes it hard to discover errors in your application.
10
10
  ActionController::Base.allow_rescue = false
11
11
 
12
+ <% unless options[:skip_database] -%>
12
13
  # If you set this to true, each scenario will run in a database transaction.
13
14
  # You can still turn off transactions on a per-scenario basis, simply tagging
14
15
  # a feature or scenario with the @no-txn tag. If you are using Capybara,
@@ -22,7 +23,7 @@ ActionController::Base.allow_rescue = false
22
23
  # subsequent scenarios. If you do this, we recommend you create a Before
23
24
  # block that will explicitly put your database in a known state.
24
25
  Cucumber::Rails::World.use_transactional_fixtures = true
25
-
26
+ <% end -%>
26
27
  # How to clean your database when transactions are turned off. See
27
28
  # http://github.com/bmabey/database_cleaner for more info.
28
29
  if defined?(ActiveRecord::Base)
@@ -6,5 +6,7 @@ require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumb
6
6
  require 'cucumber/rails/rspec'
7
7
  <% end -%>
8
8
  require 'cucumber/rails/world'
9
+ <% unless options[:skip_database] -%>
9
10
  require 'cucumber/rails/active_record'
11
+ <% end -%>
10
12
  require 'cucumber/web/tableish'
@@ -7,10 +7,10 @@ module NavigationHelpers
7
7
  #
8
8
  def path_to(page_name)
9
9
  case page_name
10
-
10
+
11
11
  when /the home\s?page/
12
12
  '/'
13
-
13
+
14
14
  # Add more mappings here.
15
15
  # Here is an example that pulls values out of the Regexp:
16
16
  #
@@ -18,8 +18,14 @@ module NavigationHelpers
18
18
  # user_profile_path(User.find_by_login($1))
19
19
 
20
20
  else
21
- raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
22
- "Now, go and add a mapping in #{__FILE__}"
21
+ begin
22
+ page_name =~ /the (.*) page/
23
+ path_components = $1.split(/\s+/)
24
+ self.send(path_components.push('path').join('_').to_sym)
25
+ rescue Object => e
26
+ raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
27
+ "Now, go and add a mapping in #{__FILE__}"
28
+ end
23
29
  end
24
30
  end
25
31
  end
@@ -1,4 +1,4 @@
1
1
  <%= embed_file('support/edit_warning.txt') %>
2
2
  <%= embed_template('support/_rails_prefork.rb.erb') %>
3
3
  <%= embed_file("support/#{driver}.rb") %>
4
- <%= embed_file('support/_rails_each_run.rb') %>
4
+ <%= embed_template('support/_rails_each_run.rb.erb') %>
@@ -9,5 +9,5 @@ Spork.prefork do
9
9
  end
10
10
 
11
11
  Spork.each_run do
12
- <%= embed_file('support/_rails_each_run.rb', ' ') %>
12
+ <%= embed_template('support/_rails_each_run.rb.erb', ' ') %>
13
13
  end
@@ -21,6 +21,12 @@ begin
21
21
  t.profile = 'wip'
22
22
  end
23
23
 
24
+ Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
25
+ t.binary = vendored_cucumber_bin
26
+ t.fork = true # You may get faster startup if you set this to false
27
+ t.profile = 'rerun'
28
+ end
29
+
24
30
  desc 'Run all features'
25
31
  task :all => [:ok, :wip]
26
32
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Dennis Bl\xC3\xB6te"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-02-26 00:00:00 +01:00
19
+ date: 2010-05-04 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -28,9 +28,9 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  segments:
30
30
  - 0
31
- - 6
31
+ - 7
32
32
  - 2
33
- version: 0.6.2
33
+ version: 0.7.2
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -43,8 +43,8 @@ dependencies:
43
43
  segments:
44
44
  - 0
45
45
  - 1
46
- - 5
47
- version: 0.1.5
46
+ - 9
47
+ version: 0.1.9
48
48
  type: :development
49
49
  version_requirements: *id002
50
50
  description: Cucumber Generators and Runtime for Rails
@@ -68,12 +68,12 @@ files:
68
68
  - dev_tasks/rspec.rake
69
69
  - features/rails2.feature
70
70
  - features/rails3.feature
71
+ - features/rerun_profile.feature
71
72
  - features/step_definitions/cucumber_rails_steps.rb
72
73
  - features/support/env.rb
73
74
  - features/support/matchers/files.rb
74
75
  - generators/cucumber/USAGE
75
76
  - generators/cucumber/cucumber_generator.rb
76
- - generators/cucumber/templates/step_definitions/web_steps_ja.rb.erb
77
77
  - generators/feature/USAGE
78
78
  - generators/feature/feature_generator.rb
79
79
  - lib/cucumber/rails/action_controller.rb
@@ -105,10 +105,12 @@ files:
105
105
  - templates/skeleton/step_definitions/web_steps_da.rb.erb
106
106
  - templates/skeleton/step_definitions/web_steps_de.rb.erb
107
107
  - templates/skeleton/step_definitions/web_steps_es.rb.erb
108
+ - templates/skeleton/step_definitions/web_steps_ja.rb.erb
109
+ - templates/skeleton/step_definitions/web_steps_ko.rb.erb
108
110
  - templates/skeleton/step_definitions/web_steps_no.rb.erb
109
111
  - templates/skeleton/step_definitions/web_steps_pt-BR.rb.erb
110
112
  - templates/skeleton/step_definitions/webrat_steps.rb.erb
111
- - templates/skeleton/support/_rails_each_run.rb
113
+ - templates/skeleton/support/_rails_each_run.rb.erb
112
114
  - templates/skeleton/support/_rails_prefork.rb.erb
113
115
  - templates/skeleton/support/capybara.rb
114
116
  - templates/skeleton/support/edit_warning.txt
@@ -1,136 +0,0 @@
1
- # encoding: utf-8
2
- <%= embed_file('support/edit_warning.txt') %>
3
-
4
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
5
-
6
- Given /^"([^\"]*)"ページを表示している$/ do |page_name|
7
- Given %{I am on #{page_name}}
8
- end
9
-
10
- When /^"([^\"]*)"ページを表示する$/ do |page_name|
11
- Given %{I go to #{page_name}}
12
- end
13
-
14
- When /^"([^\"]*)"ボタンをクリックする$/ do |button|
15
- When %{I press "#{button}"}
16
- end
17
-
18
- When /^"([^\"]*)"リンクをクリックする$/ do |link|
19
- When %{I follow "#{link}"}
20
- end
21
-
22
- When /^"([^\"]*)"の"([^\"]*)"リンクをクリックする$/ do |parent, link|
23
- When %{I follow "#{link}" within "#{parent}"}
24
- end
25
-
26
- When /^"([^\"]*)"に"([^\"]*)"と入力する$/ do |field, value|
27
- When %{I fill in "#{field}" with "#{value}"}
28
- end
29
-
30
- When /^以下の項目を入力する:$/ do |fields|
31
- When %{I fill in the following:}, fields
32
- end
33
-
34
- When /^"([^\"]*)"から"([^\"]*)"を選択する$/ do |field, value|
35
- When %{I select "#{value}" from "#{field}"}
36
- end
37
-
38
- When /^日時として"([^\"]*)"を選択する$/ do |time|
39
- When %{I select "#{time}" as the date and time}
40
- end
41
-
42
- When /^"([^\"]*)"の日時として"([^\"]*)"を選択する$/ do |datetime_label, datetime|
43
- When %{I select "#{datetime}" as the "#{datetime_label}" date and time}
44
- end
45
-
46
- When /^時間として"([^\"]*)"を選択する$/ do |time|
47
- When %{I select "#{time}" as the time}
48
- end
49
-
50
- When /^"([^\"]*)"の時間として"([^\"]*)"を選択する$/ do |time_label, time|
51
- When %{I select "#{time}" as the "#{time_label}" time}
52
- end
53
-
54
- When /^日付として"([^\"]*)"を選択する$/ do |date|
55
- When %{I select "#{date}" as the date}
56
- end
57
-
58
- When /^"([^\"]*)"の日付として"([^\"]*)"を選択する$/ do |date_label, date|
59
- When %{I select "#{date}" as the "#{date_label}" date}
60
- end
61
-
62
- When /^"([^\"]*)"をチェックする$/ do |field|
63
- When %{I check "#{field}"}
64
- end
65
-
66
- When /^"([^\"]*)"のチェックを外す$/ do |field|
67
- When %{I uncheck "#{field}"}
68
- end
69
-
70
- When /^"([^\"]*)"を選択する$/ do |field|
71
- When %{I choose "#{field}"}
72
- end
73
-
74
- When /^"([^\"]*)"としてファイル"([^\"]*)"を選択する$/ do |field, path|
75
- When %{I attach the file at "#{path}" to "#{field}"}
76
- end
77
-
78
- Then /^"([^\"]*)"と表示されていること$/ do |text|
79
- Then %{I should see "#{text}"}
80
- end
81
-
82
- Then /^"([^\"]*)"に"([^\"]*)"と表示されていること$/ do |selector, text|
83
- Then %{I should see "#{text}" within "#{selector}"}
84
- end
85
-
86
- Then /^\/([^\/]*)\/と表示されていること$/ do |regexp|
87
- Then %{I should see /#{regexp}/}
88
- end
89
-
90
- Then /^"([^\"]*)"に\/([^\/]*)\/と表示されていること$/ do |selector, regexp|
91
- Then %{I should see \/#{regexp}\/ within "#{selector}"}
92
- end
93
-
94
- Then /^"([^\"]*)"と表示されていないこと$/ do |text|
95
- Then %{I should not see "#{text}"}
96
- end
97
-
98
- Then /^"([^\"]*)"に"([^\"]*)"と表示されていないこと$/ do |selector, text|
99
- Then %{I should not see "#{text}" within "#{selector}"}
100
- end
101
-
102
- Then /^\/([^\/]*)\/と表示されていないこと$/ do |regexp|
103
- Then %{I should not see /#{regexp}/}
104
- end
105
-
106
- Then /^"([^\"]*)"に\/([^\/]*)\/と表示されていないこと$/ do |selector, regexp|
107
- Then %{I should not see \/#{regexp}\/ within "#{selector}"}
108
- end
109
-
110
- Then /^入力項目"([^\"]*)"に"([^\"]*)"と表示されていること$/ do |field, value|
111
- Then %{the "#{field}" field should contain "#{value}"}
112
- end
113
-
114
- Then /^入力項目"([^\"]*)"に"([^\"]*)"と表示されていないこと$/ do |field, value|
115
- Then %{the "#{field}" field should not contain "#{value}"}
116
- end
117
-
118
- Then /^"([^\"]*)"がチェックされていること$/ do |label|
119
- Then %{the "#{label}" checkbox should be checked}
120
- end
121
-
122
- Then /^"([^\"]*)"がチェックされていないこと$/ do |label|
123
- Then %{the "#{label}" checkbox should not be checked}
124
- end
125
-
126
- Then /^"([^\"]*)"ページを表示していること$/ do |page_name|
127
- Then %{I should be on #{page_name}}
128
- end
129
-
130
- show_me_the_page = lambda { Then %{show me the page} }
131
- Then /^ページを表示する$/, &show_me_the_page
132
- Then /^画面を目視$/, &show_me_the_page
133
-
134
- # backword-compat for old japanese translation.
135
- Then /^デバッグ(?:のため)?$/, &show_me_the_page
136
-