Permalink
Browse files

updated rake test tasks and Gemfile to remove last vestiges of rspec,…

… updated Readme with new instructions for testing
  • Loading branch information...
1 parent f7ade9a commit b37542138ba0419a607b68419ea548bfdaa8b384 @mtjhax mtjhax committed Apr 2, 2013
Showing with 40 additions and 87 deletions.
  1. +0 −3 Gemfile
  2. +0 −21 Gemfile.lock
  3. +18 −14 README.md
  4. +22 −2 lib/tasks/alltests.rake
  5. +0 −47 spec/spec_helper.rb
View
@@ -50,11 +50,9 @@ group :development do
end
group :test do
- gem 'accept_values_for'
gem 'capybara'
gem 'database_cleaner'
gem 'launchy'
- gem 'rspec-rails'
end
group :test, :development do
@@ -63,7 +61,6 @@ group :test, :development do
gem 'minitest-rails', git: 'git://github.com/blowmage/minitest-rails.git'
gem 'minitest-rails-capybara',
git: 'git://github.com/blowmage/minitest-rails-capybara.git'
- gem 'rspec-rails'
gem 'spork-rails'
gem 'spork-testunit', git: 'git://github.com/sporkrb/spork-testunit.git'
gem 'spork-minitest', git: 'git://github.com/semaperepelitsa/spork-minitest.git'
View
@@ -33,9 +33,6 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- accept_values_for (0.4.3)
- activemodel (>= 3.0.0)
- rspec
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (~> 2.4.4)
@@ -122,7 +119,6 @@ GEM
orm_adapter (~> 0.1)
railties (~> 3.1)
warden (~> 1.2.1)
- diff-lcs (1.2.1)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (1.4.0)
@@ -219,21 +215,6 @@ GEM
activerecord (>= 3.0.3)
arel (>= 2.0.6)
rgeo (>= 0.3.20)
- rspec (2.13.0)
- rspec-core (~> 2.13.0)
- rspec-expectations (~> 2.13.0)
- rspec-mocks (~> 2.13.0)
- rspec-core (2.13.0)
- rspec-expectations (2.13.0)
- diff-lcs (>= 1.1.3, < 2.0)
- rspec-mocks (2.13.0)
- rspec-rails (2.13.0)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- railties (>= 3.0)
- rspec-core (~> 2.13.0)
- rspec-expectations (~> 2.13.0)
- rspec-mocks (~> 2.13.0)
ruby-graphviz (1.0.8)
rubyzip (0.9.9)
rvm-capistrano (1.2.7)
@@ -292,7 +273,6 @@ PLATFORMS
ruby
DEPENDENCIES
- accept_values_for
activerecord-postgis-adapter (~> 0.5)
activerecord-postgres-array (~> 0.0)
activerecord-postgres-hstore (= 0.6.0)
@@ -316,7 +296,6 @@ DEPENDENCIES
rails (~> 3.2)
rails-erd
rgeo
- rspec-rails
rvm-capistrano
sass-rails (~> 3.2)
seedbank (~> 0.2)
View
@@ -98,41 +98,45 @@ which will produce a file called 'erd.pdf' in the current directory.
Testing
-------
-We currently have two test suites implemented in rspec and minitest. Run them all by
+All tests are implemented with minitest. Run them all with:
- bundle exec rspec spec
bundle exec rake minitest:all
-To run an individual minitest test, run:
+To run an individual minitest test:
cd <project root directory>
ruby -Itest path/to/test_file.rb
Speeding up your tests
----------------------
-The spork gem has also been included and preconfigured in order to help speed up the
-execution of tests. If you are only going to be running the test suite once or
-need to setup a CI server, you won't want to use spork. But if you will be
+The spork gem has also been included and preconfigured in order to help speed up
+the execution of tests. If you are only going to be running the test suite once
+or need to setup a CI server, you won't want to use spork. But if you will be
running tests frequently, while developing a new feature or refactoring, etc.,
then preloading your test environment into spork will save you a few seconds
or minutes per test execution.
-You'll need two instances of spork for the two test suites. It's easiest to
-just run them in the background window of a terminal:
+It's easiest to just run the spork server in the background window of a terminal:
- bundle exec spork rspec& bundle exec spork minitest&
+ bundle exec spork minitest&
-And then you can run the test suites with the command:
+You can then run the test suites through Spork with typical rake test commands
+(defined in lib/tasks):
- bundle exec rake test:all (defined in lib/tasks)
+ bundle exec rake test:all (run all tests)
+ bundle exec rake test:functionals (run tests found in test/functional)
+ bundle exec rake test:integration (run tests found in test/integration)
+ bundle exec rake test:units (run tests found in test/unit)
-Or:
+Or by manually invoking testdrb which is provided by the spork-minitest gem:
- bundle exec rspec spec
find test -name "*_test.rb" -type f | xargs bundle exec testdrb
+ find test/functional -name "*_test.rb" -type f | xargs bundle exec testdrb
+ find test/integration -name "*_test.rb" -type f | xargs bundle exec testdrb
+ find test/unit -name "*_test.rb" -type f | xargs bundle exec testdrb
-To run individual minitest test using spork, run:
+To run an individual test using Spork:
testdrb path/to/test_file.rb
View
@@ -1,10 +1,30 @@
if Rails.env == 'development'
+ Rake::Task[:test].clear
+ desc "Run all tests (unit, functional, integration) using Spork."
+ task :test do
+ sh 'find test -name "*_test.rb" -type f | xargs bundle exec testdrb'
+ end
+
namespace :test do
- desc "Run all tests (unit, functional, integration)."
+ desc "Run all tests (unit, functional, integration) using Spork."
task :all do
- sh 'rspec spec'
sh 'find test -name "*_test.rb" -type f | xargs bundle exec testdrb'
end
+
+ desc "Run tests in test/functional using Spork."
+ task :functionals do
+ sh 'find test -name "*_test.rb" -type f | xargs bundle exec testdrb'
+ end
+
+ desc "Run tests in test/integration using Spork."
+ task :integration do
+ sh 'find test -name "*_test.rb" -type f | xargs bundle exec testdrb'
+ end
+
+ desc "Run tests in test/unit using Spork."
+ task :units do
+ sh 'find test/unit -name "*_test.rb" -type f | xargs bundle exec testdrb'
+ end
end
end
View
@@ -1,47 +0,0 @@
-require 'spork'
-
-Spork.prefork do
- # This file is copied to spec/ when you run 'rails generate rspec:install'
- ENV["RAILS_ENV"] ||= 'test'
- require File.expand_path("../../config/environment", __FILE__)
- require 'rspec/rails'
- require 'rspec/autorun'
- require 'accept_values_for'
-
- # Requires supporting ruby files with custom matchers and macros, etc,
- # in spec/support/ and its subdirectories.
- Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
-
- RSpec.configure do |config|
- # ## Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
-
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
-
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, remove the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = true
-
- # If true, the base class of anonymous controllers will be inferred
- # automatically. This will be the default behavior in future versions of
- # rspec-rails.
- config.infer_base_class_for_anonymous_controllers = false
-
- # Run specs in random order to surface order dependencies. If you find an
- # order dependency and want to debug it, you can fix the order by providing
- # the seed, which is printed after each run.
- # --seed 1234
- config.order = "random"
- end
-end
-
-Spork.each_run do
- FactoryGirl.reload
-end

0 comments on commit b375421

Please sign in to comment.