Fix failing specs in master
nellshamrell opened this issue · comments
Running our rspec specs on the master branch currently returns several failures:
1) VeteransController#new makes a new record
Failure/Error: expect(assigns(:veteran)).to be_new_record
NoMethodError:
undefined method `persisted?' for nil:NilClass
# ./spec/controllers/veterans_controller_spec.rb:7:in `block (3 levels) in <top (required)>'
2) VeteransController#new renders the #new template
Failure/Error: expect(response).to render_template(:new)
expecting <"new"> but was a redirect to <https://test.host/veterans/new>
# ./spec/controllers/veterans_controller_spec.rb:12:in `block (3 levels) in <top (required)>'
3) VeteransController#create makes a new record with the params
Failure/Error: expect(Veteran).to receive(:new).with(veteran_params).and_return(Veteran.new(veteran_params))
(Veteran(id: integer, email: string, first_name: string, last_name: string, service_branch: string, zip: string, created_at: datetime, updated_at: datetime) (class)).new({:email=>"billybob@email.com", :first_name=>"Billy", :last_name=>"Bob"})
expected: 1 time with arguments: ({:email=>"billybob@email.com", :first_name=>"Billy", :last_name=>"Bob"})
received: 0 times
# ./spec/controllers/veterans_controller_spec.rb:31:in `block (3 levels) in <top (required)>'
4) VeteransController#create when the record saves successfully #html redirects to the action_path
Failure/Error: expect(response).to redirect_to(action_path)
Expected response to be a redirect to <http://test.host/action> but was a redirect to <https://test.host/veterans.html?veteran%5Bemail%5D=billybob%40email.com&veteran%5Bfirst_name%5D=Billy&veteran%5Blast_name%5D=Bob>.
Expected "http://test.host/action" to be === "https://test.host/veterans.html?veteran%5Bemail%5D=billybob%40email.com&veteran%5Bfirst_name%5D=Billy&veteran%5Blast_name%5D=Bob".
# ./spec/controllers/veterans_controller_spec.rb:39:in `block (5 levels) in <top (required)>'
5) VeteransController#create when the record saves successfully #html shows a notice
Failure/Error: expect(flash[:notice]).to include('Thanks for signing up!')
expected nil to include "Thanks for signing up!", but it does not respond to `include?`
# ./spec/controllers/veterans_controller_spec.rb:44:in `block (5 levels) in <top (required)>'
6) VeteransController#create when the record saves successfully #html sends a wecome email
Failure/Error: expect(user_mailer_double).to receive(:deliver_now).and_return(true)
(Double UserMailer).deliver_now(*(any args))
expected: 1 time with any arguments
received: 0 times with any arguments
# ./spec/controllers/veterans_controller_spec.rb:51:in `block (5 levels) in <top (required)>'
7) VeteransController#create when the record saves successfully #html sends slack invitation
Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
Exactly one instance should have received the following message(s) but didn't: send_slack_invitation
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-support-3.4.1/lib/rspec/support.rb:87:in `block in <module:Support>'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-support-3.4.1/lib/rspec/support.rb:96:in `call'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-support-3.4.1/lib/rspec/support.rb:96:in `notify_failure'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks/error_generator.rb:325:in `notify'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks/error_generator.rb:309:in `__raise'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks/any_instance/error_generator.rb:7:in `raise_second_instance_received_message_error'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks/any_instance/recorder.rb:94:in `verify'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks/space.rb:75:in `block in verify_all'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks/space.rb:75:in `each_value'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks/space.rb:75:in `verify_all'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-mocks-3.4.0/lib/rspec/mocks.rb:45:in `verify'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/mocking_adapters/rspec.rb:23:in `verify_mocks_for_rspec'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:491:in `verify_mocks'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:485:in `run_after_example'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:251:in `block in run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:477:in `block in with_around_and_singleton_context_hooks'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:434:in `block in with_around_example_hooks'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:478:in `block in run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:618:in `block in run_around_example_hooks_for'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:319:in `call'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:319:in `call'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-rails-3.4.0/lib/rspec/rails/example/controller_example_group.rb:191:in `block (2 levels) in <module:ControllerExampleGroup>'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:424:in `instance_exec'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:424:in `instance_exec'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:389:in `execute_with'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:620:in `block (2 levels) in run_around_example_hooks_for'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:319:in `call'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:319:in `call'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-rails-3.4.0/lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:424:in `instance_exec'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:424:in `instance_exec'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:389:in `execute_with'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:620:in `block (2 levels) in run_around_example_hooks_for'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:319:in `call'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:319:in `call'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:621:in `run_around_example_hooks_for'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/hooks.rb:478:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:434:in `with_around_example_hooks'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:477:in `with_around_and_singleton_context_hooks'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example.rb:233:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:581:in `block in run_examples'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:577:in `map'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:577:in `run_examples'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:543:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `block in run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `map'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `block in run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `map'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `block in run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `map'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/example_group.rb:544:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:115:in `block (3 levels) in run_specs'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:115:in `map'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:115:in `block (2 levels) in run_specs'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1680:in `with_suite_hooks'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:114:in `block in run_specs'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/reporter.rb:77:in `report'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:113:in `run_specs'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:89:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:73:in `run'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:41:in `invoke'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/exe/rspec:4:in `<top (required)>'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/bin/rspec:23:in `load'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/bin/rspec:23:in `<main>'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
# /Users/nellshamrell/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
#
# Showing full backtrace because every line was filtered out.
# See docs for RSpec::Configuration#backtrace_exclusion_patterns and
# RSpec::Configuration#backtrace_inclusion_patterns for more information.
8) VeteransController#create when the record saves successfully #json renders the show view
Failure/Error: expect(response).to render_template(:show)
expecting <"show"> but was a redirect to <https://test.host/veterans.json?veteran%5Bemail%5D=billybob%40email.com&veteran%5Bfirst_name%5D=Billy&veteran%5Blast_name%5D=Bob>
# ./spec/controllers/veterans_controller_spec.rb:65:in `block (5 levels) in <top (required)>'
9) VeteransController#create when the record does not save successfully #html renders the new template
Failure/Error: expect(response).to render_template(:new)
expecting <"new"> but was a redirect to <https://test.host/veterans.html?veteran%5Bemail%5D=billybob%40email.com&veteran%5Bfirst_name%5D=Billy&veteran%5Blast_name%5D=Bob>
# ./spec/controllers/veterans_controller_spec.rb:83:in `block (5 levels) in <top (required)>'
10) VeteransController#create when the record does not save successfully #json renders the errors
Failure/Error: expect(response.body).to include("ERRORZ")
expected "<html><body>You are being <a href=\"https://test.host/veterans.json?veteran%5Bemail%5D=billybob%40email.com&veteran%5Bfirst_name%5D=Billy&veteran%5Blast_name%5D=Bob\">redirected</a>.</body></html>" to include "ERRORZ"
# ./spec/controllers/veterans_controller_spec.rb:92:in `block (5 levels) in <top (required)>'
Finished in 0.13589 seconds (files took 3.27 seconds to load)
15 examples, 10 failures
Failed examples:
rspec ./spec/controllers/veterans_controller_spec.rb:5 # VeteransController#new makes a new record
rspec ./spec/controllers/veterans_controller_spec.rb:10 # VeteransController#new renders the #new template
rspec ./spec/controllers/veterans_controller_spec.rb:30 # VeteransController#create makes a new record with the params
rspec ./spec/controllers/veterans_controller_spec.rb:37 # VeteransController#create when the record saves successfully #html redirects to the action_path
rspec ./spec/controllers/veterans_controller_spec.rb:42 # VeteransController#create when the record saves successfully #html shows a notice
rspec ./spec/controllers/veterans_controller_spec.rb:47 # VeteransController#create when the record saves successfully #html sends a wecome email
rspec ./spec/controllers/veterans_controller_spec.rb:56 # VeteransController#create when the record saves successfully #html sends slack invitation
rspec ./spec/controllers/veterans_controller_spec.rb:63 # VeteransController#create when the record saves successfully #json renders the show view
rspec ./spec/controllers/veterans_controller_spec.rb:81 # VeteransController#create when the record does not save successfully #html renders the new template
rspec ./spec/controllers/veterans_controller_spec.rb:88 # VeteransController#create when the record does not save successfully #json renders the errors