diff options
author | Francis Irving <francis@mysociety.org> | 2009-12-02 17:56:17 +0000 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2009-12-02 17:56:17 +0000 |
commit | 1bbb3f950f8bee92bf8a39e6f18c3278f1bab11d (patch) | |
tree | 5d0312d5d00446cd1454a5e1c799cd89d57b10d6 /vendor/plugins/rspec/examples | |
parent | 5f3139b538d1ff58b719a72d7c7cf05a5b6136b5 (diff) |
Changing rspec / rspec_on_rails version
Diffstat (limited to 'vendor/plugins/rspec/examples')
54 files changed, 0 insertions, 1509 deletions
diff --git a/vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb b/vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb deleted file mode 100644 index a4928ef4a..000000000 --- a/vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index 7db6274ef..000000000 --- a/vendor/plugins/rspec/examples/pure/before_and_after_example.rb +++ /dev/null @@ -1,40 +0,0 @@ -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 deleted file mode 100644 index e95d1469a..000000000 --- a/vendor/plugins/rspec/examples/pure/behave_as_example.rb +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index 075bb542d..000000000 --- a/vendor/plugins/rspec/examples/pure/custom_expectation_matchers.rb +++ /dev/null @@ -1,54 +0,0 @@ -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 deleted file mode 100644 index c449fdc2e..000000000 --- a/vendor/plugins/rspec/examples/pure/custom_formatter.rb +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 15d473d61..000000000 --- a/vendor/plugins/rspec/examples/pure/dynamic_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index ff6fb743c..000000000 --- a/vendor/plugins/rspec/examples/pure/file_accessor.rb +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index 628d4c0b0..000000000 --- a/vendor/plugins/rspec/examples/pure/file_accessor_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index ec7669dcc..000000000 --- a/vendor/plugins/rspec/examples/pure/greeter_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index d97f19e65..000000000 --- a/vendor/plugins/rspec/examples/pure/helper_method_example.rb +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index 6b15147b6..000000000 --- a/vendor/plugins/rspec/examples/pure/io_processor.rb +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 5cab7bf31..000000000 --- a/vendor/plugins/rspec/examples/pure/io_processor_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index c86369515..000000000 --- a/vendor/plugins/rspec/examples/pure/legacy_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index 6adbef59d..000000000 --- a/vendor/plugins/rspec/examples/pure/mocking_example.rb +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index 36edcd497..000000000 --- a/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100644 index abe43b0a6..000000000 --- a/vendor/plugins/rspec/examples/pure/nested_classes_example.rb +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100644 index 2af608b2f..000000000 --- a/vendor/plugins/rspec/examples/pure/partial_mock_example.rb +++ /dev/null @@ -1,29 +0,0 @@ -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 deleted file mode 100644 index 13f3d00c4..000000000 --- a/vendor/plugins/rspec/examples/pure/pending_example.rb +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index 1202bb670..000000000 --- a/vendor/plugins/rspec/examples/pure/predicate_example.rb +++ /dev/null @@ -1,27 +0,0 @@ -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 deleted file mode 100644 index 5b00064e2..000000000 --- a/vendor/plugins/rspec/examples/pure/priority.txt +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index fb81af1ec..000000000 --- a/vendor/plugins/rspec/examples/pure/shared_example_group_example.rb +++ /dev/null @@ -1,81 +0,0 @@ -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 deleted file mode 100644 index 7a0816250..000000000 --- a/vendor/plugins/rspec/examples/pure/shared_stack_examples.rb +++ /dev/null @@ -1,38 +0,0 @@ -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 deleted file mode 100644 index 1e880796c..000000000 --- a/vendor/plugins/rspec/examples/pure/spec_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 407173f7b..000000000 --- a/vendor/plugins/rspec/examples/pure/stack.rb +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100644 index 2a769da00..000000000 --- a/vendor/plugins/rspec/examples/pure/stack_spec.rb +++ /dev/null @@ -1,63 +0,0 @@ -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 deleted file mode 100644 index 05f6ad464..000000000 --- a/vendor/plugins/rspec/examples/pure/stack_spec_with_nested_example_groups.rb +++ /dev/null @@ -1,67 +0,0 @@ -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 deleted file mode 100644 index 31354aec6..000000000 --- a/vendor/plugins/rspec/examples/pure/stubbing_example.rb +++ /dev/null @@ -1,69 +0,0 @@ -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 deleted file mode 100644 index 0b027b0ff..000000000 --- a/vendor/plugins/rspec/examples/stories/adder.rb +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index 58f092990..000000000 --- a/vendor/plugins/rspec/examples/stories/addition +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100644 index e43f5cf39..000000000 --- a/vendor/plugins/rspec/examples/stories/addition.rb +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index d86fc7e5c..000000000 --- a/vendor/plugins/rspec/examples/stories/calculator.rb +++ /dev/null @@ -1,65 +0,0 @@ -$:.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_for => 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/.loadpath b/vendor/plugins/rspec/examples/stories/game-of-life/.loadpath deleted file mode 100644 index 9a6222015..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/.loadpath +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<loadpath> - <pathentry path="" type="src"/> - <pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/> -</loadpath> diff --git a/vendor/plugins/rspec/examples/stories/game-of-life/README.txt b/vendor/plugins/rspec/examples/stories/game-of-life/README.txt deleted file mode 100644 index 9624ad411..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/README.txt +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 90a281da5..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb +++ /dev/null @@ -1,6 +0,0 @@ -$:.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 deleted file mode 100644 index 1cadfb3c1..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index ff5b357f0..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb +++ /dev/null @@ -1,35 +0,0 @@ -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 deleted file mode 100644 index 5be3af519..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 8374e86c5..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 0d30b59be..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index cbc248e73..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index 88895cb69..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index a9cf1ac64..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100644 index aeeede77d..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story +++ /dev/null @@ -1,53 +0,0 @@ -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 deleted file mode 100644 index 81f86baba..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb +++ /dev/null @@ -1,52 +0,0 @@ -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 deleted file mode 100644 index 70ed21ec5..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 7ae2d912d..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index 793590d70..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index e60fe01de..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index d8f809be3..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index 88263bd00..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/life.rb +++ /dev/null @@ -1,3 +0,0 @@ -$: << 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 deleted file mode 100644 index 5411b01bf..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index aca23087c..000000000 --- a/vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb +++ /dev/null @@ -1,43 +0,0 @@ -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 deleted file mode 100644 index 2e825b278..000000000 --- a/vendor/plugins/rspec/examples/stories/helper.rb +++ /dev/null @@ -1,9 +0,0 @@ -$:.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 deleted file mode 100644 index 3f27095a9..000000000 --- a/vendor/plugins/rspec/examples/stories/steps/addition_steps.rb +++ /dev/null @@ -1,18 +0,0 @@ -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 |