Skip to content

Instantly share code, notes, and snippets.

@biscuitvile
Created April 2, 2014 14:11
Show Gist options
  • Select an option

  • Save biscuitvile/9934957 to your computer and use it in GitHub Desktop.

Select an option

Save biscuitvile/9934957 to your computer and use it in GitHub Desktop.

When the attached test is run using minitest-reporters DefaultReporter I get the following output:


# Running tests:

EF

Finished tests in 0.068895s, 14.5148 tests/s, 0.0000 assertions/s.

Failure:
test_0001_updates a password(Admin::PasswordResetsController::#create::with a
valid password reset) [/Users/andy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.
0.0/gems/rr-1.1.2/lib/rr/expectations/times_called_expectation.rb:29]:
new({"password"=>"password", "password_confirmation"=>"password", "account"=>#
<Object:0x007fb4ce18aad0>})
Called 0 times.
Expected 1 times.

1 tests, 0 assertions, 1 failures, 1 errors, 0 skips

When run without using minitest-reporters I get the below output:

# Running tests:

F

Finished tests in 0.022084s, 45.2817 tests/s, 0.0000 assertions/s.

  1) Error:
Admin::PasswordResetsController::#create::with a valid password reset#test_000
1_updates a password:
ActionController::UrlGenerationError: No route matches {:password_reset=>{:pas
sword=>"password", :password_confirmation=>"password"}, :controller=>"admin/pa
ssword_resets", :action=>"create"}
    test/controllers/admin/password_resets_controller_test.rb:27:in `block (4
levels) in <main>'

  2) Failure:
Admin::PasswordResetsController::#create::with a valid password reset#test_000
1_updates a password [/Users/andy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0
.0/gems/rr-1.1.2/lib/rr/expectations/times_called_expectation.rb:29]:
new({"password"=>"password", "password_confirmation"=>"password", "account"=>#
<Object:0x007fe627970f58>})
Called 0 times.
Expected 1 times.

1 tests, 0 assertions, 1 failures, 1 errors, 0 skips
require 'rails_helper'
describe Admin::PasswordResetsController do
let(:account) { Object.new }
let(:password_reset) { Object.new }
before do
stub(@controller).current_account { account }
end
describe "#create" do
describe "with a valid password reset" do
let(:reset_args) do
{ password: 'password',
password_confirmation: 'password',
account: account }.stringify_keys
end
it "updates a password" do
mock(PasswordReset).new(reset_args) { password_reset }
mock(password_reset).perform_reset! { true }
post :create, password_reset: {
password: 'password',
password_confirmation: 'password'
}
assert_redirected_to :edit_admin_settings
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment