0

Here is the what my terminal is showing me..

user@Users-MacBook-Pro palindrome_app % bundle exec rake test
/Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:73:in `new': Hash can't be coerced into Mustermann::Pattern (TypeError)
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:70:in `block in new'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:70:in `map'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/mustermann-1.1.1/lib/mustermann.rb:70:in `new'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1641:in `compile'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1629:in `compile!'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1271:in `error'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1839:in `<class:Base>'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:894:in `<module:Sinatra>'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:22:in `<top (required)>'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/main.rb:1:in `require'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/main.rb:1:in `<top (required)>'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra.rb:1:in `require'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra.rb:1:in `<top (required)>'
    from /Users/user/Desktop/repos/palindrome_app/app.rb:1:in `require'
    from /Users/user/Desktop/repos/palindrome_app/app.rb:1:in `<top (required)>'
    from /Users/user/Desktop/repos/palindrome_app/test/test_helper.rb:3:in `require_relative'
    from /Users/user/Desktop/repos/palindrome_app/test/test_helper.rb:3:in `<top (required)>'
    from /Users/user/Desktop/repos/palindrome_app/test/site_pages_test.rb:1:in `require_relative'
    from /Users/user/Desktop/repos/palindrome_app/test/site_pages_test.rb:1:in `<top (required)>'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:17:in `require'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:17:in `block in <main>'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:5:in `select'
    from /Users/user/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb:5:in `<main>'
rake aborted!
Command failed with status (1)
/Users/user/.rbenv/versions/3.0.0/bin/bundle:23:in `load'
/Users/user/.rbenv/versions/3.0.0/bin/bundle:23:in `<main>'
Tasks: TOP => test
(See full trace by running task with --trace)
tadman
  • 208,517
  • 23
  • 234
  • 262
  • My guess: You're using Ruby 3.0 and that library doesn't support it yet. There's a breaking change when it comes to parsing arguments that has impacted a lot of code that runs fine (with lots of warnings!) in 2.7. – tadman Mar 16 '21 at 05:12
  • It's worth checking if there's an [active issue](https://github.com/sinatra/mustermann/issues) on this particular bug. I couldn't see one in a quick search. – tadman Mar 16 '21 at 05:14

1 Answers1

1

tl;dr: Upgrade sinatra to version 2.1.0. (Or, downgrade ruby to v2.7.)

You are running old gem versions (in particular, sinatra v2.0.3), with the latest version of ruby (v3.0.0). You may run into various compatibility problems by doing that, because you could be missing crucial ruby 3.0 compatibility updates from those libraries.

There are various mentions of ruby 2.7+ keyword deprecation fixes in the sinatra changelog.

Specifically, this error:

gems/3.0.0/gems/sinatra-2.0.3/lib/sinatra/base.rb:1629:in `compile!'

Was fixed by this change in this PR, which shipped as part of sinatra v2.0.8. Also, additional fixes were added as part of the v2.1.0 release.

Tom Lord
  • 27,404
  • 4
  • 50
  • 77
  • Thank you all soo much for your responses !! I updated to Sinatra 2.1.0 and the test ran perfectly !! Thank you all again. – Mark Hughes Mar 16 '21 at 23:12