When I run any RSpec test that fails, I get many lines of messages that I don't really understand.
For instance, suppose I run:
expect(true).to be_false
Then my console gets cluttered with messages beginning with #
Failures:
1) Some test
Failure/Error: expect(true).to be_false
expected true to respond to `false?`
# ./spec/controllers/wing_relationships_controller_spec.rb:43:in `block (3 levels) in <top (required)>'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `block in load'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `block in load'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
# /Users/mac/.rvm/gems/ruby-2.1.2#global/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:241:in `load'
# -e:1:in `<main>'
The error messages always vary, and sometimes they are extremely long.
When I run many tests, it gets hard to read the results. I would like to get rid of those. Any suggestions? I already turned off --warning in RSpec
It's better find out where the errors come from and fix the leaky specs rather the ignoring the errors.
If you are not interested in doing it for some reason then you can always use:
You use a simple trick if you really want to:
rspec 2>/dev/null
Got this answer from https://github.com/rspec/rspec-rails/issues/1237
To remove the gems from the output, it's one line of config:
RSpec.configure do |config|
config.backtrace_exclusion_patterns << %r{/gems/}
end
Or, if you want to only filter out particular gems from your backtraces:
RSpec.configure do |config|
config.filter_gems_from_backtrace "rack", "rack-test", "capybara"
end
Related
I am trying to run a single test file: bundle exec rspec spec/models/user_spec.rb
But get following error:
An error occurred while loading ./spec/models/user_spec.rb.
Failure/Error: config.include ::Rails::Controller::Testing::TemplateAssertions, type: :controller
NameError:
uninitialized constant Rails::Controller
Did you mean? ApiController
# ./spec/rails_helper.rb:149:in `block in <top (required)>'
# ./spec/rails_helper.rb:61:in `<top (required)>'
# ./spec/models/user_spec.rb:3:in `require'
# ./spec/models/user_spec.rb:3:in `<top (required)>'
No examples found.
Initially, I was getting following error:
An error occurred while loading ./spec/models/user_spec.rb.
Failure/Error: module Shoulda::Matchers::ActiveModel
NameError:
uninitialized constant Shoulda
# ./spec/support/matchers/validate_kept_of_matcher.rb:4:in `<top (required)>'
# ./spec/rails_helper.rb:51:in `block in <top (required)>'
# ./spec/rails_helper.rb:51:in `each'
# ./spec/rails_helper.rb:51:in `<top (required)>'
# ./spec/models/user_spec.rb:3:in `require'
# ./spec/models/user_spec.rb:3:in `<top (required)>'
No examples found.
But then it fixed after I added following to the test file.
require "shoulda/matchers"
I am newbie in Ruby/Rails world, can someone please give a direction?
Rails::Controller::Testing::TemplateAssertions was removed in Rails 5.
You can re-add the depreciated functionality by installing the Rails controller testing gem. However the use of controller specs, assigns and template assertions is discouraged by both the RSpec and Rails teams and is not very future proof.
The community accepted solution is to write request specs and stop poking inside your controllers.
I'm trying to clean up the backtraces I get in my Rails application. Here is the one I'm working on right now:
Failure/Error: attributes_for :bookmark, :invalid
ArgumentError:
Trait not registered: invalid
# /Users/amandacrawford/.rvm/gems/ruby-2.3.1#autocato/gems/factory_girl-4.8.0/lib/factory_girl/registry.rb:24:in `find'
# /Users/amandacrawford/.rvm/gems/ruby-2.3.1#autocato/gems/factory_girl-4.8.0/lib/factory_girl/decorator.rb:10:in `method_missing'
# (... more lines from Factory Girl ...)
# /Users/amandacrawford/.rvm/gems/ruby-2.3.1#autocato/gems/factory_girl-4.8.0/lib/factory_girl/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/controllers/bookmarks_controller_spec.rb:9:in `block (2 levels) in <top (required)>'
# ./spec/controllers/bookmarks_controller_spec.rb:39:in `block (4 levels) in <top (required)>'
I want all but the last two lines removed from the stack trace. So far, this is my config:
# config/initializers/backtrace_silencers.rb
Rails.backtrace_cleaner.add_silencer { |line| line =~ /spring/ }
Rails.backtrace_cleaner.add_silencer { |line| line =~ /factory_girl\/registry/ }
I know that if the application stack trace is empty after the silencers are applied, it will show everything, but in this case, there should still be the last two lines.
I came across the answer to my own question today - when one of my specs had the full backtrace removed, I realized it was RSpec that was cleaning up the backtrace in this case.
RSpec also has a way to remove gems from the backtrace - add the following to your rails_helper.rb:
config.filter_gems_from_backtrace('spring', 'factory_girl')
I am a beginner with Rspec, and I found out my terminal output like this.
It's really in a mess and hard to understand test result.
Unlike the output in official tutorial.
Should I install some tools or modify some configuration?
Update
zombie.rb
class Zombie
attr_accessor :name
def initialize
#name = 'Error_Ash'
end
end
zombie_spec.rb
require "spec_helper"
require "zombie"
#give Class
describe Zombie do
# example
it "is named Class_Ash"
zombie = Zombie.new
zombie.name.should == "Ash"
end
error msg
Coda:rspec_pra Coda$ rspec spec/lib/zombie_spec.rb --format doc
/Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-support-3.4.1/lib/rspec/support.rb:87:in `block in <module:Support>': expected: "Ash" (RSpec::Expectations::ExpectationNotMetError)
got: "Error_Ash" (using ==)
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-support-3.4.1/lib/rspec/support.rb:96:in `call'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-support-3.4.1/lib/rspec/support.rb:96:in `notify_failure'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-expectations-3.4.0/lib/rspec/expectations/fail_with.rb:27:in `fail_with'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-expectations-3.4.0/lib/rspec/matchers/built_in/operators.rb:71:in `fail_with_message'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-expectations-3.4.0/lib/rspec/matchers/built_in/operators.rb:106:in `__delegate_operator'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-expectations-3.4.0/lib/rspec/matchers/built_in/operators.rb:91:in `eval_match'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-expectations-3.4.0/lib/rspec/matchers/built_in/operators.rb:51:in `block in use_custom_matcher_or_delegate'
from /Users/Coda/Desktop/code/ruby_pra/rspec_pra/spec/lib/zombie_spec.rb:11:in `block in <top (required)>'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:385:in `module_exec'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:385:in `subclass'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:255:in `block in define_example_group_method'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/dsl.rb:43:in `block in expose_example_group_alias'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/dsl.rb:82:in `block (2 levels) in expose_example_group_alias_globally'
from /Users/Coda/Desktop/code/ruby_pra/rspec_pra/spec/lib/zombie_spec.rb:6:in `<top (required)>'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1361:in `load'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1361:in `block in load_spec_files'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1359:in `each'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1359:in `load_spec_files'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:106:in `setup'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:92:in `run'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:78:in `run'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/gems/rspec-core-3.4.4/exe/rspec:4:in `<top (required)>'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/bin/rspec:22:in `load'
from /Users/Coda/.rvm/gems/ruby-2.1.3#rails416/bin/rspec:22:in `<main>'
Coda:rspec_pra Coda$
If there is nothing in your spec_helper that somehow overrides the --format switch (which I do not even know if it's possible) then this should give you readable tests that pass:
zombie.rb exactly as you posted,
zombie_spec
require "spec_helper"
require "zombie"
describe Zombie do
it "is named Ash" do
zombie = Zombie.new
expect(zombie.name).to eq "Ash"
end
end
and command rspec spec/lib/zombie_spec.rb -f d which is short for --format documentation
EDIT*: Oh sorry, the Error you posted is indeed an RSpec error... Its just not formated, as you said x.x
try the --tty flag maybe?
rspec spec/lib/zombie_spec.rb --tty -f d
I'm trying to write a simple test but my application is not detecting 'users' keyword when I'm using it in my Test functions:
post_controller_test.rb:
require 'test_helper'
class PostsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
test "should fetch facebook post" do
sign_in users(:one)
get(:save_posts_from_facebook_page,{'id'=>'my_id'},{'access_token'=>Rails.application.secrets.fb_access_token})
assert_response :success
end
end
test_helper.rb:
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
include Devise::TestHelpers
# Add more helper methods to be used by all tests here...
end
users.yml:
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
email: hello#testing.com
encrypted_password: <%= Devise.bcrypt(User,'password') %>
links:
causes:
two:
email: MyString
password: MyString
links:
causes:
Output of rake/Error:
Run options: --seed 42684
# Running:
E
Finished in 0.010275s, 97.3279 runs/s, 0.0000 assertions/s.
1) Error:
PostsControllerTest#test_should_fetch_facebook_post:
NoMethodError: undefined method `users' for #<PostsControllerTest:0x000001042152f0>
test/controllers/posts_controller_test.rb:9:in `block in <class:PostsControllerTest>'
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
Update:
Note that I'm using MongoId.
When I add 'fixtures :all' to my test_helper.rb, I get:
rake
rake aborted!
NoMethodError: undefined method `fixtures' for ActiveSupport::TestCase:Class
/Users/gautambajaj/My Stuff/FreeFromBorders/f2b_website/test/test_helper.rb:7:in `<class:TestCase>'
/Users/gautambajaj/My Stuff/FreeFromBorders/f2b_website/test/test_helper.rb:5:in `<top (required)>'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/Users/gautambajaj/My Stuff/FreeFromBorders/f2b_website/test/controllers/posts_controller_test.rb:1:in `<top (required)>'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/railties-4.2.1/lib/rails/test_unit/sub_test_task.rb:114:in `block (3 levels) in define'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/railties-4.2.1/lib/rails/test_unit/sub_test_task.rb:114:in `each'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/railties-4.2.1/lib/rails/test_unit/sub_test_task.rb:114:in `block (2 levels) in define'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/railties-4.2.1/lib/rails/test_unit/sub_test_task.rb:113:in `each'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/railties-4.2.1/lib/rails/test_unit/sub_test_task.rb:113:in `block in define'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/railties-4.2.1/lib/rails/test_unit/sub_test_task.rb:20:in `invoke_rake_task'
/Users/gautambajaj/.rvm/gems/ruby-2.1.2/gems/railties-4.2.1/lib/rails/test_unit/testing.rake:8:in `block in <top (required)>'
Tasks: TOP => test:run
(See full trace by running task with --trace)
In your test_helper.rb file, you need to add fixtures :all:
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# rest of the codes in this file
end
Once you add that line in your test_helper.rb file as shown above, your test will pass.
Update
As Sergio Tulentsev mentioned in the comment, Mongodb doesn't support transactions, so transactional fixtures can't be used in your case. Take a look at this answer which states that and also this google group discussion as well.
I would recommend you to use factory_girl instead, which supports mongoid and is pretty awesome.
This seemed to be a flickering sort of a bug for a while,but now it's appearing consistently: when I run RSpec on a fairly simple ApplicationHelper spec, I get the following error:
% rspec --backtrace
1) ApplicationHelper renders Markdown from plain text
Failure/Error: expect(helper.md(plaintext)).to eq("<h1 id=\"header\">Header</h1>\n")
NameError:
undefined local variable or method `helper' for #<RSpec::ExampleGroups::ApplicationHelper_2:0x000001248d1218>
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-expectations-0f7b78587ab4/lib/rspec/matchers.rb:903:in `method_missing'
# ./spec/helpers/application_helper_spec.rb:4:in `block (2 levels) in <top (required)>'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:148:in `instance_exec'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:148:in `block in run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:208:in `call'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:208:in `block (2 levels) in <class:Procsy>'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-rails-480b173c9ad6/lib/rspec/rails/adapters.rb:67:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:292:in `instance_exec'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:292:in `instance_exec'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/hooks.rb:430:in `block (2 levels) in run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:208:in `call'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:208:in `block (2 levels) in <class:Procsy>'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/hooks.rb:432:in `run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/hooks.rb:485:in `run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:301:in `with_around_example_hooks'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example.rb:145:in `run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example_group.rb:494:in `block in run_examples'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example_group.rb:490:in `map'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example_group.rb:490:in `run_examples'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/example_group.rb:457:in `run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/runner.rb:112:in `block (2 levels) in run_specs'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/runner.rb:112:in `map'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/runner.rb:112:in `block in run_specs'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/reporter.rb:49:in `report'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/runner.rb:108:in `run_specs'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/runner.rb:86:in `run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/runner.rb:70:in `run'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/lib/rspec/core/runner.rb:38:in `invoke'
# /Users/danielsh/.rvm/gems/ruby-2.1.1#project-staging-ng/bundler/gems/rspec-core-4219c4786f6f/exe/rspec:4:in `<top (required)>'
# /Users/danielsh/Dropbox/Project/Websites/Angular/bin/rspec:20:in `load'
# /Users/danielsh/Dropbox/Project/Websites/Angular/bin/rspec:20:in `<main>'
Here's the complete spec file (spec_helper is included as part of my .rspec file):
describe ApplicationHelper do
it 'renders Markdown from plain text' do
plaintext = '# Header'
expect(helper.md(plaintext)).to eq("<h1 id=\"header\">Header</h1>\n")
end
end
This was working up until recently, but I'm not certain what I could have done to break such a basic feature. I'm using edge versions of Rails and RSpec, but didn't see anything in their git repos to suggest that helper had been deprecated---and running rails g helper foo still generates a foo_helper_spec.rb file with instructions indicating that helper contains the helper itself. If anyone has any ideas, I'd be grateful for them!
I created a new Rails project with a fresh RSpec installation, and it led me to the problem. Apparently one of the recent betas introduced a configuration directive called config.infer_spec_type_from_file_location! that was missing from my slightly older spec_helper file; without it, RSpec wasn't guessing the spec type and mixing in the associated methods. Beware breaking changes!
add :type => :helper
so your code should look like
describe ApplicationHelper, type: :helper do
...
end
That's a weird error !! are you sure you required spec_helper in your spec ?
Anyway you could try without the helper method:
First you should first add to /spec/spec_helper.rb the following:
RSpec.configure do |config|
...
config.include ApplicationHelper
end
Then test without helper , so it will be:
describe ApplicationHelper do
it 'renders Markdown from plain text' do
plaintext = '# Header'
expect(md(plaintext)).to eq("<h1 id=\"header\">Header</h1>\n")
end
end
From the backtrace, it doesn't look like you're using the rspec-rails gem - just rspec-core and rspec-expectations.
rspec-rails is what provides the helper method to your helper specs. From inside a spec in my codebase:
(rdb:1) self.method(:helper).source_location
["/home/becky/.gem/ruby/2.0.0/gems/rspec-rails-2.14.1/lib/rspec/rails/example/helper_example_group.rb", 19]