Specs doesn't run

Rails 2.3.8

GEMFILE
group :development do
gem “rspec”, “1.3.0”
gem “rspec-rails”, “1.3.2”
gem “guard-rspec” #GitHub - guard/guard-rspec: Guard::RSpec automatically run your specs (much like autotest)
end

SPEC_HELPER.RB

This file is copied to ~/spec when you run 'ruby script/generate

rspec’

from the project root directory.

ENV[“RAILS_ENV”] ||= ‘test’
require
File.expand_path(File.join(File.dirname(FILE),‘…’,‘config’,‘environment’))
require ‘spec/autorun’
require ‘spec/rails’

Uncomment the next line to use webrat’s matchers

#require ‘webrat/integrations/rspec-rails’

Requires supporting files with custom matchers and macros, etc,

in ./support/ and its subdirectories.

Dir[File.expand_path(File.join(File.dirname(FILE),‘support’,‘**’,‘*.rb’))].each
{|f| require f}

Spec::Runner.configure do |config|

If you’re not using ActiveRecord you should remove these

lines, delete config/database.yml and disable :active_record

in your config/boot.rb

config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = RAILS_ROOT + ‘/spec/fixtures/’

== Fixtures

You can declare fixtures for each example_group like this:

describe “…” do

fixtures :table_a, :table_b

Alternatively, if you prefer to declare them only once, you can

do so right here. Just uncomment the next line and replace the

fixture

names with your fixtures.

config.global_fixtures = :table_a, :table_b

If you declare global fixtures, be aware that they will be

declared

for all of your examples, even those that don’t use them.

You can also declare which fixtures to use (for example fixtures

for test/fixtures):

config.fixture_path = RAILS_ROOT + ‘/spec/fixtures/’

== Mock Framework

RSpec uses its own mocking framework by default. 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

== Notes

For more information take a look at Spec::runner::Configuration

and Spec::Runner
end

And my CAMPAIGN_SPEC.rb
require ‘spec_helper’
require ‘campaign’

describe “Campaign” do

describe “in first step” do
before(:each) do
@user = User.new
@user.save(false)
@campaign = Campaign.new(:user => @user)
end

it "should have an owner" do
  @campaign.owner.should == @user
end

end

end

I run the specs with guard, spec spec/models/campaign_spec.rb or rake
spec:all but I don’t get any output.

On Aug 6, 2011, at 11:50 AM, Matias wrote:

Rails 2.3.8

GEMFILE
group :development do

rspec needs to be in both the development and test groups. Change ^^ to:

group :development, :test do

gem “rspec”, “1.3.0”
gem “rspec-rails”, “1.3.2”

I’d also upgrade these to rspec-rails 1.3.4 and rspec 1.3.2, though I
don’t think that’s related to this issue.

HTH,
David