views:

73

answers:

2

I have installed growl + rspec + autotest on my windows 7 machine. From the command prompt, when I type 'rspec spec/' it doesn't work. The tests will only run if I use 'rake spec/' + 'autotest'.

Also, I am running these tests: http://railstutorial.org/chapters/static-pages#code:default_pages_controller_spec (i.e. very, very trivial) and they are taking 8.11 seconds.

They also fail when I run them - even though they don't in the example. I have done everything the tutorial told me, the problem is the tutorial doesn't go too deep into installing rspec on a Windows machine. It gives a link, but even then you have to kinda piece the instructions together.

The errors I get are 'Failure/Error: Unable to find C to read failed line [31mundefined methord get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x48336c0>'

The second error is very similar to that.

I have also installed Growl correctly, because I get a notification that there were two failures.

Can anyone help me?

+1  A: 

I've not found a permanent fix that works yet, but apparently it boils down to a path issue - something is munging the windows path and it breaks. However, there's a work around:

Within your describe, before the 'get' call, put this:

include RSpec::Rails::ControllerExampleGroup

Here's sample code using a generated Rails spec for a controller. Note that it's at the beginning of the scope:

require 'spec_helper'

describe PagesController do
  include RSpec::Rails::ControllerExampleGroup

  describe "GET 'home'" do
    it "should be successful" do
      get 'home'
      response.should be_success
    end
  end

  describe "GET 'contact'" do
    it "should be successful" do
      get 'contact'
      response.should be_success
    end
  end

end

There's a fix I've seen that suggests a change to spec_helper (in the Rails case), but I couldn't get it to work.

EDIT: A bit more research reveals this is a problem with autospec - this work around will work if you're just using rspec, but will not work with autotest. I've not been able to find a solution for this, however.

tsalaroth
Yeh...I am using autotest :(
marcamillion
A: 

Have not been able to find a response to this. If anyone is able, please reply and I will chose that answer instead.

marcamillion