Skip to content

Instantly share code, notes, and snippets.

@halorgium
Forked from wycats/possible_api.rb
Created September 12, 2008 00:22
Show Gist options
  • Save halorgium/10348 to your computer and use it in GitHub Desktop.
Save halorgium/10348 to your computer and use it in GitHub Desktop.
describe "Without logging in" do
describe "a request to /foo/bar" do
before(:each) do
get("/foo/bar")
end
it "redirects" do
rack.status.should == 302
end
it "shows a login page") do
rack.should redirect_to("/account/login")
end
end
end
describe "After logging in" do
describe "a request to /foo/bar" do
before(:each) do
post("/account/login", "username=myuser&password=awesomepass")
get("/foo/bar")
end
it "succeeds" do
rack.status.should == 200
end
it "shows a page" do
expected = html do
header "User"
element do
User.first.name
end
end
rack.body.should have_contents_like(expected)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment