hanami-jwt-example icon indicating copy to clipboard operation
hanami-jwt-example copied to clipboard

Failing tests / '==' returns true comparing digest to actual password

Open benbachhuber opened this issue 8 years ago • 1 comments

Hi first of all thank you for taking the time to create an example as this

After cloning the repository I realised that 4 tests are failing.

  1) Error:
JwtIssuer::#encode#test_0001_returns a new jwt:
NameError: undefined local variable or method `be_nil' for #<#<Class:0x007f8ce6c6d700>:0x007f8ce6551318>
   spec/inventory/services/jwt_issuer_spec.rb:9:in `block (3 levels) in <top (required)>'

  2) Error:
JwtIssuer::#decode#test_0001_returns valid informations if the jwt is valid:
NoMethodError: undefined method `eq' for #<#<Class:0x007f8ce6c6d200>:0x007f8ce9080d90>
    spec/inventory/services/jwt_issuer_spec.rb:18:in `block (3 levels) in <top (required)>'

  3) Error:
JwtIssuer::#decode#test_0002_returns nil if jwt is not valid:
NameError: undefined local variable or method `be_nil' for #<#<Class:0x007f8ce6c6d200>:0x007f8ce907aee0>
    spec/inventory/services/jwt_issuer_spec.rb:24:in `block (3 levels) in <top (required)>'

  4) Error:
JwtIssuer::#decode#test_0003_returns nil if jwt is expired:
NameError: undefined local variable or method `be_nil' for #<#<Class:0x007f8ce6c6d200>:0x007f8ce907a9b8>
    /spec/inventory/services/jwt_issuer_spec.rb:31:in `block (3 levels) in <top (required)>'

benbachhuber avatar May 23 '17 15:05 benbachhuber

Hi @BenBach and thank you for taking the time to submit an issue :)

I'm a bit confused. Reading the title of this issue seems you had a problem that concerns the password, but the stack trace highlights some weird errors related to JWT's tests, or better, to minitest gem (undefined local variable or method be_nil').

I'm not able to reproduce your error locally both with Ruby 2.3.0 and 2.3.1, all my tests are green.

❯ rake test
Run options: --seed 25790

# Running:

..............................................................

Finished in 0.864420s, 71.7244 runs/s, 93.7045 assertions/s.

62 runs, 81 assertions, 0 failures, 0 errors, 0 skips

❯ rake test TEST=spec/inventory/services/jwt_issuer_spec.rb
Run options: --seed 32275

# Running:

....

Finished in 0.002858s, 1399.3686 runs/s, 2099.0529 assertions/s.

4 runs, 6 assertions, 0 failures, 0 errors, 0 skips

❯ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

❯ hanami -v
v1.0.0

I really want to help you and understand what is the problem. Are you able to reproduce this failing tests? Could you provide me more context:

  • ruby version
  • your Gemfile.lock
  • the seed of a failing test
  • Are the other tests green?
  • ...any other information that you think could be helpful

Thanks again :)

nickgnd avatar May 27 '17 18:05 nickgnd