Skip to content

Instantly share code, notes, and snippets.

@btakita
Created May 31, 2009 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btakita/120764 to your computer and use it in GitHub Desktop.
Save btakita/120764 to your computer and use it in GitHub Desktop.
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