spork
Experimental library for forking PHP
I'm trying to figure out how to get RubyMine's console to send messages to growl. Specifically, since I run Rspec & Spork through RubyMine, I'd like to get Growl notifications of how many tests passed & failed.
I had the command-line version of this functionality working via the Autotest and RedGreen gems, but neither gem seems to retain its usefulness inside RubyMine.
Has anyone successfully pushed Growl notifications from RubyMine?
Can anyone think of any of the tools or mechanisms that could enable notification?
Source: (StackOverflow)
im working on ruby.railstutorial.org/ruby-on-rails-tutorial-book.
Im using rails 3.2.7, spork, rspec, capybara, launchy and some guards :)
i have a really weird problem in Chapter 3 with testing:
It seems like the tests arent working for what is inside the <head>
-Tag. If i put the <title>
-tag inside the <body>
-tag instead of the head-tag it works fine.
Also it works when i put <h1>
-tags above the <title>
inside <head>
-Tags. It is weird, isnt it?
Please help me figur out.
The example is from : ruby.railstutorial.org/chapters/static-pages#code:title_test :
it "should have the right title" do
visit '/static_pages/home'
page.should have_selector('title',
:text => "Ruby on Rails Tutorial Sample App | Home")
end
The Error-Message is:
Failures:
1) Static pages Home page should have the title 'Home'
Failure/Error: page.should have_selector('title', :text => ' | Home')
Capybara::ExpectationNotMet:
expected to find css "title" with text " | Home" but there were no matches. Also found "", which matched the selector but not all
filters.
# ./spec/requests/static_pages_spec.rb:15:in `block (3 levels) in '
That one is working:
it "should have the h1 'Sample App'" do
visit '/static_pages/home'
page.should have_selector('h1', :text => 'Sample App')
end
the rendered HTML-file:
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | Home</title>
<!-- some css,js stuff -->
</head>
<body>
<h1>Sample App</h1>
<p>
This is the home page for the
<a rel='nofollow' href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application
</p>
</body>
</html>
Thanks
Edit:
you can find the files im working with on github:
https://github.com/farukg/sample_app/
the link to the spec file:
https://github.com/farukg/sample_app/blob/master/spec/requests/static_pages_spec.rb
Explanation of what i did:
The code for Home page is like it should be.
The code for about page has its own layout with a h1-tag above title-tag inside to show that it works for some kind of reason.
And finally the help page has its title tag inside the body tags which works too.
Im am absolutly confused, why do i have such a strange behaviour?
the complete output of guard:
> Run all
Bundle already up-to-date
Running all specs
Running tests with args ["--drb", "--colour", "-f", "progress", "-r", "/home/faruk/.rvm/gems/ruby-1.9.3-p125/gems/guard-rspec-1.2.0/lib/guard/rspec/formatters/notification_rspec.rb", "-f", "Guard::RSpec::Formatter::NotificationRSpec", "--out", "/dev/null", "--failure-exit-code", "2", "spec"]...
..FFF.....Neues Fenster in aktueller Browsersitzung erstellt.
.FF..
Failures:
1) Static pages Home page having application layout should have_selector head title 'Home'
Failure/Error: page.should have_selector('head title',
Capybara::ExpectationNotMet:
expected to find css "head title" with text "Ruby on Rails Tutorial Sample App | Home" but there were no matches. Also found "", which matched the selector but not all filters.
# ./spec/requests/static_pages_spec.rb:23:in `block (3 levels) in <top (required)>'
2) Static pages Home page having application layout should have content 'Home'
Failure/Error: page.should have_content("Ruby on Rails Tutorial Sample App | Home")
expected there to be text "Ruby on Rails Tutorial Sample App | Home" in "Sample App This is the home page for the Ruby on Rails Tutorial sample application"
# ./spec/requests/static_pages_spec.rb:30:in `block (3 levels) in <top (required)>'
3) Static pages Home page having application layout should have css title 'Home'
Failure/Error: page.should have_css("title", :text => "Ruby on Rails Tutorial Sample App | Home")
Capybara::ExpectationNotMet:
expected to find css "title" with text "Ruby on Rails Tutorial Sample App | Home" but there were no matches. Also found "", which matched the selector but not all filters.
# ./spec/requests/static_pages_spec.rb:36:in `block (3 levels) in <top (required)>'
4) Static pages about page with own layout should JUST have_selector head title
Failure/Error: page.should have_selector('head title')
Capybara::ExpectationNotMet:
expected to find css "head title" but there were no matches
# ./spec/requests/static_pages_spec.rb:86:in `block (3 levels) in <top (required)>'
5) Static pages about page with own layout should have_selector head title 'About Us'
Failure/Error: page.should have_selector('head title',
Capybara::ExpectationNotMet:
expected to find css "head title" with text "Ruby on Rails Tutorial Sample App | About Us" but there were no matches
# ./spec/requests/static_pages_spec.rb:93:in `block (3 levels) in <top (required)>'
Finished in 0.66215 seconds
15 examples, 5 failures
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:20 # Static pages Home page having application layout should have_selector head title 'Home'
rspec ./spec/requests/static_pages_spec.rb:27 # Static pages Home page having application layout should have content 'Home'
rspec ./spec/requests/static_pages_spec.rb:33 # Static pages Home page having application layout should have css title 'Home'
rspec ./spec/requests/static_pages_spec.rb:83 # Static pages about page with own layout should JUST have_selector head title
rspec ./spec/requests/static_pages_spec.rb:90 # Static pages about page with own layout should have_selector head title 'About Us'
Done.
> Neues Fenster in aktueller Browsersitzung erstellt.
Neues Fenster in aktueller Browsersitzung erstellt.
Source: (StackOverflow)
I have a application that is using rails 3.2.3 and spork 1.0.0rc2.
When I run my cucumber test I get:
ActionView::Template::Error: undefined local variable or method `page_title'
Where page_title is defined in my application helper. I am not sure what broke them as it was working until the last bundle update.
Anyone having the same issue?
Source: (StackOverflow)
I've got a problem with Spork test server.
If I set config.cache_classes = false in config/environments/test.rb then specs start to rasie errors.
Failure/Error: task = Factory(:something, :foo => @foo, :bar => @bar)
DataMapper::ImmutableError:
Immutable resource cannot be modified
This is my spec_helper.rb:
require 'spork'
Spork.prefork do
if ENV['CODE_COVERAGE'] == '1'
require 'simplecov'
SimpleCov.start 'rails'
end
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'webmock/rspec'
require 'factory_girl'
Dir[Rails.root.join("spec/controllers/shared/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.mock_with :mocha
config.include Rails.application.routes.url_helpers
config.include UrlHelper
config.before(:each) do
repository(:default) do
transaction = DataMapper::Transaction.new(repository)
transaction.begin
repository.adapter.push_transaction(transaction)
end
end
config.after(:each) do
repository(:default).adapter.pop_transaction.try(:rollback)
end
end
end
# This code will be run each time you run your specs.
Spork.each_run do
# reload factories
Factory.definition_file_paths = Dir[File.join(Rails.root, "spec", "factories")]
Factory.find_definitions
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean
LoggedEvent.all.destroy!
end
When I have config.cache_classes = true, then everything works well, but It not reload me a models, controllers classes, so I don't see a point in using spork in this case.
I tried to add to spec_helper.rb something like this, when cache is true:
Spork.each_run do
Dir.glob("#{Rails.root}/app/models/*.rb").sort.each { |file| load file }
end
But I don't like this solution.
Source: (StackOverflow)
When i run my rspec tests with spork, every time i use capybara's save_and_open_page, spork is loosing the test suite.. or maybe doesnt output anything anymore...
See the log
# => without save_and_open_page
09:04:24 - INFO - Spork server for RSpec, Test::Unit successfully started
09:04:24 - INFO - Guard::RSpec is running
09:04:24 - INFO - Running all specs
Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec"]...
................
Finished in 4.1 seconds
16 examples, 0 failures
Randomized with seed 50331
Done.
# => with save_and_open_page, no .... are shown anymore
09:04:29 - INFO - Guard is now watching at '/Users/myuser/coding/myproject'
09:04:39 - INFO - Running: spec/features/registration/registration_process_spec.rb
Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]...
Done.
# => without save_and_open_page, also no .... anymore (after restart it works again)
[1] guard(main)> Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]...
Done.
# => here i added some errors into my code... still no error message shown...
[1] guard(main)> Running tests with args ["--drb", "-f", "progress", "-r", "/Users/myuser/.rvm/gems/ruby-1.9.3-p392/gems/guard-rspec-2.5.2/lib/guard/rspec/formatter.rb", "-f", "Guard::RSpec::Formatter", "--failure-exit-code", "2", "spec/features/registration/registration_process_spec.rb"]...
Done.
# only works again after restarting spork
Any suggestions?
Source: (StackOverflow)
I am using following gems and ruby-1.9.3-p194
:
rails 3.2.3
rspec-rails 2.9.0
spork 1.0.0rc2
guard-spork 0.6.1
Full list of used gems is available in this Gemfile.lock or Gemfile.
And I am using this configuration files:
If I modify any model (or custom validator in app/validators
etc) reloading code doesnt works.
I mean when I run specs (hit Enter on guard console) Spork contain "old code" and I got obsolete error messages. But when I manually restart Guard and Spork (CTRC-C CTRL-d guard) everything works fine. But it is getting tired after few times.
Questions:
Can somebody look at my config files please and fix error which block updating code.
Or maybe this is an issue of newest Rails version?
PS This problem repeats and repeats over some projects (and on some NOT). But I haven't figured out yet why this is happens.
PS2 Perhaps this problem is something to do with ActiveAdmin
? When I change file in app/admin
code is reloaded.
Source: (StackOverflow)
I have a problem when running all of my specs.
ActiveRecord::AssociationTypeMismatch:
Affiliate(#2154746360) expected, got Affiliate(#2199508660)
It would appear that my models are being loaded twice.
I have isolated the problem to be introduced with Rack::Test's requirement to define an "app" method.
require 'rack/test'
include Rack::Test::Methods
# app method is needed for rack-test
def app
Rails.application
end
If I comment out Rails.application
my rack specs do not work, but all of my other specs work fine. The use of Rails.application
in the "app" method introduces the error above.
If I run my specs individually, everything works. I am preloading my environment with Spork and I think that the models are loaded first by Spork and then they are redefined when Rails.application
is called in my "app" method.
Any ideas on how I can resolve this problem? I am not sure if there is another way to set my Rails app in the "app" method.
Source: (StackOverflow)
I use spork with Guard + Rspec but the debugger doesn't work as expected:
I added require 'spork/ext/ruby-debug'
just after the require 'spork'
it properly stops on debugger
breakpoints...
... but I can't access irb
, it spits: Command is available only in local mode.
Do you know how to get around this?
Thanks,
PS: of course I read this question but it's a bit outdated and doesn't work.
PS2: I'd like to avoid using this.
PS3: : I also posted this as an issue here.
Source: (StackOverflow)
I have guard-spork running on my rails 3.2.11 project on Ubuntu 12.04.
I got my configuration from railstutorial.org.
Spork starts, then guard says it can't find spork to start, waits 30 secs, then 60 secs, then works.
It works, but starts up with an error everytime. Just wondering if there is something I am doing wrong.
How do I remove hooks for Test::Unit?
Error Message:
16:31:58 - INFO - Starting Spork for RSpec, Test::Unit
Using RSpec
Preloading Rails environment
Couldn't find a supported test framework that begins with 'testunit'
Supported test frameworks:
( ) Cucumber
(*) RSpec
Legend: ( ) - not detected in project (*) - detected
Loading Spork.prefork block...
Rack::File headers parameter replaces cache_control after Rack 1.5.
Spork is ready and listening on 8989!
16:32:28 - ERROR - Could not start Spork server for RSpec, Test::Unit after 30 seconds. I will continue waiting for a further 60 seconds.
16:33:28 - ERROR - Could not start Spork server for RSpec, Test::Unit. Make sure you can use it manually first.
Source: (StackOverflow)
I'm running spork and guard and all has been going very well with my RSpec tests which were all run correctly. In order to speed up the tests I could successfully filter my RSpec tests with tags I placed in my .rspec
file.
.rspec
--colour
--debug
--tag focus
--tag now
Unfortunately though I have not been able to filter my cucumber tags. Every time cucumber runs it runs either everything or just the file that changed.
How can I get cucumber/spork/guard to respect tags like @wip, @now etc and run only those tests? Is there some equivalent to the .rspec
file for cucumber tags?
Source: (StackOverflow)
Im using spork 0.9.2 and rspec 3.0.0. When trying to run test rspec --drb
I have an exception
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/spork-0.9.2/lib/spork/test_framework/rspec.rb:11:in run_tests: uninitialized constant RSpec::Core::CommandLine (NameError)
But when changing rspec version back to 2.6 - everything is OK.
Has anyone faced the same issue? Is it possible to work around?
Source: (StackOverflow)
I've been using spork all day, and most of the time it is a really great.
However, I am often running into a few problems where I need to restart Spork in order for my tests to pass... and now I'm wondering if it's more trouble than it's worth. I am new at ruby, so sometimes I can't predict if the error is due to a refresh problem, or if the error is due to my unfamiliarity with Ruby and Rails.
What do I need to put into Spork.each_run block so that my validations and other things are refreshed so that I don't have to restart the spork server?
Thanks
Source: (StackOverflow)
when I run rspec spec/models
result is OK.
But when I use spork, every test where shoulda macros (like it { should validate_presence_of(:title) }
is used FAILS with error like: undefined method 'validate_presence_of' for ...
I use:
rails (3.0.0)
shoulda (2.11.3)
spork (0.8.4)
rspec-rails (>= 2.0.0.beta.22)
spec/spec_helper.rb:
require 'rubygems'
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 'shoulda'
...
Source: (StackOverflow)
I've followed the spork railscast video and it gives me the following error when I try to run guard:
Guard is now watching at '/Users/m/work/'
Starting Spork for Test::Unit & RSpec
Couldn't find a supported test framework that begins with 'testunit'
Supported test frameworks:
( ) Cucumber
(*) RSpec
Legend: ( ) - not detected in project (*) - detected
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
--> ERROR: Could not start Spork server for Test::Unit & RSpec. Make sure you can use it manually first.
Guard::RSpec is running, with RSpec 2!
Running all specs
It looks like The spork server starts up fine and then errors and tries to carry on. I've tried making the :wait option 120 seconds and it still has the same issue.
Spork works fine if I execute the tests without guard & guard-spork
Environment:
- Mac OSX
- rails (3.1.1)
- guard (0.8.8)
- guard-rspec (0.5.4)
- spork (0.9.0.rc9)
- guard-spork (0.3.1)
How would I go about debugging this issue? I have no idea where to start.
Source: (StackOverflow)
Here's the problem. When added the Guard gem
everything was fine when I was calling Guard
.
When I added Spork
, I get the following error that doesn't affect testing my tests but it brings it up every time I try to restart Guard.
19:01:28 - INFO - Guard uses TerminalTitle to send notifications.
19:01:28 - INFO - Starting Spork for RSpec
19:01:28 - ERROR - Guard::Spork failed to achieve its <start>, exception was:
[#5232DAD6505A] ChildProcess::LaunchError: No such file or directory - bundle exec spork -p 8989
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/childprocess-0.3.7/lib/childprocess/unix/fork_exec_process.rb:54:in launch_process'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/childprocess-0.3.7/lib/childprocess/abstract_process.rb:68:in
start'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/guard/spork/spork_instance.rb:38:in start'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/guard/spork/runner.rb:33:in
each'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/guard/spork/runner.rb:33:in launch_sporks'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-spork-1.2.0/lib/guard/spork.rb:21:in
start'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:99:in block in run_supervised_task'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:97:in
catch'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:97:in run_supervised_task'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:54:in
block (2 levels) in run'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:175:in block (3 levels) in scoped_guards'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:174:in
each'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:174:in block (2 levels) in scoped_guards'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:173:in
catch'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:173:in block in scoped_guards'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:172:in
each'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:172:in scoped_guards'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:53:in
block in run'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/lumberjack-1.0.2/lib/lumberjack.rb:27:in unit_of_work'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/runner.rb:52:in
run'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard.rb:187:in block in start'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard.rb:363:in
block in within_preserved_state'
[#5232DAD6505A] :10:in synchronize'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard.rb:360:in
within_preserved_state'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard.rb:185:in start'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/lib/guard/cli.rb:110:in
start'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/thor-0.17.0/lib/thor/task.rb:27:in run'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/thor-0.17.0/lib/thor/invocation.rb:120:in
invoke_task'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/thor-0.17.0/lib/thor.rb:344:in dispatch'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/thor-0.17.0/lib/thor/base.rb:434:in
start'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/gems/guard-1.6.2/bin/guard:6:in <top (required)>'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/bin/guard:19:in
load'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/bin/guard:19:in <main>'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in
eval'
[#5232DAD6505A] /Users/periclestheodorou/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `'
19:01:28 - INFO - Guard::Spork has just been fired
19:01:28 - INFO - Guard::RSpec is running, with RSpec 2!
19:01:28 - INFO - Running all specs
No DRb server is running. Running in local process instead ...
No examples found.
Finished in 0.0001 seconds
0 examples, 0 failures
Here's the Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.11'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
gem 'guard-spork', '1.2.0'
gem 'spork', '0.9.2'
end
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails'
group :test do
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.9.1', :require => false
end
group :production do
gem 'pg', '0.12.2'
end
spec_helper
require 'rubygems'
require 'spork'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
# 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'
# 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
config.mock_with :rspec
# 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
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end
Source: (StackOverflow)