Sha256: 90e66aa860dff915bd389904017bdfdd8d1fe1f386c92ebe67c6117dc4e65c32

Contents?: true

Size: 1.29 KB

Versions: 18

Compression:

Stored size: 1.29 KB

Contents

# Stella Test Plan - Cookies (2009-10-08)
#
# 1. START THE EXAMPLE APPLICATION
# 
# This test plan is written to work with the
# example application that ships with Stella. 
# See:
#
# $ stella example
#
#
# 2. RUN THE TEST PLAN
#
# $ stella verify -p examples/cookies/plan.rb http://127.0.0.1:3114/
#
desc "Cookies Examples"

usecase "Temporary Cookies" do
  
  # By default, Stella keeps temporary cookies available within 
  # a single usecase. The example application creates a cookie
  # called "bff-history" that contains the most recent search
  # terms. Before we run a search request, the cookie is empty.
  get "/", "Homepage" do
    response do
      puts "COOKIE: " << headers['Set-Cookie'].first
    end
  end
  
  # Here the cookie will contain the search term
  get "/search", "Search" do
    param :what  => random(['Big', 'Beads', 'Joe'])
    response do
      puts "COOKIE: " << headers['Set-Cookie'].first
    end
  end
  
  # And if we check the homepage again, the homepage now contains
  # a list of the most recent search terms. This shows how Stella
  # automatically sends the temporary cookie within a usecase.
  get "/", "Homepage" do
    response 200 do
      puts "You searched for: " << doc.css('ul#history a').first.content
    end
  end
  
end

# 2440c77ed4382b97fcbb3b1cfbc3be5d7ef3653f

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
stella-0.8.8.001 examples/cookies/plan.rb
stella-0.8.7.003 examples/cookies/plan.rb
stella-0.8.7.002 examples/cookies/plan.rb
stella-0.8.7.001 examples/cookies/plan.rb
stella-0.8.6.002 examples/cookies/plan.rb
stella-0.8.6.001 examples/cookies/plan.rb
stella-0.8.5.002 examples/cookies/plan.rb
stella-0.8.5.001 examples/cookies/plan.rb
stella-0.8.4.001 examples/cookies/plan.rb
stella-0.8.3.002 examples/cookies/plan.rb
stella-0.8.3.001 examples/cookies/plan.rb
stella-0.8.2.003 examples/cookies/plan.rb
stella-0.8.2.002 examples/cookies/plan.rb
stella-0.8.2.001 examples/cookies/plan.rb
stella-0.8.1.002 examples/cookies/plan.rb
stella-0.8.1.001 examples/cookies/plan.rb
stella-0.8.0.001 examples/cookies/plan.rb
stella-0.8.0.000 examples/cookies/plan.rb