Remove Factory Girl from backtrace - ruby-on-rails

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')

Related

Resolving Active record fixture format error

I am trying to test my application and I continually get the following error:
Error:
ContractsControllerTest#test_should_get_show:
ActiveRecord::Fixture::FormatError: ActiveRecord::Fixture::FormatError
Error:
ContractsControllerTest#test_should_get_show:
NoMethodError: undefined method `each' for nil:NilClass
Below is the code on my contract controller and I have similar code like this on all the controllers.
def index
#contract = Contract.all.paginate(page: params[:page], :per_page => 70)
end
def show
#contract = Contract.find(params[:id])
end
def new
#contract = Contract.new
end
def create
#contract = Contract.new(located)
if #contract.save
flash[:success] = "A record has been successfully added"
redirect_to contracts_path
else
render 'new'
end
end
def located
params.require(:contract).permit(:contract_name, :contract_status, :services_rendered, :contract_value, :award_year)
end
# editing a record in the contract from cotract table
def edit
#contract = Contract.find(params[:id])
end
def update
#contract = Contract.find(params[:id])
if #contract.update_attributes(located)
flash[:success] = "Contract form updated"
redirect_to contracts_path
else
render'edit'
end
end
def destroy
Contract.find(params[:id]).destroy
flash[:success] = "A record has been successfully deleted"
redirect_to contracts_path
end
Below is the full trace of the error when I run the command rails db:fixtures:load --trace
rails aborted!
ActiveRecord::Fixture::FormatError: ActiveRecord::Fixture::FormatError
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixture_set/file.rb:72:in `validate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixture_set/file.rb:49:in `raw_rows'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixture_set/file.rb:37:in `config_row'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixture_set/file.rb:27:in `model_class'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:791:in `block (2 levels) in
read_fixture_files'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixture_set/file.rb:15:in `open'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:790:in `block in read_fixture_files'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:789:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:789:in `each_with_object'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:789:in `read_fixture_files'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:598:in `initialize'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:529:in `new'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:529:in `block (2 levels) in
create_fixtures'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:526:in `map'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:526:in `block in create_fixtures'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/connection_adapters/postgresql/referential_integrity.rb: 22:in `disable_referential_integrity'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/fixtures.rb:523:in `create_fixtures'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-
5.0.5/lib/active_record/railties/databases.rake:207:in `block (3 levels) in
<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.0.5/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.0.5/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.0.5/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.0.5/lib/rails/commands.rb:18:in `<top (required)>'
/home/ubuntu/workspace/final_project/bin/rails:9:in `require'
/home/ubuntu/workspace/final_project/bin/rails:9:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/spring-
2.0.2/lib/spring/client/rails.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.3.0/gems/spring-
2.0.2/lib/spring/client/rails.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.3.0/gems/spring-
2.0.2/lib/spring/client/command.rb:7:in `call'
/usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:in
`run'
/usr/local/rvm/gems/ruby-2.3.0/gems/spring-2.0.2/bin/spring:49:in `<top
(required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/spring-
2.0.2/lib/spring/binstub.rb:31:in `load'
/usr/local/rvm/gems/ruby-2.3.0/gems/spring-
2.0.2/lib/spring/binstub.rb:31:in`<top (required)>'
/home/ubuntu/workspace/final_project/bin/spring:15:in `require'
/home/ubuntu/workspace/final_project/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:fixtures:load
(See full trace by running task with --trace)
My application containts 12 controllers, the same error occurs in each of the controllers. Also, I have 10 tables in my schema some of which contain references / relations to each other.
I don't really know what is wrong and I have be struggling with this problem for about four days now. I would be grateful if anyone could help me with any code or information that could help me to trace the source of the error. I would also be grateful if you could provide information for exactly where I should place the code to trace and solve this error.
Thanks
One of your fixture files in test/fixtures has bad formatting. The problem does not appear to be with your controllers or tests since it is happening for every single one of them. All of the fixtures get loaded into the test database before every single test, even if some are not used for the current test. So if there is an error in one of these files it will get raised for every test.
According to the line from the activerecord source that is throwing the error at the top of the stack trace you've provided, ActiveRecord is expecting every entry in your YAML fixture file to be a key which references a hash.
Each entry in a fixture should represent a model instance. The top level key is used as a name to reference that instance (rails usually names them one and two when generating the fixture template for a new model). Here is an example YAML fixture with one good entry and a few different types of bad ones.
# This will produce a hash associated to key :hash_entry.
# This is the correct type of entry, all others that follow are incorrect for rails fixtures.
hash_entry:
key1: value1
key2: value2
# This will produce the string "not a hash" associated to key :string_entry
string_entry: not a hash
# This will produce the array ["also", "not","a","hash"] associated to key :array_entry
array_entry:
- also
- not
- a
- hash
# This will produce nil associated to key :nil_entry
nil_entry:
You need to examine your fixtures files in test/fixtures and look for any that have the bad formatting as described above. Here is a rake task that will help you identify which files and entries need to be corrected. First run rails g task fixtures check_format, and place this code inside of the rake file that gets generated at lib/tasks/fixtures.rake.
namespace :fixtures do
desc "Looks for bad fixture files"
task check_format: :environment do
fixtures_dir = Rails.root.join("test", "fixtures")
fixture_files = Pathname.glob("#{fixtures_dir}/**/*.yml")
fixture_files.each do |file|
fixture = YAML.load(IO.read(file))
fixture.each_pair do |name, entry|
puts "Bad fixture entry #{name}: #{entry.inspect} in fixture #{file}" unless entry.is_a? Hash
end
end
end
end
Then run rails fixtures:check_format and the offending files and entries will be printed out on the command line for you to find and correct.

RSpec verbose error messages

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

RSpec Application Helper Test: Undefined local variable or method `helper`

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]

RSpec and Autotest issue in rails 3 project

Im using autotest-notification v2.3.4 and rspec v2.0.1 for writing tests in my rails v3.2.3 project on my machine running Ubuntu 12.04.In my pages_controller_spec.rb i have the following code
require 'spec_helper'
describe PagesController do
describe "GET 'contact'" do
it "should be successful" do
get 'contact'
response.should be_success
end
end
end
When i run the command rspec spec/ im getting the following error
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::SetupAndTeardownAdapter instead. (called from <top (required)> at /home/kris/development/rails_projects/s\
ample_app/spec/controllers/pages_controller_spec.rb:3)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::TestUnitAssertionAdapter instead. (called from <top (required)> at /home/kris/development/rails_projects/\
sample_app/spec/controllers/pages_controller_spec.rb:3)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::ViewRendering instead. (called from <top (required)> at /home/kris/development/rails_projects/sample_app/\
spec/controllers/pages_controller_spec.rb:3)
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instanc\
e methods directly in RSpec::Rails::ControllerExampleGroup instead. (called from <top (required)> at /home/kris/development/rails_projects/sa\
mple_app/spec/controllers/pages_controller_spec.rb:3)
Failures:
1) PagesController GET 'contact' should be successful
Failure/Error: Unable to find matching line from backtrace
undefined method `run_all' for []:Array
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/hooks.rb:116:in `run_hook_filtered'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:174:in `eval_before_alls'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:229:in `run'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block (2 levels) in run'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `map'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block in run'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/reporter.rb:11:in `report'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:23:in `run'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:55:in `run_in_process'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:46:in `run'
# /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/runner.rb:10:in `block in autorun'
Finished in 0.00028 seconds
1 example, 1 failure
/home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/hooks.rb:116:in `run_hook_filtered': undefined method `run_all' for\
[]:Array (NoMethodError)
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:213:in `eval_after_alls'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/example_group.rb:236:in `run'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block (2 levels) in run'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `map'
from /home/kris/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.0.1/lib/rspec/core/command_line.rb:26:in `block in run'
What is causing this error and how can i fix it ?
Please Help
Thank You.
Try updating RSpec. This: ruby-forum.com/topic/788351 (and the linked github issue) suggests there is an issue with older versions of RSpec, and Ruby 1.9.3.

what do these error messages mean?

i'm in section 9 of the hartl rails tutorial, this def isn't making sense. thoughts?
1) User pages index
Failure/Error: visit users_path
ActionView::Template::Error:
wrong number of arguments (2 for 1)
# ./app/helpers/users_helper.rb:3:in `gravatar_for'
# ./app/views/users/index.html.erb:7:in `block in _app_views_users_index_html_erb__3004047397113020476_70255017945740'
# ./app/views/users/index.html.erb:5:in `each'
# ./app/views/users/index.html.erb:5:in `_app_views_users_index_html_erb__3004047397113020476_70255017945740'
# ./spec/requests/user_pages_spec.rb:12:in `block (3 levels) in <top (required)>'
2) User pages index should list each user
Failure/Error: visit users_path
ActionView::Template::Error:
wrong number of arguments (2 for 1)
# ./app/helpers/users_helper.rb:3:in `gravatar_for'
# ./app/views/users/index.html.erb:7:in `block in _app_views_users_index_html_erb__3004047397113020476_70255017945740'
# ./app/views/users/index.html.erb:5:in `each'
# ./app/views/users/index.html.erb:5:in `_app_views_users_index_html_erb__3004047397113020476_70255017945740'
# ./spec/requests/user_pages_spec.rb:12:in `block (3 levels) in <top (required)>'
Chapter 7's first exercise specifies that you extend the gravatar_for method to include a new, optional parameter for including size. You likely didn't do this exercise and so it is only expecting the original 1 argument as opposed to both arguments. Complete the exercise and you should get this code to pass.
In Your user_helper.rb file in helper folder you are passing 2 arguments instead of 1 for gravatar_for method. If you put code of that it would be much easier to solve.

Resources