changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/failing_examples/team_spec.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
1require File.dirname(__FILE__) + '/spec_helper'
2
3
4class Team
5 attr_reader :players
6 def initialize
7 @players = Players.new
8 end
9end
10
11class Players
12 def initialize
13 @players = []
14 end
15 def size
16 @players.size
17 end
18 def include? player
19 raise "player must be a string" unless player.is_a?(String)
20 @players.include? player
21 end
22end
23
24describe "A new team" do
25
26 before(:each) do
27 @team = Team.new
28 end
29
30 it "should have 3 players (failing example)" do
31 @team.should have(3).players
32 end
33
34 it "should include some player (failing example)" do
35 @team.players.should include("Some Player")
36 end
37
38 it "should include 5 (failing example)" do
39 @team.players.should include(5)
40 end
41
42 it "should have no players"
43
44end