Created
May 31, 2009 04:53
-
-
Save btakita/120764 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ramaze' | |
require 'rack/test' | |
require 'spec' | |
require 'spec/autorun' | |
require 'rr' | |
Spec::Runner.configure do |config| | |
config.mock_with :rr | |
end | |
module Innate | |
# minimal middleware, no exception handling | |
middleware(:spec){|m| m.innate } | |
# skip starting adapter | |
options.started = true | |
options.mode = :spec | |
end | |
module Ramaze | |
Mock::OPTIONS[:app] = Ramaze | |
middleware!(:spec){|m| m.run(AppMap) } | |
end | |
class Spec::ExampleGroup | |
include Rack::Test::Methods | |
before do | |
Ramaze.setup_dependencies | |
end | |
def app; Ramaze.middleware; end | |
end | |
require __DIR__('../start') | |
Ramaze.options.roots = __DIR__('../') | |
describe MainController do | |
it 'shows start page' do | |
get('/').status.should == 200 | |
last_response['Content-Type'].should == 'text/html' | |
last_response.should =~ /<h1>Welcome to Ramaze!<\/h1>/ | |
end | |
it 'shows /notemplate' do | |
get('/notemplate').status.should == 200 | |
last_response['Content-Type'].should == 'text/html' | |
last_response.should =~ /there is no 'notemplate\.xhtml' associated with this action/ | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment