Permalink
Browse files

Temporarily disable generation of all but model and request specs

  • Loading branch information...
1 parent 35e3e6c commit d5f2e475dc0d8fe5a18ea05cc1c383f86a7c49a4 @dchelimsky dchelimsky committed Feb 7, 2010
View
@@ -7,9 +7,10 @@
run('bundle install')
run('script/rails g rspec:install')
-run('script/rails g model thing name:string')
-run('script/rails g controller widgets index')
-run('script/rails g integration_test widgets')
+# run('script/rails g model thing name:string')
+run('script/rails g scaffold wombats name:string')
+# run('script/rails g controller widgets index')
+# run('script/rails g integration_test widgets')
run('rake db:migrate')
run('rake db:test:prepare')
@@ -6,14 +6,19 @@ class ControllerGenerator < Base
argument :actions, :type => :array, :default => [], :banner => "action action"
class_option :template_engine, :desc => "Template engine to generate view files"
- class_option :views, :type => :boolean, :default => false
+ class_option :controllers, :type => :boolean, :default => false
+ class_option :views, :type => :boolean, :default => false
def create_controller_files
+ return unless options[:controllers]
+
template 'controller_spec.rb',
File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb")
end
def create_view_files
+ return unless options[:views]
+
empty_directory File.join("spec", "views", file_path)
actions.each do |action|
@@ -1,8 +1,12 @@
<%= app_name %>.configure do
+ # We're still in alpha, so we're only generating model specs
+ # and request (integration) specs. We'll change these defaults
+ # as we add support for controller specs, etc.
config.generators do |g|
g.integration_tool :rspec
g.test_framework :rspec,
:fixture => false,
+ :controllers => false,
:views => false,
:routes => false,
:integration => true
@@ -11,10 +11,13 @@ class ScaffoldGenerator < Base
class_option :template_engine, :desc => "Template engine to generate view files"
class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
- class_option :views, :type => :boolean, :default => false
- class_option :routes, :type => :boolean, :default => false
+ class_option :controllers, :type => :boolean, :default => false
+ class_option :views, :type => :boolean, :default => false
+ class_option :routes, :type => :boolean, :default => false
def copy_controller_files
+ return unless options[:controllers]
+
template 'controller_spec.rb',
File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
end
@@ -80,7 +83,7 @@ def mock_file_name(hash=nil)
# should! orm_class.find(User, "37")
# #=> User.should_receive(:get).with(37)
#
- def should!(chain)
+ def should_receive!(chain)
stub_or_should_chain(:should_receive, chain)
end
@@ -95,7 +98,7 @@ def should!(chain)
# #=> User.stub!(:get).with(37)
#
def stub!(chain)
- stub_or_should_chain(:stub!, chain)
+ stub_or_should_chain(:stub, chain)
end
def stub_or_should_chain(mode, chain)
@@ -18,14 +18,14 @@ def app
%w[get post put delete head].map do |method|
eval <<-CODE
- def #{method}(action)
- @_action = action
+ def #{method}(*args)
+ @_action = args.shift
super '/'
end
CODE
end
Rspec::Core.configure do |c|
- c.include self, :behaviour => { :describes => lambda {|c| c < ::ActionController::Base} }
+ c.include self, :example_group => { :file_path => /\/spec\/controllers\// }
end
end
@@ -21,6 +21,6 @@ def last_response
end
Rspec::Core.configure do |c|
- c.include self, :behaviour => { :describes => /^\// }
+ c.include self, :example_group => { :file_path => /\/spec\/requests\// }
end
end

0 comments on commit d5f2e47

Please sign in to comment.