changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/examples/pure/nested_classes_example.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'
2require File.dirname(__FILE__) + '/stack'
3
4class StackExamples < Spec::ExampleGroup
5 describe(Stack)
6 before(:each) do
7 @stack = Stack.new
8 end
9end
10
11class EmptyStackExamples < StackExamples
12 describe("when empty")
13 it "should be empty" do
14 @stack.should be_empty
15 end
16end
17
18class AlmostFullStackExamples < StackExamples
19 describe("when almost full")
20 before(:each) do
21 (1..9).each {|n| @stack.push n}
22 end
23 it "should be full" do
24 @stack.should_not be_full
25 end
26end
27
28class FullStackExamples < StackExamples
29 describe("when full")
30 before(:each) do
31 (1..10).each {|n| @stack.push n}
32 end
33 it "should be full" do
34 @stack.should be_full
35 end
36end