Permalink
Browse files

Adding fixes to the env template, also some code beautification

  • Loading branch information...
1 parent bcbb4a1 commit 43230718757554ef7eb12cd3110f8565971288e0 Roman Gonzalez committed Oct 24, 2008
Showing with 6 additions and 17 deletions.
  1. +3 −14 lib/generators/cucumber.rb
  2. +3 −3 lib/generators/cucumber/templates/features/env.rb
@@ -11,24 +11,13 @@ def self.source_root
end
option :orm, :desc => 'Object-Relation Mapper to use (one of: none, activerecord, datamapper, sequel)'
-
option :session_type, :default => :simple, :desc => 'Session type to use (one of: simple, webrat)'
template(:env) { |t| t.source = t.destination = "features/env.rb" }
template(:common_result_steps) { |t| t.source = t.destination = "features/steps/common_result_steps.rb" }
-
- template(:example_feature, :session_type => :webrat) do |t|
- t.source = t.destination = "features/login.feature"
- end
-
- template(:example_feature_steps, :session_type => :webrat) do |t|
- t.source = t.destination = "features/steps/login_steps.rb"
- end
-
- template(:common_webrat, :session_type => :webrat) do |t|
- t.source = t.destination = "features/steps/common_webrat.rb"
- end
-
+ template(:example_feature, :session_type => :webrat) { |t| t.source = t.destination = "features/login.feature" }
+ template(:example_feature_steps, :session_type => :webrat) { |t| t.source = t.destination = "features/steps/login_steps.rb" }
+ template(:common_webrat, :session_type => :webrat) { |t| t.source = t.destination = "features/steps/common_webrat.rb"}
template(:cucumber, :after => :chmod) { |t| t.source = t.destination = "bin/cucumber" }
def chmod(action)
@@ -9,13 +9,13 @@
require "merb-core"
require "spec"
-<% if session_type == :webrat -%>
+<% if options[:session_type] == :webrat -%>
require "webrat"
<% end -%>
require "merb_cucumber/world/<%= session_type %>"
-<% if Merb.orm == :datamapper -%>
+<% if (options[:orm] || Merb.orm) == :datamapper -%>
require "merb_cucumber/helpers/datamapper"
-<% elsif Merb.orm == :activerecord -%>
+<% elsif (options[:orm] || Merb.orm) == :activerecord -%>
require "merb_cucumber/helpers/activerecord"
<% end -%>

0 comments on commit 4323071

Please sign in to comment.