This question probably has a simple answer but I can't find any examples for what I am trying to do--Use Roda with RSpec3 so it is difficult to troubleshoot.
I am using Marston and Dees 'Effective Testing w/ RSpec3' book which uses Sinatra instead of Roda. I am having difficulty passing an object to API.new. From the book, this is what works with Sinatra but fails with 'wrong number of arguments' error when I substitute Roda.
Depending on whether I pass arguments with super or no no arguments with super(), the error switches to indicate that the failure occurs either at the initialize method or in the call to Rack::Test::Methods post in the spec.
I see that in Rack::Test in github repo README I may have to use Rack::Builder.parse_file("config.ru") but that didn't help.
Thanks for any thoughts, Nick
Here are the two errors that rspec shows.
When using super no brackets...
Failures:
MbrTrak::API POST /users when the user is successfully recorded returns the user id Failure/Error: post '/users', JSON.generate(user)
ArgumentError: wrong number of arguments (given 1, expected 0)
./spec/unit/app/api_spec.rb:21:in `block (4 levels) in module:MbrTrak'And when using super()...
MbrTrak::API POST /users when the user is successfully recorded returns the user id Failure/Error: super()
ArgumentError: wrong number of arguments (given 0, expected 1)
./app/api.rb:8:in `initialize' ./spec/unit/app/api_spec.rb:10:in `new' ./spec/unit/app/api_spec.rb:10:in `app' ./spec/unit/app/api_spec.rb:21:in `block (4 levels) in module:MbrTrak'Here is my api_spec.rb
Hello, I posted this on StackOverflow but think it might be more appropriate here.
- module MbrTrak
class API < Roda
def initialize(directory: Directory.new)
@directory = directory
super()
end