Hi, I have a working application_helper_spec.rb, and now I created a posts_helper_spec.rb in the spec/helpers directory.
But it looks like rspec is not treating it as a helper spec, the helper returns null and mocks and stubs are not recognized, and the before is not being executed, and even my spec_helper.rb is not seeing it as a :type => :helper (full source in https://github.com/wolfmanjm/wolfmanblog_rails) Using rspec-rails 2.3.1 the spec is... require 'spec_helper' describe PostsHelper do before do @post= mock_model(Post) end describe '#num_comments with comments' do @post.stub("comments_size").and_return(10) helper.num_comments(@post).should == '10 comments' end describe '#num_comments with no comments' do @post.stub("comments_size").and_return(0) helper.num_comments(@post).should == 'no comments' end end > rspec spec/helpers/posts_helper_spec.rb /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-3.0.3/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `stub' for nil:NilClass (NoMethodError) from /home/morris/work/ruby/rails3/wolfmanblog/spec/helpers/ posts_helper_spec.rb:10 from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/example_group.rb:131:in `module_eval' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/example_group.rb:131:in `subclass' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/example_group.rb:118:in `describe' from /home/morris/work/ruby/rails3/wolfmanblog/spec/helpers/ posts_helper_spec.rb:9 from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/example_group.rb:131:in `module_eval' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/example_group.rb:131:in `subclass' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/example_group.rb:118:in `describe' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/extensions/object.rb:6:in `describe' from /home/morris/work/ruby/rails3/wolfmanblog/spec/helpers/ posts_helper_spec.rb:3 from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in `load' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in `load_spec_files' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in `map' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/configuration.rb:388:in `load_spec_files' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/command_line.rb:18:in `run' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/runner.rb:55:in `run_in_process' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/runner.rb:46:in `run' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ rspec-core-2.3.1/lib/rspec/core/runner.rb:10:in `autorun' from /opt/ruby-enterprise-1.8.7-2010.02/bin/rspec:19 _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users