Created
August 1, 2008 15:46
-
-
Save cschneid/3635 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 File.dirname(__FILE__) + '/spec_helper' | |
describe 'Sinatra app controllers' do | |
require 'sinatra_app' | |
specify "should retrieve a proper response from /" do | |
get_it '/' | |
@response.should be_ok | |
@response.elem('title').inner_text.should == "Web App Title Element" | |
end | |
specify "should have a login textbox and a submit button for /login" do | |
get_it '/login' | |
@response.should be_ok | |
@response.elem('input').first['type'].should == 'text' | |
@response.elem('input').last['type'].should == 'submit' | |
end | |
end |
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
$:.unshift("../sinatra/lib") | |
require 'sinatra' | |
require 'spec/interop/test' | |
require 'sinatra/test/unit' | |
set :views, File.join(File.dirname(__FILE__), '..', 'views') | |
class Rack::MockResponse | |
require 'hpricot' | |
def elem method | |
@page = Hpricot(self.body) unless @page | |
return (@page/method) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment