Commit 42f35f04 authored by John E. Vincent's avatar John E. Vincent

Rack::Test tests started

parent a94b187f
......@@ -44,6 +44,7 @@ class NoahApp < Sinatra::Base
end
not_found do
content_type "application/json"
erb :'404'
end
......
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Noah App Basics", :reset_redis => true do
it "should show the index page" do
get '/'
last_response.should be_ok
last_response.body.include?("Noah Start Page").should == true
end
it "should test the 404 message" do
get '/foo'
last_response.status.should == 404
last_response.headers["Content-Type"].should == "application/json"
response = JSON.parse(last_response.body)
response["result"].should == "failure"
response["error_message"].should == "Resource not found"
end
end
......@@ -7,8 +7,15 @@ rescue LoadError
end
require File.join(File.dirname(__FILE__), '..', 'config','db')
require File.join(File.dirname(__FILE__), '..', 'lib', 'models')
require File.join(File.dirname(__FILE__), '..', 'noah')
require 'rspec'
require 'rack/test'
RSpec.configure do |config|
config.before(:each, :reset_redis => true) { Ohm::redis.flushdb }
config.include Rack::Test::Methods
end
def app
NoahApp
end
{
"result":"failure",
"error_message":"Resource not found"
}
{"result":"failure","error_message":"Resource not found"}
{
"result":"failure",
"error_message":"<%= request.env['sinatra.error'].message %>"
}
{"result":"failure","error_message":"<%= request.env['sinatra.error'].message %>"}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment