Skip to content

Instantly share code, notes, and snippets.

@moro
Created October 27, 2008 01:48
Show Gist options
  • Save moro/19995 to your computer and use it in GitHub Desktop.
Save moro/19995 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$KCODE = 'u'
require 'rubygems'
require 'hpricot'
require 'thin'
require 'rack'
describe "My Rails App" do
module Requests
def get(path)
Rack::MockRequest.new(@app).get(path)
end
end
include Requests
before(:all) do
@app = Rack::Adapter::Rails.new(:environment => "development")
end
describe "GET /" do
before do
@res = get("/")
end
it "body should have link to /login" do
Hpricot(@res.body).search("a[@href=/login]").should_not be_empty
end
it "@res.header.should include(Set-Cookie)" do
@res.headers.should include("Set-Cookie")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment