Permalink
Browse files

Remove Cucumber in favor of RSpec + Capybara

* Fix example.com -> www.example.com in test environment.
* Apply style guidelines: 80 characters, long lists.
* Update README.
  • Loading branch information...
1 parent c912961 commit 8290c97388eb0b735c930cae568fd723b3a73a08 @croaky croaky committed with Dan Croak Oct 6, 2012
View
@@ -22,26 +22,28 @@ Gemfile
-------
To see the latest and greatest gems, look at Suspenders'
-[template/Gemfile_additions](https://github.com/thoughtbot/suspenders/blob/master/templates/Gemfile_additions),
+[template/Gemfile_additions](/thoughtbot/suspenders/blob/master/templates/Gemfile_additions),
which will be appended to the default generated projectname/Gemfile.
It includes application gems like:
-* [Airbrake](https://github.com/airbrake/airbrake) for exception notification
-* [Bourbon](https://github.com/thoughtbot/bourbon) for classy sass mixins
-* [Clearance](https://github.com/thoughtbot/clearance) for authentication
-* [Flutie](https://github.com/thoughtbot/flutie) for default CSS styles
-* [Formtastic](https://github.com/justinfrench/formtastic) for better forms
-* [Paperclip](https://github.com/thoughtbot/paperclip) for file uploads
+* [Airbrake](/airbrake/airbrake) for exception notification
+* [Bourbon](/thoughtbot/bourbon) for Sass mixins
+* [Clearance](/thoughtbot/clearance) for authentication
+* [Flutie](/thoughtbot/flutie) for default CSS styles
+* [Formtastic](/justinfrench/formtastic) for form markup and style
+* [Paperclip](/thoughtbot/paperclip) for file uploads
And testing gems like:
-* [Bourne](https://github.com/thoughtbot/bourne) and Mocha for stubbing and spying
-* [Cucumber, Capybara, and Capybara Webkit](http://robots.thoughtbot.com/post/4583605733/capybara-webkit) for integration testing, including Javascript behavior
-* [Factory Girl](https://github.com/thoughtbot/factory_girl) for easier creation of test data
-* [RSpec](https://github.com/rspec/rspec) for awesome, readable isolation testing
-* [Shoulda Matchers](http://github.com/thoughtbot/shoulda-matchers) for frequently needed Rails and RSpec matchers
-* [Timecop](https://github.com/jtrupiano/timecop) for dealing with time
+* [Bourne](/thoughtbot/bourne) and [Mocha](/freerange/mocha) for stubbing and
+ spying
+* [Capybara](/jnicklas/capybara) and
+ [Capybara Webkit](/thoughtbot/capybara-webkit) for integration testing
+* [Factory Girl](/thoughtbot/factory_girl) for test data
+* [RSpec](https://github.com/rspec/rspec) for unit testing
+* [Shoulda Matchers](/thoughtbot/shoulda-matchers) for common RSpec matchers
+* [Timecop](/jtrupiano/timecop) for testing time
Other goodies
-------------
@@ -50,7 +52,8 @@ Suspenders also comes with:
* Rails' flashes set up and in application layout.
* A few nice time formats.
-* [Heroku-compliant asset pipeline settings](https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar/).
+* [Heroku-recommended asset pipeline
+ settings](https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar/).
Heroku
------
@@ -96,19 +99,22 @@ Dependencies
Some gems included in Suspenders have native extensions. You should have GCC installed on your
machine before generating an app with Suspenders.
-If you're running OS X, we recommend the [GCC OSX installer](https://github.com/kennethreitz/osx-gcc-installer).
+Use [OS X GCC Installer](/kennethreitz/osx-gcc-installer/) for Snow Leopard
+(OS X 10.6).
-We use [Capybara Webkit](https://github.com/thoughtbot/capybara-webkit) for full-stack Javascript integration testing.
-It requires you have QT installed on your machine before running Suspenders.
+Use [Command Line Tools for XCode](https://developer.apple.com/downloads/index.action)
+for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
-Instructions for installing QT on most systems are [available here](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
+We use [Capybara Webkit](/thoughtbot/capybara-webkit) for full-stack Javascript
+integration testing. It requires QT. Instructions for installing QT are
+[here](/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
PostgreSQL needs to be installed and running for the `db:create` rake task.
Issues
------
-If you have problems, please create a [Github issue](https://github.com/thoughtbot/suspenders/issues).
+If you have problems, please create a [Github Issue](/thoughtbot/suspenders/issues).
Contributing
------------
@@ -127,4 +133,5 @@ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
License
-------
-Suspenders is Copyright © 2008-2012 thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
+Suspenders is Copyright © 2008-2012 thoughtbot. It is free software, and may be
+redistributed under the terms specified in the LICENSE file.
@@ -8,7 +8,7 @@ Feature: Rake works in the suspended project
And I run the rake task "db:create"
And I run the rake task "db:migrate"
And I run the rake task "db:test:prepare"
- And I run the rake task "cucumber"
+ And I run rake
Then I see a successful response in the shell
Scenario: Making a spec then running rake
@@ -1,5 +1,11 @@
require 'aruba/cucumber'
+When 'I run rake' do
+ in_current_dir do
+ run 'bundle exec rake'
+ end
+end
+
When 'I run the rake task "$task_name"' do |task_name|
in_current_dir do
run "bundle exec rake #{task_name}"
@@ -7,5 +7,5 @@ Feature: Skipping Capybara Webkit
| --webkit | false |
And I cd to the "test_project" root
Then "capybara-webkit" should not be installed
- And "webkit" should not be included in "features/support/env.rb"
+ And "webkit" should not be included in "spec/spec_helper.rb"
And I can cleanly rake the project
@@ -82,8 +82,8 @@ def add_clearance_gem
end
def add_capybara_webkit_gem
- inject_into_file 'Gemfile', "\n gem 'capybara-webkit', '~> 0.11.0'",
- :after => /gem 'cucumber-rails', '1.3.0', :require => false/
+ inject_into_file 'Gemfile', "\n gem 'capybara-webkit'",
+ :after => /gem 'capybara'/
end
def configure_rspec
@@ -108,7 +108,7 @@ def configure_time_zone
def configure_action_mailer
action_mailer_host 'development', "#{app_name}.local"
- action_mailer_host 'test', 'example.com'
+ action_mailer_host 'test', 'www.example.com'
action_mailer_host 'staging', "staging.#{app_name}.com"
action_mailer_host 'production', "#{app_name}.com"
end
@@ -120,17 +120,9 @@ def generate_rspec
'# config.mock_with :mocha', 'config.mock_with :mocha'
end
- def generate_cucumber(options = {})
- generate 'cucumber:install', '--rspec', '--capybara'
- inject_into_file 'config/cucumber.yml',
- ' -drb -r features', :after => %{default: <%= std_opts %> features}
- copy_file 'features_support_env.rb', 'features/support/env.rb',
- :force => true
-
- if options[:webkit]
- inject_into_file 'features/support/env.rb',
- "\n Capybara.javascript_driver = :webkit",
- :after => /Capybara.default_selector = :css/
+ def configure_capybara_webkit
+ append_file 'spec/spec_helper.rb' do
+ '\n Capybara.javascript_driver = :webkit'
end
end
@@ -140,19 +132,20 @@ def setup_guard_spork
def generate_clearance
generate 'clearance:install'
- generate 'clearance:features'
end
def setup_stylesheets
- copy_file 'app/assets/stylesheets/application.css', 'app/assets/stylesheets/application.css.scss'
+ copy_file 'app/assets/stylesheets/application.css',
+ 'app/assets/stylesheets/application.css.scss'
remove_file 'app/assets/stylesheets/application.css'
concat_file 'import_scss_styles', 'app/assets/stylesheets/application.css.scss'
create_file 'app/assets/stylesheets/_screen.scss'
end
def gitignore_files
concat_file 'suspenders_gitignore', '.gitignore'
- ['app/models',
+ [
+ 'app/models',
'app/assets/images',
'app/views/pages',
'db/migrate',
@@ -165,7 +158,8 @@ def gitignore_files
'spec/helpers',
'spec/support/matchers',
'spec/support/mixins',
- 'spec/support/shared_examples'].each do |dir|
+ 'spec/support/shared_examples'
+ ].each do |dir|
empty_directory_with_gitkeep dir
end
end
@@ -177,7 +171,7 @@ def init_git
def create_heroku_apps
path_addition = override_path_for_tests
run "#{path_addition} heroku create #{app_name}-production --remote=production"
- run "#{path_addition} heroku create #{app_name}-staging --remote=staging"
+ run "#{path_addition} heroku create #{app_name}-staging --remote=staging"
end
def create_github_repo(repo_name)
@@ -211,7 +205,9 @@ def setup_root_route
end
def remove_routes_comment_lines
- replace_in_file 'config/routes.rb', /Application\.routes\.draw do.*end/m, "Application.routes.draw do\nend"
+ replace_in_file 'config/routes.rb',
+ /Application\.routes\.draw do.*end/m,
+ "Application.routes.draw do\nend"
end
def set_attr_accessibles_on_user
@@ -230,7 +226,7 @@ def include_clearance_matchers
def setup_default_rake_task
append_file 'Rakefile' do
- "task(:default).clear\ntask :default => [:spec, :cucumber]"
+ "task(:default).clear\ntask :default => [:spec]"
end
end
@@ -112,7 +112,11 @@ def configure_app
build :configure_action_mailer
build :generate_rspec
build :configure_time_zone
- build :generate_cucumber, :webkit => options[:webkit]
+
+ if options[:webkit]
+ build :configure_capybara_webkit
+ end
+
build :setup_guard_spork
build :add_email_validator
build :setup_default_rake_task
@@ -13,12 +13,12 @@ end
group :development, :test do
gem 'guard'
gem 'guard-spork'
- gem 'rspec-rails', '~> 2.9.0'
+ gem 'rspec-rails'
gem 'sham_rack'
end
group :test do
- gem 'cucumber-rails', '1.3.0', :require => false
+ gem 'capybara'
gem 'factory_girl_rails'
gem 'bourne'
gem 'database_cleaner'
@@ -1,16 +0,0 @@
-require 'spork'
-
-Spork.prefork do
- ENV['RAILS_ENV'] ||= 'test'
- require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
- require 'cucumber/rails'
-
- Capybara.default_selector = :css
- DatabaseCleaner.strategy = :truncation
-end
-
-Spork.each_run do
- After do
- DatabaseCleaner.clean
- end
-end

0 comments on commit 8290c97

Please sign in to comment.