File: retro_games.rb

package info (click to toggle)
libinnate-ruby 2010.07-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 812 kB
  • ctags: 621
  • sloc: ruby: 4,242; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 744 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require File.expand_path('../../../helper', __FILE__)
require File.expand_path('../../../../example/app/retro_games', __FILE__)

describe 'Retro-games app' do
  behaves_like :rack_test

  it 'lists the first game' do
    get '/'
    last_response.should =~ /1 => Pacman/
  end

  it 'has a form to add another game' do
    get '/'
    last_response.should =~ /<form/
  end

  it 'allows you to add another game' do
    post '/create', :name => 'Street Fighter II'
    follow_redirect!
    last_response.should =~ /0 =&gt; Street Fighter II/
  end

  it 'allows you to vote for a game' do
    get '/vote/Street+Fighter+II'
    follow_redirect!
    last_response.should =~ /1 =&gt; Street Fighter II/
  end

  FileUtils.rm_f('games.yaml')
end