Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

set up spork for cucumber and rspec

  • Loading branch information...
commit 9d3fca44f36772fe1edadd2b97c65f68f07eb4fd 1 parent b35e4b0
@drapergeek authored
View
2  .rspec
@@ -1 +1 @@
---colour
+--colour --drb
View
2  config/cucumber.yml
@@ -1,7 +1,7 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
-std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
+std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --drb --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
View
15 lib/tasks/spork.rake
@@ -0,0 +1,15 @@
+desc "Run spork for rspec and cucumber; press Ctrl+C to stop"
+task :spork do
+ puts "Running Spork for RSpec and Cucumber"
+ puts "Press Ctrl+C to stop"
+
+ spork_pids = [Process.spawn("spork rspec"), Process.spawn("spork cucumber")]
+
+ trap("INT") do
+ spork_pids.each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
+ puts "Shutting down..."
+ exit 0
+ end
+
+ spork_pids.each { |pid| Process.wait(pid) }
+end
View
34 spec/spec_helper.rb
@@ -8,50 +8,20 @@
# 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|
config.mock_with :mocha
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
+ config.include FactoryGirl::Syntax::Methods
end
end
Spork.each_run do
# This code will be run each time you run your specs.
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
end
-# --- Instructions ---
-# Sort the contents of this file into a Spork.prefork and a Spork.each_run
-# block.
-#
-# The Spork.prefork block is run only once when the spork server is started.
-# You typically want to place most of your (slow) initializer code in here, in
-# particular, require'ing any 3rd-party gems that you don't normally modify
-# during development.
-#
-# The Spork.each_run block is run each time you run your specs. In case you
-# need to load files that tend to change during development, require them here.
-# With Rails, your application modules are loaded automatically, so sometimes
-# this block can remain empty.
-#
-# Note: You can modify files loaded *from* the Spork.each_run block without
-# restarting the spork server. However, this file itself will not be reloaded,
-# so if you change any of the code inside the each_run block, you still need to
-# restart the server. In general, if you have non-trivial code in this file,
-# it's advisable to move it into a separate file so you can easily edit it
-# without restarting spork. (For example, with RSpec, you could move
-# non-trivial code into a file spec/support/my_helper.rb, making sure that the
-# spec/support/* files are require'd from inside the each_run block.)
-#
-# Any code that is left outside the two blocks will be run during preforking
-# *and* during each_run -- that's probably not what you want.
-#
-# These instructions should self-destruct in 10 seconds. If they don't, feel
-# free to delete them.
-
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.