aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins/rspec/examples
diff options
context:
space:
mode:
authorfrancis <francis>2008-01-23 01:57:59 +0000
committerfrancis <francis>2008-01-23 01:57:59 +0000
commit6d1733e8a0b5f404326cfbd78b7139c87ecbffa3 (patch)
treec86561445b9ec5179020f8f56afb7b9174b390c5 /vendor/plugins/rspec/examples
parent8bd6667c7885870af45522315f501a2b87340b1a (diff)
Add files new to new rspec
Diffstat (limited to 'vendor/plugins/rspec/examples')
-rw-r--r--vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb19
-rw-r--r--vendor/plugins/rspec/examples/pure/before_and_after_example.rb40
-rw-r--r--vendor/plugins/rspec/examples/pure/behave_as_example.rb45
-rw-r--r--vendor/plugins/rspec/examples/pure/custom_expectation_matchers.rb54
-rw-r--r--vendor/plugins/rspec/examples/pure/custom_formatter.rb12
-rw-r--r--vendor/plugins/rspec/examples/pure/dynamic_spec.rb9
-rw-r--r--vendor/plugins/rspec/examples/pure/file_accessor.rb19
-rw-r--r--vendor/plugins/rspec/examples/pure/file_accessor_spec.rb38
-rw-r--r--vendor/plugins/rspec/examples/pure/greeter_spec.rb31
-rw-r--r--vendor/plugins/rspec/examples/pure/helper_method_example.rb14
-rw-r--r--vendor/plugins/rspec/examples/pure/io_processor.rb8
-rw-r--r--vendor/plugins/rspec/examples/pure/io_processor_spec.rb21
-rw-r--r--vendor/plugins/rspec/examples/pure/legacy_spec.rb11
-rw-r--r--vendor/plugins/rspec/examples/pure/mocking_example.rb27
-rw-r--r--vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb28
-rw-r--r--vendor/plugins/rspec/examples/pure/nested_classes_example.rb36
-rw-r--r--vendor/plugins/rspec/examples/pure/partial_mock_example.rb28
-rw-r--r--vendor/plugins/rspec/examples/pure/pending_example.rb20
-rw-r--r--vendor/plugins/rspec/examples/pure/predicate_example.rb27
-rw-r--r--vendor/plugins/rspec/examples/pure/priority.txt1
-rw-r--r--vendor/plugins/rspec/examples/pure/shared_example_group_example.rb81
-rw-r--r--vendor/plugins/rspec/examples/pure/shared_stack_examples.rb38
-rw-r--r--vendor/plugins/rspec/examples/pure/spec_helper.rb3
-rw-r--r--vendor/plugins/rspec/examples/pure/stack.rb36
-rw-r--r--vendor/plugins/rspec/examples/pure/stack_spec.rb63
-rw-r--r--vendor/plugins/rspec/examples/pure/stack_spec_with_nested_example_groups.rb67
-rw-r--r--vendor/plugins/rspec/examples/pure/stubbing_example.rb69
-rw-r--r--vendor/plugins/rspec/examples/stories/adder.rb13
-rw-r--r--vendor/plugins/rspec/examples/stories/addition34
-rw-r--r--vendor/plugins/rspec/examples/stories/addition.rb9
-rw-r--r--vendor/plugins/rspec/examples/stories/calculator.rb65
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/README.txt21
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb6
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb3
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb35
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb66
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story21
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story21
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story42
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story42
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story17
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story53
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb52
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb6
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb26
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb5
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb3
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt22
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/life.rb3
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb23
-rw-r--r--vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb43
-rw-r--r--vendor/plugins/rspec/examples/stories/helper.rb9
-rw-r--r--vendor/plugins/rspec/examples/stories/steps/addition_steps.rb18
53 files changed, 1503 insertions, 0 deletions
diff --git a/vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb b/vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb
new file mode 100644
index 000000000..a4928ef4a
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb
@@ -0,0 +1,19 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+# Run spec w/ -fs to see the output of this file
+
+describe "Examples with no descriptions" do
+
+ # description is auto-generated as "should equal(5)" based on the last #should
+ it do
+ 3.should equal(3)
+ 5.should equal(5)
+ end
+
+ it { 3.should be < 5 }
+
+ it { ["a"].should include("a") }
+
+ it { [1,2,3].should respond_to(:size) }
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/before_and_after_example.rb b/vendor/plugins/rspec/examples/pure/before_and_after_example.rb
new file mode 100644
index 000000000..7db6274ef
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/before_and_after_example.rb
@@ -0,0 +1,40 @@
+require File.dirname(__FILE__) + '/spec_helper'
+$global = 0
+
+describe "State created in before(:all)" do
+ before :all do
+ @sideeffect = 1
+ $global +=1
+ end
+
+ before :each do
+ @isolated = 1
+ end
+
+ it "should be accessible from example" do
+ @sideeffect.should == 1
+ $global.should == 1
+ @isolated.should == 1
+
+ @sideeffect += 1
+ @isolated += 1
+ end
+
+ it "should not have sideffects" do
+ @sideeffect.should == 1
+ $global.should == 2
+ @isolated.should == 1
+
+ @sideeffect += 1
+ @isolated += 1
+ end
+
+ after :each do
+ $global += 1
+ end
+
+ after :all do
+ $global.should == 3
+ $global = 0
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/behave_as_example.rb b/vendor/plugins/rspec/examples/pure/behave_as_example.rb
new file mode 100644
index 000000000..e95d1469a
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/behave_as_example.rb
@@ -0,0 +1,45 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+def behave_as_electric_musician
+ respond_to(:read_notes, :turn_down_amp)
+end
+
+def behave_as_musician
+ respond_to(:read_notes)
+end
+
+module BehaveAsExample
+
+ class BluesGuitarist
+ def read_notes; end
+ def turn_down_amp; end
+ end
+
+ class RockGuitarist
+ def read_notes; end
+ def turn_down_amp; end
+ end
+
+ class ClassicGuitarist
+ def read_notes; end
+ end
+
+ describe BluesGuitarist do
+ it "should behave as guitarist" do
+ BluesGuitarist.new.should behave_as_electric_musician
+ end
+ end
+
+ describe RockGuitarist do
+ it "should behave as guitarist" do
+ RockGuitarist.new.should behave_as_electric_musician
+ end
+ end
+
+ describe ClassicGuitarist do
+ it "should not behave as guitarist" do
+ ClassicGuitarist.new.should behave_as_musician
+ end
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/custom_expectation_matchers.rb b/vendor/plugins/rspec/examples/pure/custom_expectation_matchers.rb
new file mode 100644
index 000000000..075bb542d
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/custom_expectation_matchers.rb
@@ -0,0 +1,54 @@
+module AnimalSpecHelper
+ class Eat
+ def initialize(food)
+ @food = food
+ end
+
+ def matches?(animal)
+ @animal = animal
+ @animal.eats?(@food)
+ end
+
+ def failure_message
+ "expected #{@animal} to eat #{@food}, but it does not"
+ end
+
+ def negative_failure_message
+ "expected #{@animal} not to eat #{@food}, but it does"
+ end
+ end
+
+ def eat(food)
+ Eat.new(food)
+ end
+end
+
+module Animals
+ class Animal
+ def eats?(food)
+ return foods_i_eat.include?(food)
+ end
+ end
+
+ class Mouse < Animal
+ def foods_i_eat
+ [:cheese]
+ end
+ end
+
+ describe Mouse do
+ include AnimalSpecHelper
+ before(:each) do
+ @mouse = Animals::Mouse.new
+ end
+
+ it "should eat cheese" do
+ @mouse.should eat(:cheese)
+ end
+
+ it "should not eat cat" do
+ @mouse.should_not eat(:cat)
+ end
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/custom_formatter.rb b/vendor/plugins/rspec/examples/pure/custom_formatter.rb
new file mode 100644
index 000000000..c449fdc2e
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/custom_formatter.rb
@@ -0,0 +1,12 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require 'spec/runner/formatter/progress_bar_formatter'
+
+# Example of a formatter with custom bactrace printing. Run me with:
+# ruby bin/spec failing_examples -r examples/custom_formatter.rb -f CustomFormatter
+class CustomFormatter < Spec::Runner::Formatter::ProgressBarFormatter
+ def backtrace_line(line)
+ line.gsub(/([^:]*\.rb):(\d*)/) do
+ "<a href=\"file://#{File.expand_path($1)}\">#{$1}:#{$2}</a> "
+ end
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/dynamic_spec.rb b/vendor/plugins/rspec/examples/pure/dynamic_spec.rb
new file mode 100644
index 000000000..15d473d61
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/dynamic_spec.rb
@@ -0,0 +1,9 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "Some integers" do
+ (1..10).each do |n|
+ it "The root of #{n} square should be #{n}" do
+ Math.sqrt(n*n).should == n
+ end
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/file_accessor.rb b/vendor/plugins/rspec/examples/pure/file_accessor.rb
new file mode 100644
index 000000000..ff6fb743c
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/file_accessor.rb
@@ -0,0 +1,19 @@
+require File.dirname(__FILE__) + '/spec_helper'
+class FileAccessor
+ def open_and_handle_with(pathname, processor)
+ pathname.open do |io|
+ processor.process(io)
+ end
+ end
+end
+
+if __FILE__ == $0
+ require File.dirname(__FILE__) + '/io_processor'
+ require 'pathname'
+
+ accessor = FileAccessor.new
+ io_processor = IoProcessor.new
+ file = Pathname.new ARGV[0]
+
+ accessor.open_and_handle_with(file, io_processor)
+end
diff --git a/vendor/plugins/rspec/examples/pure/file_accessor_spec.rb b/vendor/plugins/rspec/examples/pure/file_accessor_spec.rb
new file mode 100644
index 000000000..628d4c0b0
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/file_accessor_spec.rb
@@ -0,0 +1,38 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/file_accessor'
+require 'stringio'
+
+describe "A FileAccessor" do
+ # This sequence diagram illustrates what this spec specifies.
+ #
+ # +--------------+ +----------+ +-------------+
+ # | FileAccessor | | Pathname | | IoProcessor |
+ # +--------------+ +----------+ +-------------+
+ # | | |
+ # open_and_handle_with | | |
+ # -------------------->| | open | |
+ # | |--------------->| | |
+ # | | io | | |
+ # | |<...............| | |
+ # | | | process(io) |
+ # | |---------------------------------->| |
+ # | | | | |
+ # | |<..................................| |
+ # | | |
+ #
+ it "should open a file and pass it to the processor's process method" do
+ # This is the primary actor
+ accessor = FileAccessor.new
+
+ # These are the primary actor's neighbours, which we mock.
+ file = mock "Pathname"
+ io_processor = mock "IoProcessor"
+
+ io = StringIO.new "whatever"
+ file.should_receive(:open).and_yield io
+ io_processor.should_receive(:process).with(io)
+
+ accessor.open_and_handle_with(file, io_processor)
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/greeter_spec.rb b/vendor/plugins/rspec/examples/pure/greeter_spec.rb
new file mode 100644
index 000000000..ec7669dcc
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/greeter_spec.rb
@@ -0,0 +1,31 @@
+require File.dirname(__FILE__) + '/spec_helper'
+# greeter.rb
+#
+# Based on http://glu.ttono.us/articles/2006/12/19/tormenting-your-tests-with-heckle
+#
+# Run with:
+#
+# spec greeter_spec.rb --heckle Greeter
+#
+class Greeter
+ def initialize(person = nil)
+ @person = person
+ end
+
+ def greet
+ @person.nil? ? "Hi there!" : "Hi #{@person}!"
+ end
+end
+
+describe "Greeter" do
+ it "should say Hi to person" do
+ greeter = Greeter.new("Kevin")
+ greeter.greet.should == "Hi Kevin!"
+ end
+
+ it "should say Hi to nobody" do
+ greeter = Greeter.new
+ # Uncomment the next line to make Heckle happy
+ #greeter.greet.should == "Hi there!"
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/helper_method_example.rb b/vendor/plugins/rspec/examples/pure/helper_method_example.rb
new file mode 100644
index 000000000..d97f19e65
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/helper_method_example.rb
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+module HelperMethodExample
+ describe "an example group with helper a method" do
+ def helper_method
+ "received call"
+ end
+
+ it "should make that method available to specs" do
+ helper_method.should == "received call"
+ end
+ end
+end
+
diff --git a/vendor/plugins/rspec/examples/pure/io_processor.rb b/vendor/plugins/rspec/examples/pure/io_processor.rb
new file mode 100644
index 000000000..6b15147b6
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/io_processor.rb
@@ -0,0 +1,8 @@
+class DataTooShort < StandardError; end
+
+class IoProcessor
+ # Does some fancy stuff unless the length of +io+ is shorter than 32
+ def process(io)
+ raise DataTooShort if io.read.length < 32
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/io_processor_spec.rb b/vendor/plugins/rspec/examples/pure/io_processor_spec.rb
new file mode 100644
index 000000000..5cab7bf31
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/io_processor_spec.rb
@@ -0,0 +1,21 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/io_processor'
+require 'stringio'
+
+describe "An IoProcessor" do
+ before(:each) do
+ @processor = IoProcessor.new
+ end
+
+ it "should raise nothing when the file is exactly 32 bytes" do
+ lambda {
+ @processor.process(StringIO.new("z"*32))
+ }.should_not raise_error
+ end
+
+ it "should raise an exception when the file length is less than 32 bytes" do
+ lambda {
+ @processor.process(StringIO.new("z"*31))
+ }.should raise_error(DataTooShort)
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/legacy_spec.rb b/vendor/plugins/rspec/examples/pure/legacy_spec.rb
new file mode 100644
index 000000000..c86369515
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/legacy_spec.rb
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/spec_helper'
+context "A legacy spec" do
+ setup do
+ end
+
+ specify "should work fine" do
+ end
+
+ teardown do
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/mocking_example.rb b/vendor/plugins/rspec/examples/pure/mocking_example.rb
new file mode 100644
index 000000000..6adbef59d
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/mocking_example.rb
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "A consumer of a mock" do
+ it "should be able to send messages to the mock" do
+ mock = mock("poke me")
+ mock.should_receive(:poke)
+ mock.poke
+ end
+end
+
+describe "a mock" do
+ it "should be able to mock the same message twice w/ different args" do
+ mock = mock("mock")
+ mock.should_receive(:msg).with(:arg1).and_return(:val1)
+ mock.should_receive(:msg).with(:arg2).and_return(:val2)
+ mock.msg(:arg1).should eql(:val1)
+ mock.msg(:arg2).should eql(:val2)
+ end
+
+ it "should be able to mock the same message twice w/ different args in reverse order" do
+ mock = mock("mock")
+ mock.should_receive(:msg).with(:arg1).and_return(:val1)
+ mock.should_receive(:msg).with(:arg2).and_return(:val2)
+ mock.msg(:arg2).should eql(:val2)
+ mock.msg(:arg1).should eql(:val1)
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb b/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
new file mode 100644
index 000000000..36edcd497
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
@@ -0,0 +1,28 @@
+class MultiThreadedExampleGroupRunner < Spec::Runner::ExampleGroupRunner
+ def initialize(options, arg)
+ super(options)
+ # configure these
+ @thread_count = 4
+ @thread_wait = 0
+ end
+
+ def run
+ @threads = []
+ q = Queue.new
+ example_groups.each { |b| q << b}
+ success = true
+ @thread_count.times do
+ @threads << Thread.new(q) do |queue|
+ while not queue.empty?
+ example_group = queue.pop
+ success &= example_group.suite.run(nil)
+ end
+ end
+ sleep @thread_wait
+ end
+ @threads.each {|t| t.join}
+ success
+ end
+end
+
+MultiThreadedBehaviourRunner = MultiThreadedExampleGroupRunner \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/pure/nested_classes_example.rb b/vendor/plugins/rspec/examples/pure/nested_classes_example.rb
new file mode 100644
index 000000000..abe43b0a6
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/nested_classes_example.rb
@@ -0,0 +1,36 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/stack'
+
+class StackExamples < Spec::ExampleGroup
+ describe(Stack)
+ before(:each) do
+ @stack = Stack.new
+ end
+end
+
+class EmptyStackExamples < StackExamples
+ describe("when empty")
+ it "should be empty" do
+ @stack.should be_empty
+ end
+end
+
+class AlmostFullStackExamples < StackExamples
+ describe("when almost full")
+ before(:each) do
+ (1..9).each {|n| @stack.push n}
+ end
+ it "should be full" do
+ @stack.should_not be_full
+ end
+end
+
+class FullStackExamples < StackExamples
+ describe("when full")
+ before(:each) do
+ (1..10).each {|n| @stack.push n}
+ end
+ it "should be full" do
+ @stack.should be_full
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/pure/partial_mock_example.rb b/vendor/plugins/rspec/examples/pure/partial_mock_example.rb
new file mode 100644
index 000000000..841ec8847
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/partial_mock_example.rb
@@ -0,0 +1,28 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+class MockableClass
+ def self.find id
+ return :original_return
+ end
+end
+
+describe "A partial mock" do
+
+ it "should work at the class level" do
+ MockableClass.should_receive(:find).with(1).and_return {:stub_return}
+ MockableClass.find(1).should equal(:stub_return)
+ end
+
+ it "should revert to the original after each spec" do
+ MockableClass.find(1).should equal(:original_return)
+ end
+
+ it "can be mocked w/ ordering" do
+ MockableClass.should_receive(:msg_1).ordered
+ MockableClass.should_receive(:msg_2).ordered
+ MockableClass.should_receive(:msg_3).ordered
+ MockableClass.msg_1
+ MockableClass.msg_2
+ MockableClass.msg_3
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/pending_example.rb b/vendor/plugins/rspec/examples/pure/pending_example.rb
new file mode 100644
index 000000000..13f3d00c4
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/pending_example.rb
@@ -0,0 +1,20 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "pending example (using pending method)" do
+ it %Q|should be reported as "PENDING: for some reason"| do
+ pending("for some reason")
+ end
+end
+
+describe "pending example (with no block)" do
+ it %Q|should be reported as "PENDING: Not Yet Implemented"|
+end
+
+describe "pending example (with block for pending)" do
+ it %Q|should have a failing block, passed to pending, reported as "PENDING: for some reason"| do
+ pending("for some reason") do
+ raise "some reason"
+ end
+ end
+end
+
diff --git a/vendor/plugins/rspec/examples/pure/predicate_example.rb b/vendor/plugins/rspec/examples/pure/predicate_example.rb
new file mode 100644
index 000000000..1202bb670
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/predicate_example.rb
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+class BddFramework
+ def intuitive?
+ true
+ end
+
+ def adopted_quickly?
+ true
+ end
+end
+
+describe "BDD framework" do
+
+ before(:each) do
+ @bdd_framework = BddFramework.new
+ end
+
+ it "should be adopted quickly" do
+ @bdd_framework.should be_adopted_quickly
+ end
+
+ it "should be intuitive" do
+ @bdd_framework.should be_intuitive
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/priority.txt b/vendor/plugins/rspec/examples/pure/priority.txt
new file mode 100644
index 000000000..5b00064e2
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/priority.txt
@@ -0,0 +1 @@
+examples/custom_expectation_matchers.rb \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/pure/shared_example_group_example.rb b/vendor/plugins/rspec/examples/pure/shared_example_group_example.rb
new file mode 100644
index 000000000..fb81af1ec
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/shared_example_group_example.rb
@@ -0,0 +1,81 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+module SharedExampleGroupExample
+ class OneThing
+ def what_things_do
+ "stuff"
+ end
+ end
+
+ class AnotherThing
+ def what_things_do
+ "stuff"
+ end
+ end
+
+ class YetAnotherThing
+ def what_things_do
+ "stuff"
+ end
+ end
+
+ # A SharedExampleGroup is an example group that doesn't get run.
+ # You can create one like this:
+ share_examples_for "most things" do
+ def helper_method
+ "helper method"
+ end
+
+ it "should do what things do" do
+ @thing.what_things_do.should == "stuff"
+ end
+ end
+
+ # A SharedExampleGroup is also module. If you create one like this
+ # it gets assigned to the constant AllThings
+ share_as :MostThings do
+ def helper_method
+ "helper method"
+ end
+
+ it "should do what things do" do
+ @thing.what_things_do.should == "stuff"
+ end
+ end
+
+ describe OneThing do
+ # Now you can include the shared example group like this, which
+ # feels more like what you might say ...
+ it_should_behave_like "most things"
+
+ before(:each) { @thing = OneThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
+ end
+
+ describe AnotherThing do
+ # ... or you can include the example group like this, which
+ # feels more like the programming language we love.
+ it_should_behave_like MostThings
+
+ before(:each) { @thing = AnotherThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
+ end
+
+ describe YetAnotherThing do
+ # ... or you can include the example group like this, which
+ # feels more like the programming language we love.
+ include MostThings
+
+ before(:each) { @thing = AnotherThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
+ end
+end
diff --git a/vendor/plugins/rspec/examples/pure/shared_stack_examples.rb b/vendor/plugins/rspec/examples/pure/shared_stack_examples.rb
new file mode 100644
index 000000000..7a0816250
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/shared_stack_examples.rb
@@ -0,0 +1,38 @@
+require File.join(File.dirname(__FILE__), *%w[spec_helper])
+
+shared_examples_for "non-empty Stack" do
+
+ it { @stack.should_not be_empty }
+
+ it "should return the top item when sent #peek" do
+ @stack.peek.should == @last_item_added
+ end
+
+ it "should NOT remove the top item when sent #peek" do
+ @stack.peek.should == @last_item_added
+ @stack.peek.should == @last_item_added
+ end
+
+ it "should return the top item when sent #pop" do
+ @stack.pop.should == @last_item_added
+ end
+
+ it "should remove the top item when sent #pop" do
+ @stack.pop.should == @last_item_added
+ unless @stack.empty?
+ @stack.pop.should_not == @last_item_added
+ end
+ end
+
+end
+
+shared_examples_for "non-full Stack" do
+
+ it { @stack.should_not be_full }
+
+ it "should add to the top when sent #push" do
+ @stack.push "newly added top item"
+ @stack.peek.should == "newly added top item"
+ end
+
+end \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/pure/spec_helper.rb b/vendor/plugins/rspec/examples/pure/spec_helper.rb
new file mode 100644
index 000000000..1e880796c
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/spec_helper.rb
@@ -0,0 +1,3 @@
+lib_path = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
+$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
+require 'spec'
diff --git a/vendor/plugins/rspec/examples/pure/stack.rb b/vendor/plugins/rspec/examples/pure/stack.rb
new file mode 100644
index 000000000..407173f7b
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/stack.rb
@@ -0,0 +1,36 @@
+class StackUnderflowError < RuntimeError
+end
+
+class StackOverflowError < RuntimeError
+end
+
+class Stack
+
+ def initialize
+ @items = []
+ end
+
+ def push object
+ raise StackOverflowError if @items.length == 10
+ @items.push object
+ end
+
+ def pop
+ raise StackUnderflowError if @items.empty?
+ @items.delete @items.last
+ end
+
+ def peek
+ raise StackUnderflowError if @items.empty?
+ @items.last
+ end
+
+ def empty?
+ @items.empty?
+ end
+
+ def full?
+ @items.length == 10
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/stack_spec.rb b/vendor/plugins/rspec/examples/pure/stack_spec.rb
new file mode 100644
index 000000000..2a769da00
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/stack_spec.rb
@@ -0,0 +1,63 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + "/stack"
+require File.dirname(__FILE__) + '/shared_stack_examples'
+
+describe Stack, " (empty)" do
+ before(:each) do
+ @stack = Stack.new
+ end
+
+ # NOTE that this one auto-generates the description "should be empty"
+ it { @stack.should be_empty }
+
+ it_should_behave_like "non-full Stack"
+
+ it "should complain when sent #peek" do
+ lambda { @stack.peek }.should raise_error(StackUnderflowError)
+ end
+
+ it "should complain when sent #pop" do
+ lambda { @stack.pop }.should raise_error(StackUnderflowError)
+ end
+end
+
+describe Stack, " (with one item)" do
+ before(:each) do
+ @stack = Stack.new
+ @stack.push 3
+ @last_item_added = 3
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+
+end
+
+describe Stack, " (with one item less than capacity)" do
+ before(:each) do
+ @stack = Stack.new
+ (1..9).each { |i| @stack.push i }
+ @last_item_added = 9
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+end
+
+describe Stack, " (full)" do
+ before(:each) do
+ @stack = Stack.new
+ (1..10).each { |i| @stack.push i }
+ @last_item_added = 10
+ end
+
+ # NOTE that this one auto-generates the description "should be full"
+ it { @stack.should be_full }
+
+ it_should_behave_like "non-empty Stack"
+
+ it "should complain on #push" do
+ lambda { @stack.push Object.new }.should raise_error(StackOverflowError)
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/stack_spec_with_nested_example_groups.rb b/vendor/plugins/rspec/examples/pure/stack_spec_with_nested_example_groups.rb
new file mode 100644
index 000000000..05f6ad464
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/stack_spec_with_nested_example_groups.rb
@@ -0,0 +1,67 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/stack'
+require File.dirname(__FILE__) + '/shared_stack_examples'
+
+describe Stack do
+
+ before(:each) do
+ @stack = Stack.new
+ end
+
+ describe "(empty)" do
+
+ it { @stack.should be_empty }
+
+ it_should_behave_like "non-full Stack"
+
+ it "should complain when sent #peek" do
+ lambda { @stack.peek }.should raise_error(StackUnderflowError)
+ end
+
+ it "should complain when sent #pop" do
+ lambda { @stack.pop }.should raise_error(StackUnderflowError)
+ end
+
+ end
+
+ describe "(with one item)" do
+
+ before(:each) do
+ @stack.push 3
+ @last_item_added = 3
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+
+ end
+
+ describe "(with one item less than capacity)" do
+
+ before(:each) do
+ (1..9).each { |i| @stack.push i }
+ @last_item_added = 9
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+ end
+
+ describe "(full)" do
+
+ before(:each) do
+ (1..10).each { |i| @stack.push i }
+ @last_item_added = 10
+ end
+
+ it { @stack.should be_full }
+
+ it_should_behave_like "non-empty Stack"
+
+ it "should complain on #push" do
+ lambda { @stack.push Object.new }.should raise_error(StackOverflowError)
+ end
+
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/pure/stubbing_example.rb b/vendor/plugins/rspec/examples/pure/stubbing_example.rb
new file mode 100644
index 000000000..31354aec6
--- /dev/null
+++ b/vendor/plugins/rspec/examples/pure/stubbing_example.rb
@@ -0,0 +1,69 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "A consumer of a stub" do
+ it "should be able to stub methods on any Object" do
+ obj = Object.new
+ obj.stub!(:foobar).and_return {:return_value}
+ obj.foobar.should equal(:return_value)
+ end
+end
+
+class StubbableClass
+ def self.find id
+ return :original_return
+ end
+end
+
+describe "A stubbed method on a class" do
+ it "should return the stubbed value" do
+ StubbableClass.stub!(:find).and_return(:stub_return)
+ StubbableClass.find(1).should equal(:stub_return)
+ end
+
+ it "should revert to the original method after each spec" do
+ StubbableClass.find(1).should equal(:original_return)
+ end
+
+ it "can stub! and mock the same message" do
+ StubbableClass.stub!(:msg).and_return(:stub_value)
+ StubbableClass.should_receive(:msg).with(:arg).and_return(:mock_value)
+
+ StubbableClass.msg.should equal(:stub_value)
+ StubbableClass.msg(:other_arg).should equal(:stub_value)
+ StubbableClass.msg(:arg).should equal(:mock_value)
+ StubbableClass.msg(:another_arg).should equal(:stub_value)
+ StubbableClass.msg(:yet_another_arg).should equal(:stub_value)
+ StubbableClass.msg.should equal(:stub_value)
+ end
+end
+
+describe "A mock" do
+ it "can stub!" do
+ mock = mock("stubbing mock")
+ mock.stub!(:msg).and_return(:value)
+ (1..10).each {mock.msg.should equal(:value)}
+ end
+
+ it "can stub! and mock" do
+ mock = mock("stubbing mock")
+ mock.stub!(:stub_message).and_return(:stub_value)
+ mock.should_receive(:mock_message).once.and_return(:mock_value)
+ (1..10).each {mock.stub_message.should equal(:stub_value)}
+ mock.mock_message.should equal(:mock_value)
+ (1..10).each {mock.stub_message.should equal(:stub_value)}
+ end
+
+ it "can stub! and mock the same message" do
+ mock = mock("stubbing mock")
+ mock.stub!(:msg).and_return(:stub_value)
+ mock.should_receive(:msg).with(:arg).and_return(:mock_value)
+ mock.msg.should equal(:stub_value)
+ mock.msg(:other_arg).should equal(:stub_value)
+ mock.msg(:arg).should equal(:mock_value)
+ mock.msg(:another_arg).should equal(:stub_value)
+ mock.msg(:yet_another_arg).should equal(:stub_value)
+ mock.msg.should equal(:stub_value)
+ end
+end
+
+
diff --git a/vendor/plugins/rspec/examples/stories/adder.rb b/vendor/plugins/rspec/examples/stories/adder.rb
new file mode 100644
index 000000000..0b027b0ff
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/adder.rb
@@ -0,0 +1,13 @@
+class Adder
+ def initialize
+ @addends = []
+ end
+
+ def <<(val)
+ @addends << val
+ end
+
+ def sum
+ @addends.inject(0) { |sum_so_far, val| sum_so_far + val }
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/stories/addition b/vendor/plugins/rspec/examples/stories/addition
new file mode 100644
index 000000000..58f092990
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/addition
@@ -0,0 +1,34 @@
+This is a story about a calculator. The text up here above the Story: declaration
+won't be processed, so you can write whatever you wish!
+
+Story: simple addition
+
+ As an accountant
+ I want to add numbers
+ So that I can count beans
+
+ Scenario: add one plus one
+ Given an addend of 1
+ And an addend of 1
+
+ When the addends are addeds
+
+ Then the sum should be 3
+ And the corks should be popped
+
+ Scenario: add two plus five
+ Given an addend of 2
+ And an addend of 5
+
+ When the addends are added
+
+ Then the sum should be 7
+ Then it should snow
+
+ Scenario: add three more
+ GivenScenario add two plus five
+ And an addend of 3
+
+ When the addends are added
+
+ Then the sum should be 10
diff --git a/vendor/plugins/rspec/examples/stories/addition.rb b/vendor/plugins/rspec/examples/stories/addition.rb
new file mode 100644
index 000000000..e43f5cf39
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/addition.rb
@@ -0,0 +1,9 @@
+require File.join(File.dirname(__FILE__), "helper")
+require File.join(File.dirname(__FILE__), "adder")
+
+# with_steps_for :addition, :more_addition do
+with_steps_for :addition, :more_addition do
+ # Then("the corks should be popped") { }
+ run File.expand_path(__FILE__).gsub(".rb","")
+end
+
diff --git a/vendor/plugins/rspec/examples/stories/calculator.rb b/vendor/plugins/rspec/examples/stories/calculator.rb
new file mode 100644
index 000000000..390437c55
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/calculator.rb
@@ -0,0 +1,65 @@
+$:.push File.join(File.dirname(__FILE__), *%w[.. .. lib])
+require 'spec'
+
+class AdditionMatchers < Spec::Story::StepGroup
+ steps do |add|
+ add.given("an addend of $addend") do |addend|
+ @adder ||= Adder.new
+ @adder << addend.to_i
+ end
+ end
+end
+
+steps = AdditionMatchers.new do |add|
+ add.then("the sum should be $sum") do |sum|
+ @sum.should == sum.to_i
+ end
+end
+
+steps.when("they are added") do
+ @sum = @adder.sum
+end
+
+# This Story uses steps (see above) instead of blocks
+# passed to Given, When and Then
+
+Story "addition", %{
+ As an accountant
+ I want to add numbers
+ So that I can count some beans
+}, :steps => steps do
+ Scenario "2 + 3" do
+ Given "an addend of 2"
+ And "an addend of 3"
+ When "they are added"
+ Then "the sum should be 5"
+ end
+
+ # This scenario uses GivenScenario, which silently runs
+ # all the steps in a previous scenario.
+
+ Scenario "add 4 more" do
+ GivenScenario "2 + 3"
+ Given "an addend of 4"
+ When "they are added"
+ Then "the sum should be 9"
+ end
+end
+
+# And the class that makes the story pass
+
+class Adder
+ def << addend
+ addends << addend
+ end
+
+ def sum
+ @addends.inject(0) do |result, addend|
+ result + addend.to_i
+ end
+ end
+
+ def addends
+ @addends ||= []
+ end
+end
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/README.txt b/vendor/plugins/rspec/examples/stories/game-of-life/README.txt
new file mode 100644
index 000000000..9624ad411
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/README.txt
@@ -0,0 +1,21 @@
+John Conway's Game of Life
+
+The Rules
+---------
+The Game of Life was invented by John Conway (as you might have gathered).
+The game is played on a field of cells, each of which has eight neighbors (adjacent cells).
+A cell is either occupied (by an organism) or not.
+The rules for deriving a generation from the previous one are these:
+
+Survival
+--------
+If an occupied cell has 2 or 3 neighbors, the organism survives to the next generation.
+
+Death
+-----
+If an occupied cell has 0, 1, 4, 5, 6, 7, or 8 occupied neighbors, the organism dies
+(0, 1: of loneliness; 4 thru 8: of overcrowding).
+
+Birth
+-----
+If an unoccupied cell has 3 occupied neighbors, it becomes occupied.
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb
new file mode 100644
index 000000000..90a281da5
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb
@@ -0,0 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'lib')
+$:.unshift File.join(File.dirname(__FILE__), '..')
+
+require 'spec'
+require 'behaviour/examples/examples'
+require 'behaviour/stories/stories'
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb
new file mode 100644
index 000000000..1cadfb3c1
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb
@@ -0,0 +1,3 @@
+require 'spec'
+require 'behaviour/examples/game_behaviour'
+require 'behaviour/examples/grid_behaviour'
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
new file mode 100644
index 000000000..ff5b357f0
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
@@ -0,0 +1,35 @@
+require 'life'
+
+describe Game do
+ it 'should have a grid' do
+ # given
+ game = Game.new(5, 5)
+
+ # then
+ game.grid.should be_kind_of(Grid)
+ end
+
+ it 'should create a cell' do
+ # given
+ game = Game.new(2, 2)
+ expected_grid = Grid.from_string( 'X. ..' )
+
+ # when
+ game.create_at(0, 0)
+
+ # then
+ game.grid.should == expected_grid
+ end
+
+ it 'should destroy a cell' do
+ # given
+ game = Game.new(2,2)
+ game.grid = Grid.from_string('X. ..')
+
+ # when
+ game.destroy_at(0,0)
+
+ # then
+ game.grid.should == Grid.from_string('.. ..')
+ end
+end
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
new file mode 100644
index 000000000..5be3af519
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
@@ -0,0 +1,66 @@
+describe Grid do
+ it 'should be empty when created' do
+ # given
+ expected_contents = [
+ [0, 0, 0],
+ [0, 0, 0]
+ ]
+ grid = Grid.new(2, 3)
+
+ # when
+ contents = grid.contents
+
+ # then
+ contents.should == expected_contents
+ end
+
+ it 'should compare equal based on its contents' do
+ # given
+ grid1 = Grid.new(2, 3)
+ grid2 = Grid.new(2, 3)
+
+ # then
+ grid1.should == grid2
+ end
+
+ it 'should be able to replace its contents' do
+ # given
+ grid = Grid.new(2,2)
+ new_contents = [[0,1,0], [1,0,1]]
+
+ # when
+ grid.contents = new_contents
+
+ # then
+ grid.contents.should == new_contents
+ grid.rows.should == 2
+ grid.columns.should == 3
+ end
+
+ it 'should add an organism' do
+ # given
+ grid = Grid.new(2, 2)
+ expected = Grid.new(2, 2)
+ expected.contents = [[1,0],[0,0]]
+
+ # when
+ grid.create_at(0,0)
+
+ # then
+ grid.should == expected
+ end
+
+ it 'should create itself from a string' do
+ # given
+ expected = Grid.new 3, 3
+ expected.create_at(0,0)
+ expected.create_at(1,0)
+ expected.create_at(2,2)
+
+ # when
+ actual = Grid.from_string "X.. X.. ..X"
+
+ # then
+ actual.should == expected
+ end
+end
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
new file mode 100644
index 000000000..8374e86c5
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
@@ -0,0 +1,21 @@
+Story: cells with less than two neighbours die
+
+As a game producer
+I want cells with less than two neighbours to die
+So that I can illustrate how the game works to people with money
+
+Scenario: cells with zero or one neighbour die
+
+Given the grid looks like
+........
+.XX.XX..
+.XX.....
+....X...
+........
+When the next step occurs
+Then the grid should look like
+........
+.XX.....
+.XX.....
+........
+........
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
new file mode 100644
index 000000000..0d30b59be
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
@@ -0,0 +1,21 @@
+Story: cells with more than three neighbours die
+
+As a game producer
+I want cells with more than three neighbours to die
+So that I can show the people with money how we are getting on
+
+Scenario: blink
+
+Given the grid looks like
+.....
+...XX
+...XX
+.XX..
+.XX..
+When the next step occurs
+Then the grid should look like
+.....
+...XX
+....X
+.X...
+.XX..
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
new file mode 100644
index 000000000..cbc248e73
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
@@ -0,0 +1,42 @@
+Story: Empty spaces with three neighbours create a cell
+
+As a game producer
+I want empty cells with three neighbours to die
+So that I have a minimum feature set to ship
+
+Scenario: the glider
+
+Given the grid looks like
+...X..
+..X...
+..XXX.
+......
+......
+When the next step occurs
+Then the grid should look like
+......
+..X.X.
+..XX..
+...X..
+......
+When the next step occurs
+Then the grid should look like
+......
+..X...
+..X.X.
+..XX..
+......
+When the next step occurs
+Then the grid should look like
+......
+...X..
+.XX...
+..XX..
+......
+When the next step occurs
+Then the grid should look like
+......
+..X...
+.X....
+.XXX..
+......
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
new file mode 100644
index 000000000..88895cb69
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
@@ -0,0 +1,42 @@
+Story: I can create a cell
+
+As a game producer
+I want to create a cell
+So that I can show the grid to people
+
+Scenario: nothing to see here
+
+Given a 3 x 3 game
+Then the grid should look like
+...
+...
+...
+
+Scenario: all on its lonesome
+
+Given a 3 x 3 game
+When I create a cell at 1, 1
+Then the grid should look like
+...
+.X.
+...
+
+Scenario: the grid has three cells
+
+Given a 3 x 3 game
+When I create a cell at 0, 0
+and I create a cell at 0, 1
+and I create a cell at 2, 2
+Then the grid should look like
+XX.
+...
+..X
+
+Scenario: more cells more more
+
+Given the grid has three cells
+When I create a celll at 3, 1
+Then the grid should look like
+XX.
+..X
+..X
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
new file mode 100644
index 000000000..a9cf1ac64
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
@@ -0,0 +1,17 @@
+Story: I can kill a cell
+
+As a game producer
+I want to kill a cell
+So that when I make a mistake I dont have to start again
+
+Scenario: bang youre dead
+
+Given the grid looks like
+XX.
+.X.
+..X
+When I destroy the cell at 0, 1
+Then the grid should look like
+X..
+.X.
+..X
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
new file mode 100644
index 000000000..aeeede77d
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
@@ -0,0 +1,53 @@
+Story: The grid wraps
+
+As a game player
+I want the grid to wrap
+So that untidy stuff at the edges is avoided
+
+Scenario: crowded in the corners
+
+Given the grid looks like
+X.X
+...
+X.X
+When the next step is taken
+Then the grid should look like
+X.X
+...
+X.X
+
+
+Scenario: the glider returns
+
+Given the glider
+......
+..X...
+.X....
+.XXX..
+......
+When the next step is taken
+and the next step is taken
+and the next step is taken
+and the next step is taken
+Then the grid should look like
+......
+......
+.X....
+X.....
+XXX...
+When the next step is taken
+Then the grid should look like
+.X....
+......
+......
+X.X...
+XX....
+When the next step is taken
+Then the grid should look like
+XX....
+......
+......
+X.....
+X.X...
+
+
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
new file mode 100644
index 000000000..81f86baba
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
@@ -0,0 +1,52 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+
+Story "I can create a cell",
+ %(As a game producer
+ I want to create a cell
+ So that I can show the grid to people), :steps_for => :life do
+
+ Scenario "nothing to see here" do
+ Given "a game with dimensions", 3, 3 do |rows,cols|
+ @game = Game.new(rows,cols)
+ end
+
+ Then "the grid should look like", %(
+ ...
+ ...
+ ...
+ )
+ end
+
+ Scenario "all on its lonesome" do
+ Given "a game with dimensions", 2, 2
+ When "I create a cell at", 1, 1 do |row,col|
+ @game.create_at(row,col)
+ end
+ Then "the grid should look like", %(
+ ..
+ .X
+ )
+ end
+
+ Scenario "the grid has three cells" do
+ Given "a game with dimensions", 3, 3
+ When "I create a cell at", 0, 0
+ When "I create a cell at", 0, 1
+ When "I create a cell at", 2, 2
+ Then "the grid should look like", %(
+ XX.
+ ...
+ ..X
+ )
+ end
+
+ Scenario "more cells more more" do
+ GivenScenario "the grid has three cells"
+ When "I create a cell at", 2, 0
+ Then "the grid should look like", %(
+ XX.
+ ...
+ X.X
+ )
+ end
+end
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb
new file mode 100644
index 000000000..70ed21ec5
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb
@@ -0,0 +1,6 @@
+dir = File.dirname(__FILE__)
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../../../../../../rspec/lib"))
+require 'spec'
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../../"))
+require "#{dir}/../../life"
+require File.join(File.dirname(__FILE__), *%w[steps]) \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
new file mode 100644
index 000000000..7ae2d912d
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
@@ -0,0 +1,26 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+
+Story 'I can kill a cell',
+ %(As a game producer
+ I want to kill a cell
+ So that when I make a mistake I don't have to start again), :steps_for => :life do
+
+ Scenario "bang, you're dead" do
+
+ Given 'a game that looks like', %(
+ XX.
+ .X.
+ ..X
+ ) do |dots|
+ @game = Game.from_string dots
+ end
+ When 'I destroy the cell at', 0, 1 do |row,col|
+ @game.destroy_at(row,col)
+ end
+ Then 'the grid should look like', %(
+ X..
+ .X.
+ ..X
+ )
+ end
+end
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb
new file mode 100644
index 000000000..793590d70
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb
@@ -0,0 +1,5 @@
+steps_for :life do
+ Then "the grid should look like" do |dots|
+ @game.grid.should == Grid.from_string(dots)
+ end
+end \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb
new file mode 100644
index 000000000..e60fe01de
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb
@@ -0,0 +1,3 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+require 'behaviour/stories/create_a_cell'
+require 'behaviour/stories/kill_a_cell'
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt
new file mode 100644
index 000000000..d8f809be3
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt
@@ -0,0 +1,22 @@
+Story: Show the game field
+ As a game player
+ I want to see the field
+ so that I can observe the progress of the organisms
+
+Scenario: an empty field
+ Given a new game starts
+ When the game displays the field
+ Then the field should be empty
+
+
+
+
+
+StoryBuilder story = stories.createStory().called("a story")
+ .asA("person")
+ .iWant("to do something")
+ .soThat("I can rule the world");
+story.addScenario().called("happy path").as()
+ .given("some context")
+ .when("some event happens")
+ .then("expect some outcome");
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/life.rb b/vendor/plugins/rspec/examples/stories/game-of-life/life.rb
new file mode 100644
index 000000000..88263bd00
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/life.rb
@@ -0,0 +1,3 @@
+$: << File.dirname(__FILE__)
+require 'life/game'
+require 'life/grid'
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb b/vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb
new file mode 100644
index 000000000..5411b01bf
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb
@@ -0,0 +1,23 @@
+class Game
+ attr_accessor :grid
+ def initialize(rows,cols)
+ @grid = Grid.new(rows, cols)
+ end
+
+ def create_at(row,col)
+ @grid.create_at(row,col)
+ end
+
+ def destroy_at(row,col)
+ @grid.destroy_at(row, col)
+ end
+
+ def self.from_string(dots)
+ grid = Grid.from_string(dots)
+ game = new(grid.rows, grid.columns)
+ game.instance_eval do
+ @grid = grid
+ end
+ return game
+ end
+end
diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb b/vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb
new file mode 100644
index 000000000..aca23087c
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb
@@ -0,0 +1,43 @@
+class Grid
+
+ attr_accessor :contents
+
+ def initialize(rows, cols)
+ @contents = []
+ rows.times do @contents << [0] * cols end
+ end
+
+ def rows
+ @contents.size
+ end
+
+ def columns
+ @contents[0].size
+ end
+
+ def ==(other)
+ self.contents == other.contents
+ end
+
+ def create_at(row,col)
+ @contents[row][col] = 1
+ end
+
+ def destroy_at(row,col)
+ @contents[row][col] = 0
+ end
+
+ def self.from_string(str)
+ row_strings = str.split(' ')
+ grid = new(row_strings.size, row_strings[0].size)
+
+ row_strings.each_with_index do |row, row_index|
+ row_chars = row.split(//)
+ row_chars.each_with_index do |col_char, col_index|
+ grid.create_at(row_index, col_index) if col_char == 'X'
+ end
+ end
+ return grid
+ end
+
+end
diff --git a/vendor/plugins/rspec/examples/stories/helper.rb b/vendor/plugins/rspec/examples/stories/helper.rb
new file mode 100644
index 000000000..2e825b278
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/helper.rb
@@ -0,0 +1,9 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require 'spec/story'
+
+# won't have to do this once plain_text_story_runner is moved into the library
+# require File.join(File.dirname(__FILE__), "plain_text_story_runner")
+
+Dir[File.join(File.dirname(__FILE__), "steps/*.rb")].each do |file|
+ require file
+end \ No newline at end of file
diff --git a/vendor/plugins/rspec/examples/stories/steps/addition_steps.rb b/vendor/plugins/rspec/examples/stories/steps/addition_steps.rb
new file mode 100644
index 000000000..3f27095a9
--- /dev/null
+++ b/vendor/plugins/rspec/examples/stories/steps/addition_steps.rb
@@ -0,0 +1,18 @@
+require File.expand_path("#{File.dirname(__FILE__)}/../helper")
+
+# This creates steps for :addition
+steps_for(:addition) do
+ Given("an addend of $addend") do |addend|
+ @adder ||= Adder.new
+ @adder << addend.to_i
+ end
+end
+
+# This appends to them
+steps_for(:addition) do
+ When("the addends are added") { @sum = @adder.sum }
+end
+
+steps_for(:more_addition) do
+ Then("the sum should be $sum") { |sum| @sum.should == sum.to_i }
+end