Skip to content

rails test running twice in 3.3.1/not failing more than one test when it's supposed to #11

@JCattera

Description

@JCattera

When I run the tests in Chapter 3.3.1, the console is showing that the tests are running twice for some reason.

Running via Spring preloader in process 4008
/usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:18: warning: already initialized constant Rails::Command::HELP_MAPPINGS
/usr/local/rvm/gems/ruby-2.4.1@global/gems/railties-5.1.4/lib/rails/command.rb:18: warning: previous definition of HELP_MAPPINGS was here
Run options: --seed 61073

# Running:

Run options: --seed 61073

# Running:

....

Finished in 0.315740s, 6.3343 runs/s, 6.3343 assertions/s.

2 runs, 2 assertions, 0 failures, 0 errors, 0 skips


Finished in 0.315642s, 6.3363 runs/s, 6.3363 assertions/s.

This shouldn't be a problem, but when I try to do more than one failing test (for example, the test in 3.3.2 as well as changing "should get help" so that assert_response is looking for :error), it fails the first failing test and immediately exits instead of moving to the next test.

ec2-user:~/environment/sample_app2 (static-pages) $ rails test
Running via Spring preloader in process 4101
/usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:18: warning: already initialized constant Rails::Command::HELP_MAPPINGS
/usr/local/rvm/gems/ruby-2.4.1@global/gems/railties-5.1.4/lib/rails/command.rb:18: warning: previous definition of HELP_MAPPINGS was here
Run options: --seed 63669

# Running:

Run options: --seed 63669

# Running:

FF

Failure:
StaticPagesControllerTest#test_should_get_help [/home/ec2-user/environment/sample_app2/test/controllers/static_pages_controller_test.rb:11]:
Expected response to be a <5XX: error>, but was a <200: OK>


/usr/local/rvm/gems/ruby-2.4.1@global/gems/railties-5.1.4/lib/rails/test_unit/reporter.rb:70:in `method': undefined method `test_should_get_help' for class `Minitest::Result' (NameError)
        from /usr/local/rvm/gems/ruby-2.4.1@global/gems/railties-5.1.4/lib/rails/test_unit/reporter.rb:70:in `format_rerun_snippet'
        from /usr/local/rvm/gems/ruby-2.4.1@global/gems/railties-5.1.4/lib/rails/test_unit/reporter.rb:23:in `record'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:786:in `block in record'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:785:in `each'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:785:in `record'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:334:in `run_one_method'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:321:in `block (2 levels) in run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:320:in `each'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:320:in `block in run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:360:in `on_signal'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:347:in `with_info_handler'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:319:in `run'
        from /usr/local/rvm/gems/ruby-2.4.1@global/gems/railties-5.1.4/lib/rails/test_unit/line_filtering.rb:9:in `run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:159:in `block in __run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:159:in `map'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:159:in `__run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:136:in `run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/minitest-5.11.1/lib/minitest.rb:63:in `block in autorun'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:171:in `serve'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
        from /usr/local/rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from -e:1:in `<main>'

This has happened both on my own local machine and on my Cloud9 environment, even when I tried redoing the first part of chapter 3 to make sure I hadn't installed anything incorrectly. Does this issue pop up for anybody else using the tutorial?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions