david-merb_cucumber 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "merb_cucumber"
8
- GEM_VERSION = "0.4.0"
8
+ GEM_VERSION = "0.4.1"
9
9
  AUTHOR = ["Roman Gonzalez", "David Leal"]
10
10
  EMAIL = ["romanandreg@gmail.com", "dgleal@gmail.com"]
11
11
  HOMEPAGE = "http://github.com/david/merb_cucumber"
@@ -1,9 +1,9 @@
1
1
  Then /^I should see "(.*)"$/ do |text|
2
- response.body.should =~ /#{text}/m
2
+ response.body.to_s.should =~ /#{text}/m
3
3
  end
4
4
 
5
5
  Then /^I should not see "(.*)"$/ do |text|
6
- response.body.should_not =~ /#{text}/m
6
+ response.body.to_s.should_not =~ /#{text}/m
7
7
  end
8
8
 
9
9
  Then /^I should see an? (\w+) message$/ do |message_type|
@@ -13,17 +13,17 @@ module Merb::Generators
13
13
  option :orm, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
14
14
  option :session_type, :default => :simple, :desc => 'Session type to use (one of: simple, webrat)'
15
15
 
16
- template(:env) { |t| t.source = t.destination = "features/env.rb" }
16
+ template(:env) { |t| t.source = t.destination = "features/support/env.rb" }
17
17
  template(:rake) { |t| t.source = t.destination = "lib/tasks/cucumber.rake" }
18
18
  template(:autotest) { |t| t.source = t.destination = "autotest/cucumber_merb_rspec.rb" }
19
- template(:common_result_steps) { |t| t.source = t.destination = "features/steps/common_result_steps.rb" }
19
+ template(:result_steps) { |t| t.source = t.destination = "features/steps/result_steps.rb" }
20
20
 
21
- template(:example_feature, :session_type => :webrat) { |t| t.source = t.destination = "features/login.feature" }
21
+ template(:example_feature, :session_type => :webrat) { |t| t.source = t.destination = "features/authentication/login.feature" }
22
22
  template(:example_feature_steps, :session_type => :webrat) do |t|
23
- t.source = t.destination = "features/steps/login_steps.rb"
23
+ t.source = t.destination = "features/authentication/steps/login_steps.rb"
24
24
  end
25
- template(:common_webrat, :session_type => :webrat) do |t|
26
- t.source = t.destination = "features/steps/common_webrat.rb"
25
+ template(:webrat_steps, :session_type => :webrat) do |t|
26
+ t.source = t.destination = "features/steps/webrat_steps.rb"
27
27
  end
28
28
 
29
29
  template(:cucumber, :after => :chmod) { |t| t.source = t.destination = "bin/cucumber" }
@@ -35,5 +35,4 @@ module Merb::Generators
35
35
  end
36
36
 
37
37
  add :cucumber, CucumberGenerator
38
-
39
- end
38
+ end
@@ -8,21 +8,21 @@ module Merb
8
8
  def use_transactional_fixtures
9
9
  # Let's set a transaction on the ActiveRecord connection when starting a new scenario
10
10
  $main.Before do
11
- if ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
12
- ActiveRecord::Base.connection.increment_open_transactions
11
+ if ::ActiveRecord::Base.connection.respond_to?(:increment_open_transactions)
12
+ ::ActiveRecord::Base.connection.increment_open_transactions
13
13
  else
14
- ActiveRecord::Base.send :increment_open_transactions
14
+ ::ActiveRecord::Base.send :increment_open_transactions
15
15
  end
16
- ActiveRecord::Base.connection.begin_db_transaction
16
+ ::ActiveRecord::Base.connection.begin_db_transaction
17
17
  end
18
18
 
19
19
  # Going with a rollback after every step in the scenario is executed
20
20
  $main.After do
21
- ActiveRecord::Base.connection.rollback_db_transaction
22
- if ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
23
- ActiveRecord::Base.connection.decrement_open_transactions
21
+ ::ActiveRecord::Base.connection.rollback_db_transaction
22
+ if ::ActiveRecord::Base.connection.respond_to?(:decrement_open_transactions)
23
+ ::ActiveRecord::Base.connection.decrement_open_transactions
24
24
  else
25
- ActiveRecord::Base.send :decrement_open_transactions
25
+ ::ActiveRecord::Base.send :decrement_open_transactions
26
26
  end
27
27
  end
28
28
  end
@@ -1,9 +1,10 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'cucumber')
2
3
 
3
4
  describe "common files generator", :shared => true do
4
5
 
5
- it "should generate the features/env.rb file" do
6
- @generator.should create('/tmp/features/env.rb')
6
+ it "should generate the features/support/env.rb file" do
7
+ @generator.should create('/tmp/features/support/env.rb')
7
8
  end
8
9
 
9
10
  it "should generate the bin/cucumber file" do
@@ -14,16 +15,16 @@ describe "common files generator", :shared => true do
14
15
  @generator.should create('/tmp/autotest/cucumber_merb_rspec.rb')
15
16
  end
16
17
 
17
- it "should generate the features/steps/common_result_steps.rb file" do
18
- @generator.should create('/tmp/features/steps/common_result_steps.rb')
18
+ it "should generate the features/steps/result_steps.rb file" do
19
+ @generator.should create('/tmp/features/steps/result_steps.rb')
19
20
  end
20
21
 
21
22
  it "should generate the lib/tasks/cucumber.rake" do
22
- @generator.should create('/tmp/features/steps/common_result_steps.rb')
23
+ @generator.should create('/tmp/lib/tasks/cucumber.rake')
23
24
  end
24
25
 
25
26
  it "should render templates successfully" do
26
- lambda { @generator.render! }.should_not raise_error
27
+ @generator.render!
27
28
  end
28
29
 
29
30
 
@@ -41,7 +42,6 @@ describe Merb::Generators::CucumberGenerator do
41
42
 
42
43
  it "should have a requirement to the datamapper helper" do
43
44
  @generator.render!
44
- # IO.read(@generator.template(:env).destination).should =~ %r[merb_cucumber/helpers/datamapper]
45
45
  end
46
46
 
47
47
  end
@@ -56,7 +56,6 @@ describe Merb::Generators::CucumberGenerator do
56
56
 
57
57
  it "should have a requirement to the activerecord helper" do
58
58
  @generator.render!
59
- # IO.read(@generator.template(:env).destination).should =~ %r[merb_cucumber/helpers/activerecord]
60
59
  end
61
60
 
62
61
  end
@@ -69,18 +68,19 @@ describe Merb::Generators::CucumberGenerator do
69
68
 
70
69
  it_should_behave_like "common files generator"
71
70
 
72
- it "should not generate the features/login.feature file" do
73
- @generator.should_not create('/tmp/features/login.feature')
71
+ it "should not generate the features/authentication/login.feature file" do
72
+ @generator.should_not create('/tmp/features/authentication/login.feature')
74
73
  end
75
74
 
76
- it "should not generate the features/steps/common_webrat.rb file" do
77
- @generator.should_not create('/tmp/features/steps/common_webrat.rb')
75
+ it "should not generate the features/authentication/steps/login_steps.rb file" do
76
+ @generator.should_not create('/tmp/features/authentication/steps/login_steps.rb')
78
77
  end
79
78
 
80
- it "should have a requirement to the simple session type on the env.rb file" do
81
- @generator.render!
82
- # IO.read(@generator.template(:env).destination).should =~ %r[merb_cucumber/world/webrat]
79
+ it "should not generate the features/steps/webrat_steps.rb file" do
80
+ @generator.should_not create('/tmp/features/steps/webrat_steps.rb')
83
81
  end
82
+
83
+ it "should have a requirement to the simple session type on the env.rb file"
84
84
 
85
85
  end
86
86
 
@@ -92,19 +92,18 @@ describe Merb::Generators::CucumberGenerator do
92
92
 
93
93
  it_should_behave_like "common files generator"
94
94
 
95
- it "should generate the features/login.feature file" do
96
- @generator.should create('/tmp/features/login.feature')
95
+ it "should generate the features/authentication/login.feature file" do
96
+ @generator.should create('/tmp/features/authentication/login.feature')
97
97
  end
98
98
 
99
- it "should generate the features/steps/common_webrat.rb file" do
100
- @generator.should create('/tmp/features/steps/common_webrat.rb')
99
+ it "should generate the features/authentication/steps/login_steps.rb file" do
100
+ @generator.should create('/tmp/features/authentication/steps/login_steps.rb')
101
101
  end
102
102
 
103
- it "should have a requirement to the webrat session type on the env.rb file" do
104
- @generator.render!
105
- # IO.read(@generator.template(:env).destination).should =~ %r[merb_cucumber/world/webrat]
103
+ it "should generate the features/steps/webrat_steps.rb file" do
104
+ @generator.should create('/tmp/features/steps/webrat_steps.rb')
106
105
  end
107
106
 
107
+ it "should have a requirement to the webrat session type on the env.rb file"
108
108
  end
109
-
110
109
  end
@@ -1,5 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
-
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'generators', 'feature')
3
3
 
4
4
  def underscored_file_name(name)
5
5
  name.gsub(/\s+/, "_")
@@ -59,4 +59,4 @@ describe Merb::Generators::CucumberFeatureGenerator, "#render!" do
59
59
  @generator.should create("/tmp/features/steps/#{underscored_file_name(@name)}_steps.rb")
60
60
  end
61
61
  end
62
- end
62
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,11 @@
1
- $:.push File.join(File.dirname(__FILE__), '..', 'lib')
2
-
3
1
  require 'rubygems'
4
2
  require 'spec'
5
- require 'merb-core'
6
3
  require 'merb-gen'
7
4
 
5
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+
8
7
  require 'templater/spec/helpers'
9
8
 
10
- __dir__ = File.dirname(__FILE__)
11
- require File.join(__dir__, "..", "lib", "generators", "cucumber")
12
- require File.join(__dir__, "..", "lib", "generators", "feature")
13
9
  Merb.disable(:initfile)
14
10
 
15
11
  Spec::Runner.configure do |config|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: david-merb_cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Gonzalez
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-11-23 00:00:00 -08:00
13
+ date: 2008-12-17 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -54,11 +54,12 @@ files:
54
54
  - lib/generators/cucumber
55
55
  - lib/generators/cucumber/templates
56
56
  - lib/generators/cucumber/templates/features
57
+ - lib/generators/cucumber/templates/features/support
58
+ - lib/generators/cucumber/templates/features/support/env.rb
57
59
  - lib/generators/cucumber/templates/features/steps
58
- - lib/generators/cucumber/templates/features/steps/common_webrat.rb
59
- - lib/generators/cucumber/templates/features/steps/common_result_steps.rb
60
+ - lib/generators/cucumber/templates/features/steps/webrat_steps.rb
61
+ - lib/generators/cucumber/templates/features/steps/result_steps.rb
60
62
  - lib/generators/cucumber/templates/features/steps/login_steps.rb
61
- - lib/generators/cucumber/templates/features/env.rb
62
63
  - lib/generators/cucumber/templates/features/login.feature
63
64
  - lib/generators/cucumber/templates/autotest
64
65
  - lib/generators/cucumber/templates/autotest/cucumber_merb_rspec.rb
@@ -1,13 +0,0 @@
1
- Feature: Login
2
- To ensure the safety of the application
3
- A regular user of the system
4
- Must authenticate before using the app
5
-
6
- Scenario: Failed Login
7
- Given I am not authenticated
8
- When I go to /login
9
- And I fill in "login" with "i_dont_exist"
10
- And I fill in "password" with "and_i_dont_have_a_password"
11
- And I press "Log In"
12
- Then the login request should fail
13
- Then I should see an error message
@@ -1,3 +0,0 @@
1
- Given /^I am not authenticated$/ do
2
- # yay!
3
- end