RSpec configuration error?

8 views
Skip to first unread message

Paulo Fabiano Langer

unread,
Apr 12, 2018, 12:26:55 PM4/12/18
to Padrino Framework
Hi, Guys!

I work with a large application built with Padrino.

With this application we have lots of other mini-applications: app, api, admin, etc.

All of them are mounted on the apps.rb file in our config folder.

Our Api app is mounted like this: Padrino.mount('Api').to('/').host(/^api\.(ourdomain\.com|localhost)/)

We used to use Minitest in this application but we are trying to migrate to RSpec.

I created the very first rspec test below:

require 'spec_helper'

describe 'Stores', type: :request do
  describe 'GET :index' do
    it 'returns 200 HTTP status' do
      get '/v1/store/info.json'
    end
  end
end

But I am getting the following error:

1) Stores GET :index returns 200 HTTP status
     Failure/Error: end

     NoMethodError:
       undefined method `get' for #<RSpec::ExampleGroups::Stores::GETIndex:0x00007fd7e6fa8cf8>
       Did you mean?  gets
                                 gem

Any idea about the proper way to configure RSpec in Minitest? 
Do I still need to require rake/test?
Why exactly the get method was not found?

Thanks in advance,
Paulo

Paulo Fabiano Langer

unread,
Apr 12, 2018, 12:42:10 PM4/12/18
to Padrino Framework
One more thing: This type: :request is a 'rails thing' or can be used with Padrino?

Thanks,
Paulo

Matthias Guenther

unread,
May 14, 2018, 2:36:49 PM5/14/18
to Padrino Framework
Hi Paulo,

that is awesome to here, that you are going to test your application with rspec. The error you provided sounds, like you haven't configured your spec_helper.rb file in a not correct way. I think my file under https://github.com/padrinobook/job-vacancy/blob/master/spec/spec_helper.rb is a good foundation for you. If you have created your app from scratch with the option of using rspec as your testing framework, everything should be setup perfectly.

If that didn't help you, than please provide us a link to your app.

Cheers

Matthias

Matthias Guenther

unread,
May 14, 2018, 2:39:34 PM5/14/18
to Padrino Framework
The request thing you mentioned come from Rack https://www.rubydoc.info/gems/rack/Rack/Request and always contains the response from a request you are making with get, post and so on.
Reply all
Reply to author
Forward
0 new messages