I''m new to rspec. I just installed these: rspec (0.7.4) RSpec-0.7.4 (r1201) (rspec gem) rspec_on_rails .3 plugin (on vendor/plugin) I''ve set up a simple spec - spec/library/test_spec.rb: require File.dirname(__FILE__) + ''/../spec_helper'' context "test context" do setup do #nothing end specify "nothing to specify" do #nothing end end When I run this spec as follows: spec spec/library/test_spec.rb (or any spec for that matter), I get the following error: $> spec spec/library/test_spec.rb ./spec/library/../../vendor/plugins/rspec_on_rails/lib/rspec_on_rails.rb:38:in `run'': You have a nil object when you didn''t expect it! (NoMethodError) You might have expected an instance of Array. The error occured while evaluating nil.each from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/context_runner.rb:23:in `run'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/context_runner.rb:22:in `run'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/lib/spec/runner/command_line.rb:26:in `run'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.7.4/bin/spec:4 from /usr/local/bin/spec:18 I don''t have any idea what is causing this, or how to fix it. Any suggestions would be greatly appreciated. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061207/1d708751/attachment.html
I tried recreating this outside of the rails environment, so just a spec file like this test_spec.rb - context "test context" do setup do #nothing end specify "nothing to specify" do #nothing end end and running that with spec it works fine. Your rails plugin version should always match the gem version you have installed, so it may be worth upgrading the plugin and see if that fixes your problem? Steve On 12/7/06, allan miller <allan.m.miller at gmail.com> wrote:> I''m new to rspec. I just installed these: > > rspec (0.7.4) RSpec-0.7.4 (r1201) (rspec gem) > rspec_on_rails .3 plugin (on vendor/plugin)
> rspec (0.7.4) RSpec-0.7.4 (r1201) (rspec gem) > rspec_on_rails .3 plugin (on vendor/plugin)What exactly did you mean with "rspec_on_rails .3 plugin"? Aslak
>>* rspec (0.7.4) RSpec-0.7.4 (r1201) (rspec gem)*>*> rspec_on_rails .3 plugin (on vendor/plugin) *>What exactly did you mean with "rspec_on_rails .3 plugin"?>AslakYou were right, it was a version mismatch between rspec and the rspec_on_rails plugin I was using. Once I uninstalled rspec, removed the spec directory, cleared out plugins and generators under vendor, and obtained and carried out the following from Keith, it all worked:>$ sudo gem install rspec >(Should automatically upgrade to 0.7.4)>$ cd ${RAILS_APP} >$ ./script/plugin install --forcesvn://rubyforge.org/var/svn/rspec/tags/REL_0_7_4/vendor/rspec_on_rails/vendor/plugins/rspec>(I think you need the --force switch to overwrite the 0.7.2 plugin with 0.7.4)Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20061207/f8ba6bce/attachment.html