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?
I did a little googling, and according to this thread on the rspec ruby forum and this closed rspec-rails issue, this is an issue with rspec-rails that has been fixed.
I am running Ruby 1.9.2p136 on Windows 7 using rails 3.0.3.
This is what my Gemfile looked like, which shows the versions of rspec and rspec-rails that I was using:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.4.1'
end
group :test do
gem 'rspec', '2.4.0'
gem 'webrat', '0.7.1'
end
I say "lookED like" because when I tried to run the rspec rails generator, this is what I got:
C:\Ruby\sample_app>rails generate rspec:install
create .rspec
create spec
create spec/spec_helper.rb
Could not find "autotest" in any of your source paths. Your current source paths
are:
C:/Ruby/sample_app/lib/templates/rspec/install
C:/Ruby/192-stackoverflow/lib/ruby/gems/1.9.1/gems/rspec-rails-2.3.0/lib/generators/rspec/install/templates
So then I added autotest to my Gemfile (and did bundle install again), then tried rails generate rspec:install again and it worked with no errors. So this is what my Gemfile looks like now:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development do
gem 'autotest'
gem 'rspec-rails', '2.4.1'
end
group :test do
gem 'rspec', '2.4.0'
gem 'webrat', '0.7.1'
end
And the version of autotest that this installs is 4.4.6:
C:\Ruby\sample_app>bundle show autotest
C:/Ruby/192-stackoverflow/lib/ruby/gems/1.9.1/gems/autotest-4.4.6
I then created the controller as instructed in the tutorial:
$ rails generate controller Pages home contact
And I was able to run both "bundle exec autotest" and "rspec spec/" without getting the error you are seeing:
C:\Ruby\sample_app>bundle exec autotest
loading autotest/rspec2
bundle exec C:\Ruby\192-stackoverflow\bin\ruby -S C:/Ruby/192-stackoverflow/lib/ruby/gems/1.9.1/gems/rspec-core-2.4.0/bin/rspec --tty 'C:/Ruby/sample_app/spec/controllers/pages_controller_spec.rb'
..
Finished in 23.04 seconds
2 examples, 0 failures
# I killed autotest with CTRL-c at this point
Interrupt a second time to quit
Terminate batch job (Y/N)? y
Terminate batch job (Y/N)? y
C:\Ruby\sample_app>rspec spec/
..
Finished in 23.11 seconds
2 examples, 0 failures
I also continued on with the tutorial, writing specs for the About page, while autotest was running and it was running on my changes without any problems.
So please try:
and let me know if that works. I will be checking back!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With