Closed volkanunsal closed 11 years ago
Try this:
RSpec.configure do |config|
config.include Rack::Test::Methods
end
class MyAPI < Grape::API
get "/", :rabl => "home" do
@user = current_user
end
end
describe "API" do
before { MyAPI.before { env["api.tilt.root"] = "path_to_views" } }
def app
MyAPI
end
it "success" do
get '/'
last_response.should be_success
end
end
Check also grape-rabl specs: https://github.com/LTe/grape-rabl/blob/master/spec/grape_rabl_spec.rb
Please re-open if you have any problems
Following up on my note on issue #2, I tried configuring the middleware from Rails application.rb.
While that works in other environments, it does not work in the test environment. Specifically, Rspec is complaining that it cannot find the root path for Tilt.