Sha256: 2647a39c3c9d70431c3918aae61e8177d47018c776ae59e2c1ca5f54c5bbff7f
Contents?: true
Size: 976 Bytes
Versions: 2
Compression:
Stored size: 976 Bytes
Contents
$:.unshift(File.dirname(__FILE__) + "/../lib/") require "cuba" require "cuba/test" form = <<EOS <form action="/login" method="post"> <input name="user"> <input type="submit" value="Login"> </form> EOS Cuba.define do on get do on path("login") do res.write "Enter your username" res.write form end on default do if session[:user] res.write "Hey #{session[:user]}!" else res.redirect "/login" end end end on post, path("login") do on param("user") do |user| session[:user] = user res.write "Got #{user}" end end end Cuba.test "Sample Site" do story "As a user I want to be able to login" do scenario "A user submits good info" do visit "/" assert_contain "Enter your username" fill_in "user", :with => "Michel" click_button "Login" assert_contain "Got Michel" visit "/" assert_contain "Hey Michel!" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cuba-0.0.5 | test/cuba_test.rb |
cuba-0.0.4 | test/cuba_test.rb |