diff --git a/README.markdown b/README.markdown index 14c4a6e..616bf2b 100644 --- a/README.markdown +++ b/README.markdown @@ -21,7 +21,7 @@ This will create a Rails 2.3.2 app with Heroku-recommended code: * Clearance for authentication * Cucumber, Shoulda, Factory Girl, & Mocha for testing * Evergreen for CSS framework -* Coulda for features, model, controller, & helper generators +* Blitz for features, model, controller, & helper generators If you don't have all the necessary gems, they will be installed. diff --git a/doc/README_FOR_TEMPLATE b/doc/README_FOR_TEMPLATE index 5d6169c..ef5b211 100644 --- a/doc/README_FOR_TEMPLATE +++ b/doc/README_FOR_TEMPLATE @@ -57,7 +57,7 @@ For exception notification: For models, controllers, helpers, & features generators: - coulda + blitz For rake tasks: @@ -89,7 +89,7 @@ Two time formats are available by default, :short_date and :long_date. Add other Testing ------- -Testing is done utilizing Test::Unit, Shoulda, factory_girl, and mocha. +Testing is done utilizing Cucumber, Test::Unit, Shoulda, Factory Girl, and Mocha. Shoulda is a pragmatic testing framework for TDD built on top of Test::Unit. @@ -121,8 +121,8 @@ It imports the Stylus framework: @import url("framework/reset.css"); @import url("framework/typography.css"); - @import url("framework/layout.css"); - @import url("framework/forms.css"); + @import url("framework/grid.css"); + @import url("framework/spacing.css"); Add another import for your own styles, by convention named after your app. diff --git a/vendor/plugins/blitz/CHANGELOG.textile b/vendor/plugins/blitz/CHANGELOG.textile new file mode 100644 index 0000000..efe4da3 --- /dev/null +++ b/vendor/plugins/blitz/CHANGELOG.textile @@ -0,0 +1,9 @@ +h1. March 8, 2009 + +* Updated functional tests to use shoulda 2.10 should_redirect_to block syntax + +h1. March 7, 2009 + +* Added Paperclip option to model generator +* Removed comments on model per complaints by thoughtbot + diff --git a/vendor/plugins/blitz/README.textile b/vendor/plugins/blitz/README.textile new file mode 100644 index 0000000..dfb4a3f --- /dev/null +++ b/vendor/plugins/blitz/README.textile @@ -0,0 +1,174 @@ +h1. Blitz generators + +A Rails plugin for feature, view, controller, model, & helper generators. It is meant to be used as part of an "Outside-In" Test-Driven Development cycle. + +h2. Generated code may contain + +* "Cucumber":http://github.com/aslakhellesoy/cucumber +* "Shoulda":http://github.com/thoughtbot/shoulda +* "Factory Girl":http://github.com/thoughtbot/factory_girl +* "Mocha":http://github.com/jferris/mocha + +h2. Installation + + $ script/plugin install git://github.com/dancroak/blitz.git + +h2. Feature generator + + $ script/generate feature Posts new create + +generates... + +
Scenario: Create a new post
+ Given I am on the new post page
+ When I create a 'post' named 'A new post'
+ Then I should see 'A new post'
+
+Now run it:
+
+ $ cucumber features/posts.feature
+
+The failure will be:
+
+ undefined method `new_post_path'
+
+To get past this error, we'll create just the route we need:
+
+ map.resources :posts, :only => [:new]
+
+Running the test again, we have a new failure:
+
+ uninitialized constant PostsController
+
+h2. Controller test generator
+
+We've reached a point in our Outside-In cycle where we want to spiral down into a tighter feedback loop to unit test the non-existant controller.
+
+ $ script/generate controller_test Posts new create
+
+h2. Controller generator
+
+ $ script/generate controller Posts new create
+
+generates...
+
+
+h2. Model generator
+
+ $ script/generate model User
+
+* factory (Factory Girl)
+* unit test (Shoulda)
+* migration
+* model
+
+h2. Helper generator
+
+ $ script/generate helper Navigation
+
+* empty helper test file
+* empty helper module
+
+h2. View generator
+
+ $ script/generate view Posts new
+
+h2. Model generator: belongs_to
+
+ $ script/generate model post user:belongs_to
+
+generates...
+
+class CreatePosts < ActiveRecord::Migration
+ def self.up
+ create_table :posts do |t|
+ t.belongs_to :user
+ t.timestamps
+ end
+
+ add_index :posts, :user_id
+ end
+
+ def self.down
+ remove_index :posts, :user_id
+ drop_table :posts
+ end
+end
+
+class Post < ActiveRecord::Base
+ belongs_to :user
+end
+
+class PostTest < ActiveSupport::TestCase
+ should_belong_to :user
+ should_have_index :user_id
+end
+
+Factory.define :post do |post|
+ post.association(:user)
+end
+
+h2. Model generator: paperclip
+
+ $ script/generate model design image:paperclip
+
+* all the necessary columns in the migration
+* "has_attached_file" in the model
+* "should_have_attached_file" in unit test
+
+class CreateDesigns < ActiveRecord::Migration
+ def self.up
+ create_table :designs do |t|
+ t.string :image_file_name
+ t.string :image_content_type
+ t.integer :image_file_size
+ t.datetime :image_updated_at
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :designs
+ end
+end
+
+class Design < ActiveRecord::Base
+ has_attached_file :image
+end
+
+class DesignTest < ActiveSupport::TestCase
+ should "be valid with factory" do
+ assert_valid Factory.build(:design)
+ end
+ should_have_attached_file :image
+end
+
+h2. Attribution
+
+"Dan Croak":http://github.com/dancroak and "Mike Breen":http://github.com/hardbap
+
+Inspired by "shoulda_generator":http://github.com/technicalpickles/shoulda_generator, "model_generator_with_factories":http://github.com/vigetlabs/model_generator_with_factories, and "nifty_generators":http://github.com/ryanb/nifty-generators
+
+h2. License
+
+The MIT License
+
+Copyright (c) 2008, 2009 Dan Croak
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/plugins/blitz/Rakefile b/vendor/plugins/blitz/Rakefile
new file mode 100644
index 0000000..b521a0a
--- /dev/null
+++ b/vendor/plugins/blitz/Rakefile
@@ -0,0 +1,10 @@
+require 'rake'
+require 'rake/testtask'
+
+require 'cucumber/rake/task'
+Cucumber::Rake::Task.new(:features) do |features|
+ features.cucumber_opts = "features --format progress"
+end
+
+task :default => [:features]
+
diff --git a/vendor/plugins/blitz/features/controller_generator.feature b/vendor/plugins/blitz/features/controller_generator.feature
new file mode 100644
index 0000000..bb5c492
--- /dev/null
+++ b/vendor/plugins/blitz/features/controller_generator.feature
@@ -0,0 +1,53 @@
+Feature: Rails controller generator
+ In order to better do Test-Driven Development with Rails
+ As a user
+ I want to generate Shoulda & Factory Girl tests for only RESTful actions I need.
+
+ Scenario: Controller generator for index action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "index" action
+ And an empty "index" controller action for "posts" should be generated
+
+ Scenario: Controller generator for new action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "new" action
+ And a "new" controller action for "posts" should be generated
+
+ Scenario: Controller generator for create action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "create" action
+ And a "create" controller action for "posts" should be generated
+
+ Scenario: Controller generator for create action when Cucumber is installed
+ Given a Rails app with Cucumber
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "create" action
+ And a "create" controller action for "posts" should be generated
+
+ Scenario: Controller generator for show action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "show" action
+ And a "show" controller action for "posts" should be generated
+
+ Scenario: Controller generator for edit action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "edit" action
+ And a "edit" controller action for "posts" should be generated
+
+ Scenario: Controller generator for update action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "update" action
+ And a "update" controller action for "posts" should be generated
+
+ Scenario: Controller generator for destroy action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" controller with "destroy" action
+ And a "destroy" controller action for "posts" should be generated
+
diff --git a/vendor/plugins/blitz/features/feature_generator.feature b/vendor/plugins/blitz/features/feature_generator.feature
new file mode 100644
index 0000000..3c8063f
--- /dev/null
+++ b/vendor/plugins/blitz/features/feature_generator.feature
@@ -0,0 +1,37 @@
+Feature: Rails controller generator
+ In order to better do Test-Driven Development with Rails
+ As a user
+ I want to generate Shoulda & Factory Girl tests for only RESTful actions I need.
+
+ Scenario: Feature generator for new action
+ Given a Rails app with Cucumber
+ And the coulda plugin is installed
+ When I generate a "new" feature for "Posts"
+ Then a "posts" feature for the "create" scenario should be generated
+ And a "create posts" step definition should be generated
+ And a new post page path should be generated
+
+ Scenario: Feature generator for create action same as new
+ Given a Rails app with Cucumber
+ And the coulda plugin is installed
+ When I generate a "create" feature for "Posts"
+ Then a "posts" feature for the "create" scenario should be generated
+ And a "create posts" step definition should be generated
+ And a new post page path should be generated
+
+ Scenario: Feature generator for edit action
+ Given a Rails app with Cucumber
+ And the coulda plugin is installed
+ When I generate a "edit" feature for "Posts"
+ Then a "posts" feature for the "edit" scenario should be generated
+ And a "update posts" step definition should be generated
+ And a edit post page path should be generated
+
+ Scenario: Feature generator for update action same as edit
+ Given a Rails app with Cucumber
+ And the coulda plugin is installed
+ When I generate a "update" feature for "Posts"
+ Then a "posts" feature for the "update" scenario should be generated
+ And a "update posts" step definition should be generated
+ And a edit post page path should be generated
+
diff --git a/vendor/plugins/blitz/features/functional_test_generator.feature b/vendor/plugins/blitz/features/functional_test_generator.feature
new file mode 100644
index 0000000..da715ed
--- /dev/null
+++ b/vendor/plugins/blitz/features/functional_test_generator.feature
@@ -0,0 +1,53 @@
+Feature: Rails controller generator
+ In order to better do Test-Driven Development with Rails
+ As a user
+ I want to generate Shoulda & Factory Girl tests for only RESTful actions I need.
+
+ Scenario: Functional test generator for index action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "index" action
+ Then a standard "index" functional test for "posts" should be generated
+
+ Scenario: Functional test generator for new action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "new" action
+ Then a standard "new" functional test for "posts" should be generated
+
+ Scenario: Functional test generator for create action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "create" action
+ Then a standard "create" functional test for "posts" should be generated
+
+ Scenario: Functional test generator for create action when Cucumber is installed
+ Given a Rails app with Cucumber
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "create" action
+ Then a standard "create" functional test for "posts" should be generated
+
+ Scenario: Functional test generator for show action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "show" action
+ Then a standard "show" functional test for "posts" should be generated
+
+ Scenario: Functional test generator for edit action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "edit" action
+ Then a standard "edit" functional test for "posts" should be generated
+
+ Scenario: Functional test generator for update action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "update" action
+ Then a standard "update" functional test for "posts" should be generated
+
+ Scenario: Functional test generator for destroy action
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a "Posts" functional test with "destroy" action
+ Then a standard "destroy" functional test for "posts" should be generated
+
diff --git a/vendor/plugins/blitz/features/helper_generator.feature b/vendor/plugins/blitz/features/helper_generator.feature
new file mode 100644
index 0000000..f0e0af7
--- /dev/null
+++ b/vendor/plugins/blitz/features/helper_generator.feature
@@ -0,0 +1,12 @@
+Feature: Rails helper generator
+ In order to better do Test-Driven Development with Rails
+ As a user
+ I want to generate just the module and test I need.
+
+ Scenario: Helper
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a helper named "Navigation"
+ Then a helper should be generated for "Navigation"
+ And a helper test should be generated for "Navigation"
+
diff --git a/vendor/plugins/blitz/features/model_generator.feature b/vendor/plugins/blitz/features/model_generator.feature
new file mode 100644
index 0000000..35e4e05
--- /dev/null
+++ b/vendor/plugins/blitz/features/model_generator.feature
@@ -0,0 +1,37 @@
+Feature: Rails model generator
+ In order to better do Test-Driven Development with Rails
+ As a user
+ I want to generate a Factory definition and Shoulda tests.
+
+ Scenario: Model generator without attributes
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a model named "User"
+ Then a factory should be generated for "User"
+ And a unit test should be generated for "User"
+
+ Scenario: Model generator with attributes
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a model "User" with a string "email"
+ Then a factory for "User" should have an "email" string
+ And a unit test should be generated for "User"
+
+ Scenario: Model generator with association
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a model "Post" that belongs to a "User"
+ Then a factory for "Post" should have an association to "User"
+ And the "Post" unit test should have "should_belong_to :user" macro
+ And the "Post" unit test should have "should_have_db_index :user_id" macro
+ And the "posts" table should have db index on "user_id"
+ And the "Post" model should have "belongs_to :user" macro
+
+ Scenario: Model generator with Paperclip
+ Given a Rails app
+ And the coulda plugin is installed
+ When I generate a model "Design" with file "Image"
+ Then the "Design" model should have "has_attached_file :image" macro
+ And the "Design" unit test should have "should_have_attached_file :image" macro
+ And the "designs" table should have paperclip columns for "image"
+
diff --git a/vendor/plugins/blitz/features/step_definitions/controller_steps.rb b/vendor/plugins/blitz/features/step_definitions/controller_steps.rb
new file mode 100644
index 0000000..ad81dee
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/controller_steps.rb
@@ -0,0 +1,67 @@
+When /^I generate a "(.*)" controller with "(.*)" action$/ do |controller, action|
+ system "cd #{@rails_root} && " <<
+ "script/generate controller #{controller} #{action} && " <<
+ "cd .."
+end
+
+Then /^a "new" controller action for "posts" should be generated$/ do
+ assert_generated_file("app/controllers/posts_controller.rb") do
+ " def new\n" <<
+ " @post = Post.new\n" <<
+ " end"
+ end
+end
+
+Then /^a "create" controller action for "posts" should be generated$/ do
+ assert_generated_file("app/controllers/posts_controller.rb") do
+ " def create\n" <<
+ " @post = Post.new(params[:post])\n" <<
+ " @post.save\n" <<
+ " flash[:success] = 'Post created.'\n" <<
+ " redirect_to posts_path\n" <<
+ " end"
+ end
+end
+
+Then /^a "show" controller action for "posts" should be generated$/ do
+ assert_generated_file("app/controllers/posts_controller.rb") do
+ " def show\n" <<
+ " @post = Post.find(params[:id])\n" <<
+ " end"
+ end
+end
+
+Then /^a "edit" controller action for "posts" should be generated$/ do
+ assert_generated_file("app/controllers/posts_controller.rb") do
+ " def edit\n" <<
+ " @post = Post.find(params[:id])\n" <<
+ " end"
+ end
+end
+
+Then /^a "update" controller action for "posts" should be generated$/ do
+ assert_generated_file("app/controllers/posts_controller.rb") do
+ " def update\n" <<
+ " @post = Post.find(params[:id])\n" <<
+ " @post.update_attributes(params[:post])\n" <<
+ " flash[:success] = 'Post updated.'\n" <<
+ " redirect_to posts_path\n" <<
+ " end"
+ end
+end
+
+Then /^a "destroy" controller action for "posts" should be generated$/ do
+ assert_generated_file("app/controllers/posts_controller.rb") do
+ " def destroy\n" <<
+ " @post = Post.find(params[:id])\n" <<
+ " @post.destroy\n" <<
+ " flash[:success] = 'Post deleted.'\n" <<
+ " redirect_to posts_path\n" <<
+ " end"
+ end
+end
+
+Then /^only a "([^\"]*)" action for RESTful "([^\"]*)" route should be generated$/ do |action, resource|
+ assert_generated_route_for resource, action
+end
+
diff --git a/vendor/plugins/blitz/features/step_definitions/cucumber_steps.rb b/vendor/plugins/blitz/features/step_definitions/cucumber_steps.rb
new file mode 100644
index 0000000..9e83ae6
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/cucumber_steps.rb
@@ -0,0 +1,64 @@
+Given /^a Rails app with Cucumber$/ do
+ system "rails rails_root"
+ @rails_root = File.join(File.dirname(__FILE__), "..", "..", "rails_root")
+ require 'cucumber'
+ system "cd #{@rails_root} && ruby script/generate cucumber"
+end
+
+When /^I generate a "([^\"]*)" feature for "([^\"]*)"$/ do |feature, resource|
+ system "cd #{@rails_root} && " <<
+ "script/generate feature #{resource} #{feature} && " <<
+ "cd .."
+end
+
+Then /^a "posts" feature for the "([^\"]*)" scenario should be generated$/ do |action|
+ if %w(new create).include?(action)
+ assert_generated_file("features/posts.feature") do
+ " Scenario: Create a new post\n" <<
+ " Given I am on the new post page\n" <<
+ " When I create a post named \"A new post\"\n" <<
+ " Then I should see \"A new post\""
+ end
+ elsif %w(edit update).include?(action)
+ assert_generated_file("features/posts.feature") do
+ " Scenario: Update a post\n" <<
+ " Given I am on the edit \"An existing post\" post page\n" <<
+ " When I update the post\n" <<
+ " Then I should see \"Post updated\""
+ end
+ end
+end
+
+Then /^a "create posts" step definition should be generated$/ do
+ assert_generated_file("features/step_definitions/posts_steps.rb") do
+ "When /^I create a post named \"([^\\\"]*)\"$/ do |name|\n" <<
+ " fills_in :name, :with => name\n" <<
+ " click_button 'Create'\n"
+ "end"
+ end
+end
+
+Then /^a new post page path should be generated$/ do
+ assert_generated_file("features/support/paths.rb") do
+ " when /the new post page/i\n" <<
+ " new_post_path"
+ end
+end
+
+Then /^a "update posts" step definition should be generated$/ do
+ assert_generated_file("features/step_definitions/posts_steps.rb") do
+ "When /^I update a post named \"([^\\\"]*)\"$/ do |name|\n" <<
+ " fills_in :name, :with => name\n" <<
+ " click_button 'Update'\n"
+ "end"
+ end
+end
+
+Then /^a edit post page path should be generated$/ do
+ assert_generated_file("features/support/paths.rb") do
+ " when /the edit \"([^\\\"]*)\" post page/i do |name|\n" <<
+ " post = Post.find_by_name(name)\n"
+ " edit_post_path(post)"
+ end
+end
+
diff --git a/vendor/plugins/blitz/features/step_definitions/functional_test_steps.rb b/vendor/plugins/blitz/features/step_definitions/functional_test_steps.rb
new file mode 100644
index 0000000..c0e7972
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/functional_test_steps.rb
@@ -0,0 +1,101 @@
+When /^I generate a "(.*)" functional test with "(.*)" action$/ do |controller, action|
+ system "cd #{@rails_root} && " <<
+ "script/generate functional_test #{controller} #{action} && " <<
+ "cd .."
+end
+
+Then /^a standard "index" functional test for "posts" should be generated$/ do
+ assert_generated_file("test/functional/posts_controller_test.rb") do
+ " context 'GET to index' do\n" <<
+ " setup { get :index }\n\n" <<
+ " should_render_template :index\n" <<
+ " should_respond_with :success\n" <<
+ " end"
+ end
+end
+
+Then /^an empty "index" controller action for "posts" should be generated$/ do
+ assert_generated_file("app/controllers/posts_controller.rb") do
+ " def index\n" <<
+ " end"
+ end
+end
+
+Then /^a standard "new" functional test for "posts" should be generated$/ do
+ assert_generated_file("test/functional/posts_controller_test.rb") do
+ " context 'GET to new' do\n" <<
+ " setup { get :new }\n\n" <<
+ " should_assign_to :post\n" <<
+ " should_render_template :new\n" <<
+ " should_respond_with :success\n" <<
+ " end"
+ end
+end
+
+Then /^a standard "create" functional test for "posts" should be generated$/ do
+ assert_generated_file("test/functional/posts_controller_test.rb") do
+ " context 'POST to create with valid parameters' do\n" <<
+ " setup do\n" <<
+ " post :create, :post => Factory.attributes_for(:post)\n" <<
+ " end\n\n" <<
+ " should_set_the_flash_to /created/i\n" <<
+ " should_redirect_to('posts index') { posts_path }\n" <<
+ " end"
+ end
+end
+
+Then /^a standard "show" functional test for "posts" should be generated$/ do
+ assert_generated_file("test/functional/posts_controller_test.rb") do
+ " context 'GET to show for existing post' do\n" <<
+ " setup do\n" <<
+ " @post = Factory(:post)\n" <<
+ " get :show, :id => @post.to_param\n" <<
+ " end\n\n" <<
+ " should_assign_to :post, :equals => '@post'\n" <<
+ " should_render_template :show\n" <<
+ " should_respond_with :success\n" <<
+ " end"
+ end
+end
+
+Then /^a standard "edit" functional test for "posts" should be generated$/ do
+ assert_generated_file("test/functional/posts_controller_test.rb") do
+ " context 'GET to edit for existing post' do\n" <<
+ " setup do\n" <<
+ " @post = Factory(:post)\n" <<
+ " get :edit, :id => @post.to_param\n" <<
+ " end\n\n" <<
+ " should_assign_to :post, :equals => '@post'\n" <<
+ " should_render_template :edit\n" <<
+ " should_respond_with :success\n" <<
+ " end"
+ end
+end
+
+Then /^a standard "update" functional test for "posts" should be generated$/ do
+ assert_generated_file("test/functional/posts_controller_test.rb") do
+ " context 'PUT to update for existing post' do\n" <<
+ " setup do\n" <<
+ " @post = Factory(:post)\n" <<
+ " put :update, :id => @post.to_param,\n" <<
+ " :post => Factory.attributes_for(:post)\n" <<
+ " end\n\n" <<
+ " should_set_the_flash_to /updated/i\n" <<
+ " should_redirect_to('posts index') { posts_path }\n" <<
+ " end"
+ end
+end
+
+Then /^a standard "destroy" functional test for "posts" should be generated$/ do
+ assert_generated_file("test/functional/posts_controller_test.rb") do
+ " context 'given a post' do\n" <<
+ " setup { @post = Factory(:post) }\n\n" <<
+ " context 'DELETE to destroy' do\n" <<
+ " setup { delete :destroy, :id => @post.to_param }\n\n" <<
+ " should_set_the_flash_to /deleted/i\n" <<
+ " should_redirect_to('posts index') { posts_path }\n" <<
+ " end\n" <<
+ " end"
+ end
+end
+
diff --git a/vendor/plugins/blitz/features/step_definitions/generator_steps.rb b/vendor/plugins/blitz/features/step_definitions/generator_steps.rb
new file mode 100644
index 0000000..3df26cd
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/generator_steps.rb
@@ -0,0 +1,16 @@
+Given 'a Rails app' do
+ system "rails rails_root"
+ @rails_root = File.join(File.dirname(__FILE__), "..", "..", "rails_root")
+end
+
+Given /^the coulda plugin is installed$/ do
+ plugin_dir = File.join(@rails_root, "vendor", "plugins")
+ target = File.join(File.dirname(__FILE__), "..", "..", "generators")
+ FileUtils.mkdir_p "#{plugin_dir}/coulda"
+ system "cp -r #{target} #{plugin_dir}/coulda"
+end
+
+After do
+ FileUtils.rm_rf @rails_root if @rails_root
+end
+
diff --git a/vendor/plugins/blitz/features/step_definitions/helper_steps.rb b/vendor/plugins/blitz/features/step_definitions/helper_steps.rb
new file mode 100644
index 0000000..240eaa9
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/helper_steps.rb
@@ -0,0 +1,14 @@
+When /^I generate a helper named "(.*)"$/ do |name|
+ system "cd #{@rails_root} && " <<
+ "script/generate helper #{name} && " <<
+ "cd .."
+end
+
+Then /^a helper should be generated for "(.*)"$/ do |name|
+ assert_generated_file("app/helpers/#{name}_helper.rb")
+end
+
+Then /^a helper test should be generated for "(.*)"$/ do |name|
+ assert_generated_file("test/unit/helpers/#{name}_helper_test.rb")
+end
+
diff --git a/vendor/plugins/blitz/features/step_definitions/migration_steps.rb b/vendor/plugins/blitz/features/step_definitions/migration_steps.rb
new file mode 100644
index 0000000..24d6881
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/migration_steps.rb
@@ -0,0 +1,30 @@
+Then /^the paperclip migration should add "(.*)" columns to the "(.*)"$/ do |attr, table|
+ assert_generated_migration(table) do
+ " add_column :#{table}, :#{attr}_file_name, :string, :default => \"\"\n" <<
+ " add_column :#{table}, :#{attr}_content_type, :string, :default => \"\"\n" <<
+ " add_column :#{table}, :#{attr}_file_size, :integer, :default => \"\"\n" <<
+ " add_column :#{table}, :#{attr}_updated_at, :datetime, :default => \"\""
+ end
+ assert_generated_migration(table) do
+ " remove_column :#{table}, :#{attr}_file_name\n" <<
+ " remove_column :#{table}, :#{attr}_content_type\n" <<
+ " remove_column :#{table}, :#{attr}_file_size\n" <<
+ " remove_column :#{table}, :#{attr}_updated_at"
+ end
+end
+
+Then /^the "(.*)" table should have db index on "(.*)"$/ do |table, foreign_key|
+ assert_generated_migration(table) do
+ "add_index :#{table}, :#{foreign_key}"
+ end
+end
+
+Then /^the "(.*)" table should have paperclip columns for "(.*)"$/ do |table, attr|
+ assert_generated_migration(table) do
+ " table.string :#{attr}_file_name, :default => \"\"\n" <<
+ " table.string :#{attr}_content_type, :default => \"\"\n" <<
+ " table.integer :#{attr}_file_size\n" <<
+ " table.datetime :#{attr}_updated_at"
+ end
+end
+
diff --git a/vendor/plugins/blitz/features/step_definitions/model_steps.rb b/vendor/plugins/blitz/features/step_definitions/model_steps.rb
new file mode 100644
index 0000000..a89f90f
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/model_steps.rb
@@ -0,0 +1,89 @@
+# GENERATION
+
+When /^I generate a model named "(.*)"$/ do |model|
+ system "cd #{@rails_root} && " <<
+ "script/generate model #{model} && " <<
+ "cd .."
+end
+
+When /^I generate a model "(.*)" with a (.*) "(.*)"$/ do |model, attr_type, attr_name|
+ system "cd #{@rails_root} && " <<
+ "script/generate model #{model} #{attr_name}:#{attr_type} && " <<
+ "cd .."
+end
+
+When /^I generate a model "(.*)" that belongs to a "(.*)"$/ do |model, association|
+ association.downcase!
+ system "cd #{@rails_root} && " <<
+ "script/generate model #{model} #{association}:belongs_to && " <<
+ "cd .."
+end
+
+When /^I generate a model "(.*)" with file "(.*)"$/ do |model, file|
+ file.downcase!
+ system "cd #{@rails_root} && " <<
+ "script/generate model #{model} #{file}:paperclip && " <<
+ "cd .."
+end
+
+When /^I generate a Post model with title, body, and User$/ do
+ system "cd #{@rails_root} && " <<
+ "script/generate model Post title:string body:text user:belongs_to && " <<
+ "rake db:migrate " <<
+ "cd .."
+end
+
+# MODEL
+
+Then /^the "(.*)" model should have "(.*)" macro$/ do |model, macro|
+ model.downcase!
+ assert_generated_file("app/models/#{model}.rb") do
+ macro
+ end
+end
+
+# FACTORY
+
+Then /^a factory should be generated for "(.*)"$/ do |model|
+ model.downcase!
+ assert_generated_file("test/factories/#{model}.rb") do
+ "Factory.define :#{model.downcase} do |#{model.downcase}|\n" <<
+ "end\n"
+ end
+end
+
+Then /^a factory for "(.*)" should have an? "(.*)" (.*)$/ do |model, attr_name, attr_type|
+ model.downcase!
+ assert_generated_file("test/factories/#{model}.rb") do
+ "Factory.define :#{model} do |#{model}|\n" <<
+ " #{model}.#{attr_name} { '#{attr_type}' }\n" <<
+ "end\n"
+ end
+end
+
+Then /^a factory for "(.*)" should have an association to "(.*)"$/ do |model, associated_model|
+ model.downcase!
+ associated_model.downcase!
+ assert_generated_file("test/factories/#{model}.rb") do
+ "Factory.define :#{model} do |#{model}|\n" <<
+ " #{model}.association(:#{associated_model})\n" <<
+ "end\n"
+ end
+end
+
+# UNIT TEST
+
+Then /^a unit test should be generated for "(.*)"$/ do |model|
+ model.downcase!
+ assert_generated_file("test/unit/#{model}_test.rb") do
+ "assert_valid Factory.build(:#{model})"
+ end
+end
+
+Then /^the "(.*)" unit test should have "(.*)" macro$/ do |model, macro|
+ model.downcase!
+ assert_generated_file("test/unit/#{model}_test.rb") do
+ macro
+ end
+end
+
diff --git a/vendor/plugins/blitz/features/step_definitions/view_steps.rb b/vendor/plugins/blitz/features/step_definitions/view_steps.rb
new file mode 100644
index 0000000..e8e8158
--- /dev/null
+++ b/vendor/plugins/blitz/features/step_definitions/view_steps.rb
@@ -0,0 +1,36 @@
+When /^I generate a "([^\"]*)" view for "([^\"]*)"$/ do |view, resource|
+ system "cd #{@rails_root} && " <<
+ "script/generate view #{resource} #{view} && " <<
+ "cd .."
+end
+
+When /^a SemiFormal "new" view for "posts" should be generated$/ do
+ assert_generated_file("app/views/posts/new.html.erb") do
+ " Scenario: Create a new post
- Given I am on the new post page
- When I create a 'post' named 'A new post'
- Then I should see 'A new post'
-
-Now run it:
-
- $ cucumber features/posts.feature
-
-The failure will be:
-
- undefined method `new_post_path'
-
-To get past this error, we'll create just the route we need:
-
- map.resources :posts, :only => [:new]
-
-Running the test again, we have a new failure:
-
- uninitialized constant PostsController
-
-h2. Controller test generator
-
-We've reached a point in our Outside-In cycle where we want to spiral down into a tighter feedback loop to unit test the non-existant controller.
-
- $ script/generate controller_test Posts new create
-
-h2. Controller generator
-
- $ script/generate controller Posts new create
-
-generates...
-
-
-h2. Model generator
-
- $ script/generate model User
-
-* factory (Factory Girl)
-* unit test (Shoulda)
-* migration
-* model
-
-h2. Helper generator
-
- $ script/generate helper Navigation
-
-* empty helper test file
-* empty helper module
-
-h2. View generator
-
- $ script/generate view Posts new
-
-h2. Model generator: belongs_to
-
- $ script/generate model post user:belongs_to
-
-generates...
-
-class CreatePosts < ActiveRecord::Migration
- def self.up
- create_table :posts do |t|
- t.belongs_to :user
- t.timestamps
- end
-
- add_index :posts, :user_id
- end
-
- def self.down
- remove_index :posts, :user_id
- drop_table :posts
- end
-end
-
-class Post < ActiveRecord::Base
- belongs_to :user
-end
-
-class PostTest < ActiveSupport::TestCase
- should_belong_to :user
- should_have_index :user_id
-end
-
-Factory.define :post do |post|
- post.association(:user)
-end
-
-h2. Model generator: paperclip
-
- $ script/generate model design image:paperclip
-
-* all the necessary columns in the migration
-* "has_attached_file" in the model
-* "should_have_attached_file" in unit test
-
-class CreateDesigns < ActiveRecord::Migration
- def self.up
- create_table :designs do |t|
- t.string :image_file_name
- t.string :image_content_type
- t.integer :image_file_size
- t.datetime :image_updated_at
- t.timestamps
- end
- end
-
- def self.down
- drop_table :designs
- end
-end
-
-class Design < ActiveRecord::Base
- has_attached_file :image
-end
-
-class DesignTest < ActiveSupport::TestCase
- should "be valid with factory" do
- assert_valid Factory.build(:design)
- end
- should_have_attached_file :image
-end
-
-h2. Attribution
-
-"Mike Breen":http://github.com/hardbap and "Dan Croak":http://github.com/dancroak
-
-Inspired by "shoulda_generator":http://github.com/technicalpickles/shoulda_generator, "model_generator_with_factories":http://github.com/vigetlabs/model_generator_with_factories, and "nifty_generators":http://github.com/ryanb/nifty-generators
-
-h2. License
-
-The MIT License
-
-Copyright (c) 2008, 2009 Mike Breen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/plugins/coulda/Rakefile b/vendor/plugins/coulda/Rakefile
deleted file mode 100644
index b521a0a..0000000
--- a/vendor/plugins/coulda/Rakefile
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-
-require 'cucumber/rake/task'
-Cucumber::Rake::Task.new(:features) do |features|
- features.cucumber_opts = "features --format progress"
-end
-
-task :default => [:features]
-
diff --git a/vendor/plugins/coulda/features/controller_generator.feature b/vendor/plugins/coulda/features/controller_generator.feature
deleted file mode 100644
index e4986ac..0000000
--- a/vendor/plugins/coulda/features/controller_generator.feature
+++ /dev/null
@@ -1,61 +0,0 @@
-Feature: Rails controller generator
- In order to better do Test-Driven Development with Rails
- As a user
- I want to generate Shoulda & Factory Girl tests for only RESTful actions I need.
-
- Scenario: Controller generator for index action
- Given a Rails app
- And the coulda plugin is installed
- When I generate a "Posts" controller with "index" action
- Then a standard "index" functional test for "posts" should be generated
- And an empty "index" controller action for "posts" should be generated
-
- Scenario: Controller generator for new action
- Given a Rails app
- And the coulda plugin is installed
- When I generate a "Posts" controller with "new" action
- Then a standard "new" functional test for "posts" should be generated
- And a "new" controller action for "posts" should be generated
-
- Scenario: Controller generator for create action
- Given a Rails app
- And the coulda plugin is installed
- When I generate a "Posts" controller with "create" action
- Then a standard "create" functional test for "posts" should be generated
- And a "create" controller action for "posts" should be generated
-
- Scenario: Controller generator for create action when Cucumber is installed
- Given a Rails app with Cucumber
- And the coulda plugin is installed
- When I generate a "Posts" controller with "create" action
- Then a standard "create" functional test for "posts" should be generated
- And a "create" controller action for "posts" should be generated
-
- Scenario: Controller generator for show action
- Given a Rails app
- And the coulda plugin is installed
- When I generate a "Posts" controller with "show" action
- Then a standard "show" functional test for "posts" should be generated
- And a "show" controller action for "posts" should be generated
-
- Scenario: Controller generator for edit action
- Given a Rails app
- And the coulda plugin is installed
- When I generate a "Posts" controller with "edit" action
- Then a standard "edit" functional test for "posts" should be generated
- And a "edit" controller action for "posts" should be generated
-
- Scenario: Controller generator for update action
- Given a Rails app
- And the coulda plugin is installed
- When I generate a "Posts" controller with "update" action
- Then a standard "update" functional test for "posts" should be generated
- And a "update" controller action for "posts" should be generated
-
- Scenario: Controller generator for destroy action
- Given a Rails app
- And the coulda plugin is installed
- When I generate a "Posts" controller with "destroy" action
- Then a standard "destroy" functional test for "posts" should be generated
- And a "destroy" controller action for "posts" should be generated
-
diff --git a/vendor/plugins/coulda/features/feature_generator.feature b/vendor/plugins/coulda/features/feature_generator.feature
deleted file mode 100644
index 3c8063f..0000000
--- a/vendor/plugins/coulda/features/feature_generator.feature
+++ /dev/null
@@ -1,37 +0,0 @@
-Feature: Rails controller generator
- In order to better do Test-Driven Development with Rails
- As a user
- I want to generate Shoulda & Factory Girl tests for only RESTful actions I need.
-
- Scenario: Feature generator for new action
- Given a Rails app with Cucumber
- And the coulda plugin is installed
- When I generate a "new" feature for "Posts"
- Then a "posts" feature for the "create" scenario should be generated
- And a "create posts" step definition should be generated
- And a new post page path should be generated
-
- Scenario: Feature generator for create action same as new
- Given a Rails app with Cucumber
- And the coulda plugin is installed
- When I generate a "create" feature for "Posts"
- Then a "posts" feature for the "create" scenario should be generated
- And a "create posts" step definition should be generated
- And a new post page path should be generated
-
- Scenario: Feature generator for edit action
- Given a Rails app with Cucumber
- And the coulda plugin is installed
- When I generate a "edit" feature for "Posts"
- Then a "posts" feature for the "edit" scenario should be generated
- And a "update posts" step definition should be generated
- And a edit post page path should be generated
-
- Scenario: Feature generator for update action same as edit
- Given a Rails app with Cucumber
- And the coulda plugin is installed
- When I generate a "update" feature for "Posts"
- Then a "posts" feature for the "update" scenario should be generated
- And a "update posts" step definition should be generated
- And a edit post page path should be generated
-
diff --git a/vendor/plugins/coulda/features/helper_generator.feature b/vendor/plugins/coulda/features/helper_generator.feature
deleted file mode 100644
index f0e0af7..0000000
--- a/vendor/plugins/coulda/features/helper_generator.feature
+++ /dev/null
@@ -1,12 +0,0 @@
-Feature: Rails helper generator
- In order to better do Test-Driven Development with Rails
- As a user
- I want to generate just the module and test I need.
-
- Scenario: Helper
- Given a Rails app
- And the coulda plugin is installed
- When I generate a helper named "Navigation"
- Then a helper should be generated for "Navigation"
- And a helper test should be generated for "Navigation"
-
diff --git a/vendor/plugins/coulda/features/model_generator.feature b/vendor/plugins/coulda/features/model_generator.feature
deleted file mode 100644
index 35e4e05..0000000
--- a/vendor/plugins/coulda/features/model_generator.feature
+++ /dev/null
@@ -1,37 +0,0 @@
-Feature: Rails model generator
- In order to better do Test-Driven Development with Rails
- As a user
- I want to generate a Factory definition and Shoulda tests.
-
- Scenario: Model generator without attributes
- Given a Rails app
- And the coulda plugin is installed
- When I generate a model named "User"
- Then a factory should be generated for "User"
- And a unit test should be generated for "User"
-
- Scenario: Model generator with attributes
- Given a Rails app
- And the coulda plugin is installed
- When I generate a model "User" with a string "email"
- Then a factory for "User" should have an "email" string
- And a unit test should be generated for "User"
-
- Scenario: Model generator with association
- Given a Rails app
- And the coulda plugin is installed
- When I generate a model "Post" that belongs to a "User"
- Then a factory for "Post" should have an association to "User"
- And the "Post" unit test should have "should_belong_to :user" macro
- And the "Post" unit test should have "should_have_db_index :user_id" macro
- And the "posts" table should have db index on "user_id"
- And the "Post" model should have "belongs_to :user" macro
-
- Scenario: Model generator with Paperclip
- Given a Rails app
- And the coulda plugin is installed
- When I generate a model "Design" with file "Image"
- Then the "Design" model should have "has_attached_file :image" macro
- And the "Design" unit test should have "should_have_attached_file :image" macro
- And the "designs" table should have paperclip columns for "image"
-
diff --git a/vendor/plugins/coulda/features/step_definitions/controller_steps.rb b/vendor/plugins/coulda/features/step_definitions/controller_steps.rb
deleted file mode 100644
index d8adfe1..0000000
--- a/vendor/plugins/coulda/features/step_definitions/controller_steps.rb
+++ /dev/null
@@ -1,163 +0,0 @@
-When /^I generate a "(.*)" controller with "(.*)" action$/ do |controller, action|
- system "cd #{@rails_root} && " <<
- "script/generate controller #{controller} #{action} && " <<
- "cd .."
-end
-
-Then /^a standard "index" functional test for "posts" should be generated$/ do
- assert_generated_file("test/functional/posts_controller_test.rb") do
- " context 'GET to index' do\n" <<
- " setup { get :index }\n\n" <<
- " should_render_template :index\n" <<
- " should_respond_with :success\n" <<
- " end"
- end
-end
-
-Then /^an empty "index" controller action for "posts" should be generated$/ do
- assert_generated_file("app/controllers/posts_controller.rb") do
- " def index\n" <<
- " end"
- end
-end
-
-Then /^a standard "new" functional test for "posts" should be generated$/ do
- assert_generated_file("test/functional/posts_controller_test.rb") do
- " context 'GET to new' do\n" <<
- " setup { get :new }\n\n" <<
- " should_assign_to :post\n" <<
- " should_render_template :new\n" <<
- " should_respond_with :success\n" <<
- " end"
- end
-end
-
-Then /^a standard "create" functional test for "posts" should be generated$/ do
- assert_generated_file("test/functional/posts_controller_test.rb") do
- " context 'POST to create with valid parameters' do\n" <<
- " setup do\n" <<
- " post :create, :post => Factory.attributes_for(:post)\n" <<
- " end\n\n" <<
- " should_set_the_flash_to /created/i\n" <<
- " should_redirect_to('posts index') { posts_path }\n" <<
- " end"
- end
-end
-
-Then /^a standard "show" functional test for "posts" should be generated$/ do
- assert_generated_file("test/functional/posts_controller_test.rb") do
- " context 'GET to show for existing post' do\n" <<
- " setup do\n" <<
- " @post = Factory(:post)\n" <<
- " get :show, :id => @post.to_param\n" <<
- " end\n\n" <<
- " should_assign_to :post, :equals => '@post'\n" <<
- " should_render_template :show\n" <<
- " should_respond_with :success\n" <<
- " end"
- end
-end
-
-Then /^a standard "edit" functional test for "posts" should be generated$/ do
- assert_generated_file("test/functional/posts_controller_test.rb") do
- " context 'GET to edit for existing post' do\n" <<
- " setup do\n" <<
- " @post = Factory(:post)\n" <<
- " get :edit, :id => @post.to_param\n" <<
- " end\n\n" <<
- " should_assign_to :post, :equals => '@post'\n" <<
- " should_render_template :edit\n" <<
- " should_respond_with :success\n" <<
- " end"
- end
-end
-
-Then /^a standard "update" functional test for "posts" should be generated$/ do
- assert_generated_file("test/functional/posts_controller_test.rb") do
- " context 'PUT to update for existing post' do\n" <<
- " setup do\n" <<
- " @post = Factory(:post)\n" <<
- " put :update, :id => @post.to_param,\n" <<
- " :post => Factory.attributes_for(:post)\n" <<
- " end\n\n" <<
- " should_set_the_flash_to /updated/i\n" <<
- " should_redirect_to('posts index') { posts_path }\n" <<
- " end"
- end
-end
-
-Then /^a standard "destroy" functional test for "posts" should be generated$/ do
- assert_generated_file("test/functional/posts_controller_test.rb") do
- " context 'given a post' do\n" <<
- " setup { @post = Factory(:post) }\n\n" <<
- " context 'DELETE to destroy' do\n" <<
- " setup { delete :destroy, :id => @post.to_param }\n\n" <<
- " should_destroy :post\n" <<
- " should_set_the_flash_to /deleted/i\n" <<
- " should_redirect_to('posts index') { posts_path }\n" <<
- " end\n" <<
- " end"
- end
-end
-
-Then /^a "new" controller action for "posts" should be generated$/ do
- assert_generated_file("app/controllers/posts_controller.rb") do
- " def new\n" <<
- " @post = Post.new\n" <<
- " end"
- end
-end
-
-Then /^a "create" controller action for "posts" should be generated$/ do
- assert_generated_file("app/controllers/posts_controller.rb") do
- " def create\n" <<
- " @post = Post.new(params[:post])\n" <<
- " @post.save\n" <<
- " flash[:success] = 'Post created.'\n" <<
- " redirect_to posts_path\n" <<
- " end"
- end
-end
-
-Then /^a "show" controller action for "posts" should be generated$/ do
- assert_generated_file("app/controllers/posts_controller.rb") do
- " def show\n" <<
- " @post = Post.find(params[:id])\n" <<
- " end"
- end
-end
-
-Then /^a "edit" controller action for "posts" should be generated$/ do
- assert_generated_file("app/controllers/posts_controller.rb") do
- " def edit\n" <<
- " @post = Post.find(params[:id])\n" <<
- " end"
- end
-end
-
-Then /^a "update" controller action for "posts" should be generated$/ do
- assert_generated_file("app/controllers/posts_controller.rb") do
- " def update\n" <<
- " @post = Post.find(params[:id])\n" <<
- " @post.update_attributes(params[:post])\n" <<
- " flash[:success] = 'Post updated.'\n" <<
- " redirect_to posts_path\n" <<
- " end"
- end
-end
-
-Then /^a "destroy" controller action for "posts" should be generated$/ do
- assert_generated_file("app/controllers/posts_controller.rb") do
- " def destroy\n" <<
- " @post = Post.find(params[:id])\n" <<
- " @post.destroy\n" <<
- " flash[:success] = 'Post deleted.'\n" <<
- " redirect_to posts_path\n" <<
- " end"
- end
-end
-
-Then /^only a "([^\"]*)" action for RESTful "([^\"]*)" route should be generated$/ do |action, resource|
- assert_generated_route_for resource, action
-end
-
diff --git a/vendor/plugins/coulda/features/step_definitions/cucumber_steps.rb b/vendor/plugins/coulda/features/step_definitions/cucumber_steps.rb
deleted file mode 100644
index 9e83ae6..0000000
--- a/vendor/plugins/coulda/features/step_definitions/cucumber_steps.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-Given /^a Rails app with Cucumber$/ do
- system "rails rails_root"
- @rails_root = File.join(File.dirname(__FILE__), "..", "..", "rails_root")
- require 'cucumber'
- system "cd #{@rails_root} && ruby script/generate cucumber"
-end
-
-When /^I generate a "([^\"]*)" feature for "([^\"]*)"$/ do |feature, resource|
- system "cd #{@rails_root} && " <<
- "script/generate feature #{resource} #{feature} && " <<
- "cd .."
-end
-
-Then /^a "posts" feature for the "([^\"]*)" scenario should be generated$/ do |action|
- if %w(new create).include?(action)
- assert_generated_file("features/posts.feature") do
- " Scenario: Create a new post\n" <<
- " Given I am on the new post page\n" <<
- " When I create a post named \"A new post\"\n" <<
- " Then I should see \"A new post\""
- end
- elsif %w(edit update).include?(action)
- assert_generated_file("features/posts.feature") do
- " Scenario: Update a post\n" <<
- " Given I am on the edit \"An existing post\" post page\n" <<
- " When I update the post\n" <<
- " Then I should see \"Post updated\""
- end
- end
-end
-
-Then /^a "create posts" step definition should be generated$/ do
- assert_generated_file("features/step_definitions/posts_steps.rb") do
- "When /^I create a post named \"([^\\\"]*)\"$/ do |name|\n" <<
- " fills_in :name, :with => name\n" <<
- " click_button 'Create'\n"
- "end"
- end
-end
-
-Then /^a new post page path should be generated$/ do
- assert_generated_file("features/support/paths.rb") do
- " when /the new post page/i\n" <<
- " new_post_path"
- end
-end
-
-Then /^a "update posts" step definition should be generated$/ do
- assert_generated_file("features/step_definitions/posts_steps.rb") do
- "When /^I update a post named \"([^\\\"]*)\"$/ do |name|\n" <<
- " fills_in :name, :with => name\n" <<
- " click_button 'Update'\n"
- "end"
- end
-end
-
-Then /^a edit post page path should be generated$/ do
- assert_generated_file("features/support/paths.rb") do
- " when /the edit \"([^\\\"]*)\" post page/i do |name|\n" <<
- " post = Post.find_by_name(name)\n"
- " edit_post_path(post)"
- end
-end
-
diff --git a/vendor/plugins/coulda/features/step_definitions/generator_steps.rb b/vendor/plugins/coulda/features/step_definitions/generator_steps.rb
deleted file mode 100644
index 3df26cd..0000000
--- a/vendor/plugins/coulda/features/step_definitions/generator_steps.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-Given 'a Rails app' do
- system "rails rails_root"
- @rails_root = File.join(File.dirname(__FILE__), "..", "..", "rails_root")
-end
-
-Given /^the coulda plugin is installed$/ do
- plugin_dir = File.join(@rails_root, "vendor", "plugins")
- target = File.join(File.dirname(__FILE__), "..", "..", "generators")
- FileUtils.mkdir_p "#{plugin_dir}/coulda"
- system "cp -r #{target} #{plugin_dir}/coulda"
-end
-
-After do
- FileUtils.rm_rf @rails_root if @rails_root
-end
-
diff --git a/vendor/plugins/coulda/features/step_definitions/helper_steps.rb b/vendor/plugins/coulda/features/step_definitions/helper_steps.rb
deleted file mode 100644
index 240eaa9..0000000
--- a/vendor/plugins/coulda/features/step_definitions/helper_steps.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-When /^I generate a helper named "(.*)"$/ do |name|
- system "cd #{@rails_root} && " <<
- "script/generate helper #{name} && " <<
- "cd .."
-end
-
-Then /^a helper should be generated for "(.*)"$/ do |name|
- assert_generated_file("app/helpers/#{name}_helper.rb")
-end
-
-Then /^a helper test should be generated for "(.*)"$/ do |name|
- assert_generated_file("test/unit/helpers/#{name}_helper_test.rb")
-end
-
diff --git a/vendor/plugins/coulda/features/step_definitions/migration_steps.rb b/vendor/plugins/coulda/features/step_definitions/migration_steps.rb
deleted file mode 100644
index 24d6881..0000000
--- a/vendor/plugins/coulda/features/step_definitions/migration_steps.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-Then /^the paperclip migration should add "(.*)" columns to the "(.*)"$/ do |attr, table|
- assert_generated_migration(table) do
- " add_column :#{table}, :#{attr}_file_name, :string, :default => \"\"\n" <<
- " add_column :#{table}, :#{attr}_content_type, :string, :default => \"\"\n" <<
- " add_column :#{table}, :#{attr}_file_size, :integer, :default => \"\"\n" <<
- " add_column :#{table}, :#{attr}_updated_at, :datetime, :default => \"\""
- end
- assert_generated_migration(table) do
- " remove_column :#{table}, :#{attr}_file_name\n" <<
- " remove_column :#{table}, :#{attr}_content_type\n" <<
- " remove_column :#{table}, :#{attr}_file_size\n" <<
- " remove_column :#{table}, :#{attr}_updated_at"
- end
-end
-
-Then /^the "(.*)" table should have db index on "(.*)"$/ do |table, foreign_key|
- assert_generated_migration(table) do
- "add_index :#{table}, :#{foreign_key}"
- end
-end
-
-Then /^the "(.*)" table should have paperclip columns for "(.*)"$/ do |table, attr|
- assert_generated_migration(table) do
- " table.string :#{attr}_file_name, :default => \"\"\n" <<
- " table.string :#{attr}_content_type, :default => \"\"\n" <<
- " table.integer :#{attr}_file_size\n" <<
- " table.datetime :#{attr}_updated_at"
- end
-end
-
diff --git a/vendor/plugins/coulda/features/step_definitions/model_steps.rb b/vendor/plugins/coulda/features/step_definitions/model_steps.rb
deleted file mode 100644
index a89f90f..0000000
--- a/vendor/plugins/coulda/features/step_definitions/model_steps.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-# GENERATION
-
-When /^I generate a model named "(.*)"$/ do |model|
- system "cd #{@rails_root} && " <<
- "script/generate model #{model} && " <<
- "cd .."
-end
-
-When /^I generate a model "(.*)" with a (.*) "(.*)"$/ do |model, attr_type, attr_name|
- system "cd #{@rails_root} && " <<
- "script/generate model #{model} #{attr_name}:#{attr_type} && " <<
- "cd .."
-end
-
-When /^I generate a model "(.*)" that belongs to a "(.*)"$/ do |model, association|
- association.downcase!
- system "cd #{@rails_root} && " <<
- "script/generate model #{model} #{association}:belongs_to && " <<
- "cd .."
-end
-
-When /^I generate a model "(.*)" with file "(.*)"$/ do |model, file|
- file.downcase!
- system "cd #{@rails_root} && " <<
- "script/generate model #{model} #{file}:paperclip && " <<
- "cd .."
-end
-
-When /^I generate a Post model with title, body, and User$/ do
- system "cd #{@rails_root} && " <<
- "script/generate model Post title:string body:text user:belongs_to && " <<
- "rake db:migrate " <<
- "cd .."
-end
-
-# MODEL
-
-Then /^the "(.*)" model should have "(.*)" macro$/ do |model, macro|
- model.downcase!
- assert_generated_file("app/models/#{model}.rb") do
- macro
- end
-end
-
-# FACTORY
-
-Then /^a factory should be generated for "(.*)"$/ do |model|
- model.downcase!
- assert_generated_file("test/factories/#{model}.rb") do
- "Factory.define :#{model.downcase} do |#{model.downcase}|\n" <<
- "end\n"
- end
-end
-
-Then /^a factory for "(.*)" should have an? "(.*)" (.*)$/ do |model, attr_name, attr_type|
- model.downcase!
- assert_generated_file("test/factories/#{model}.rb") do
- "Factory.define :#{model} do |#{model}|\n" <<
- " #{model}.#{attr_name} { '#{attr_type}' }\n" <<
- "end\n"
- end
-end
-
-Then /^a factory for "(.*)" should have an association to "(.*)"$/ do |model, associated_model|
- model.downcase!
- associated_model.downcase!
- assert_generated_file("test/factories/#{model}.rb") do
- "Factory.define :#{model} do |#{model}|\n" <<
- " #{model}.association(:#{associated_model})\n" <<
- "end\n"
- end
-end
-
-# UNIT TEST
-
-Then /^a unit test should be generated for "(.*)"$/ do |model|
- model.downcase!
- assert_generated_file("test/unit/#{model}_test.rb") do
- "assert_valid Factory.build(:#{model})"
- end
-end
-
-Then /^the "(.*)" unit test should have "(.*)" macro$/ do |model, macro|
- model.downcase!
- assert_generated_file("test/unit/#{model}_test.rb") do
- macro
- end
-end
-
diff --git a/vendor/plugins/coulda/features/step_definitions/view_steps.rb b/vendor/plugins/coulda/features/step_definitions/view_steps.rb
deleted file mode 100644
index e8e8158..0000000
--- a/vendor/plugins/coulda/features/step_definitions/view_steps.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-When /^I generate a "([^\"]*)" view for "([^\"]*)"$/ do |view, resource|
- system "cd #{@rails_root} && " <<
- "script/generate view #{resource} #{view} && " <<
- "cd .."
-end
-
-When /^a SemiFormal "new" view for "posts" should be generated$/ do
- assert_generated_file("app/views/posts/new.html.erb") do
- "