I'm just working on my first rails application by following the tutorial at http://ruby.railstutorial.org/. I have setup my development environment exactly as what it says in the tutorial (I'm on using a Macbook Pro with Lion) and it's working without any issues except for just one hiccup. I write failing tests first then I make changes to the code so that they pass, I can check in the browser that the pages are working correctly but for some reason, the test results are still "Red". I have a terminal running with 3 tabs, first tab where I have spork running (bundle exec spork), second tab where I have rails server running (rails s) and third tab where I make all the command line changes and run tests (autotest || bundle exec rspec spec/). I have to restart spork, rails server and then test again to see them go "Green".
Is this an expected behaviour? Because as per the tutorials most of the times I should be able to see them go green without having to restart the server/spork.
EDIT
This is what my spec_helper.rb file looks like
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.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting files with custom matchers and macros, etc,
# in ./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
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, comment the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end
Thanks for advising!