aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins/rspec/examples
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/plugins/rspec/examples')
-rw-r--r--vendor/plugins/rspec/examples/auto_spec_description_example.rb19
-rw-r--r--vendor/plugins/rspec/examples/before_and_after_example.rb39
-rwxr-xr-xvendor/plugins/rspec/examples/behave_as_example.rb45
-rw-r--r--vendor/plugins/rspec/examples/custom_expectation_matchers.rb54
-rw-r--r--vendor/plugins/rspec/examples/custom_formatter.rb11
-rw-r--r--vendor/plugins/rspec/examples/dynamic_spec.rb9
-rw-r--r--vendor/plugins/rspec/examples/file_accessor.rb18
-rw-r--r--vendor/plugins/rspec/examples/file_accessor_spec.rb38
-rw-r--r--vendor/plugins/rspec/examples/greeter_spec.rb30
-rw-r--r--vendor/plugins/rspec/examples/helper_method_example.rb11
-rw-r--r--vendor/plugins/rspec/examples/io_processor.rb8
-rw-r--r--vendor/plugins/rspec/examples/io_processor_spec.rb21
-rw-r--r--vendor/plugins/rspec/examples/legacy_spec.rb10
-rw-r--r--vendor/plugins/rspec/examples/mocking_example.rb27
-rw-r--r--vendor/plugins/rspec/examples/multi_threaded_behaviour_runner.rb25
-rw-r--r--vendor/plugins/rspec/examples/partial_mock_example.rb28
-rw-r--r--vendor/plugins/rspec/examples/pending_example.rb20
-rw-r--r--vendor/plugins/rspec/examples/predicate_example.rb27
-rw-r--r--vendor/plugins/rspec/examples/priority.txt1
-rw-r--r--vendor/plugins/rspec/examples/shared_behaviours_example.rb39
-rw-r--r--vendor/plugins/rspec/examples/spec_helper.rb1
-rw-r--r--vendor/plugins/rspec/examples/stack.rb36
-rw-r--r--vendor/plugins/rspec/examples/stack_spec.rb97
-rw-r--r--vendor/plugins/rspec/examples/stubbing_example.rb69
-rwxr-xr-xvendor/plugins/rspec/examples/test_case_adapter_example.rb26
-rw-r--r--vendor/plugins/rspec/examples/test_case_spec.rb65
26 files changed, 0 insertions, 774 deletions
diff --git a/vendor/plugins/rspec/examples/auto_spec_description_example.rb b/vendor/plugins/rspec/examples/auto_spec_description_example.rb
deleted file mode 100644
index a4928ef4a..000000000
--- a/vendor/plugins/rspec/examples/auto_spec_description_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/before_and_after_example.rb b/vendor/plugins/rspec/examples/before_and_after_example.rb
deleted file mode 100644
index 09e3805fb..000000000
--- a/vendor/plugins/rspec/examples/before_and_after_example.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-$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/behave_as_example.rb b/vendor/plugins/rspec/examples/behave_as_example.rb
deleted file mode 100755
index e95d1469a..000000000
--- a/vendor/plugins/rspec/examples/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/custom_expectation_matchers.rb b/vendor/plugins/rspec/examples/custom_expectation_matchers.rb
deleted file mode 100644
index 075bb542d..000000000
--- a/vendor/plugins/rspec/examples/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/custom_formatter.rb b/vendor/plugins/rspec/examples/custom_formatter.rb
deleted file mode 100644
index 851c9906f..000000000
--- a/vendor/plugins/rspec/examples/custom_formatter.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-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/dynamic_spec.rb b/vendor/plugins/rspec/examples/dynamic_spec.rb
deleted file mode 100644
index 15d473d61..000000000
--- a/vendor/plugins/rspec/examples/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/file_accessor.rb b/vendor/plugins/rspec/examples/file_accessor.rb
deleted file mode 100644
index 16bc45dbb..000000000
--- a/vendor/plugins/rspec/examples/file_accessor.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-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/file_accessor_spec.rb b/vendor/plugins/rspec/examples/file_accessor_spec.rb
deleted file mode 100644
index 628d4c0b0..000000000
--- a/vendor/plugins/rspec/examples/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/greeter_spec.rb b/vendor/plugins/rspec/examples/greeter_spec.rb
deleted file mode 100644
index 7d67e3187..000000000
--- a/vendor/plugins/rspec/examples/greeter_spec.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/helper_method_example.rb b/vendor/plugins/rspec/examples/helper_method_example.rb
deleted file mode 100644
index 5f94cf151..000000000
--- a/vendor/plugins/rspec/examples/helper_method_example.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require File.dirname(__FILE__) + '/spec_helper'
-
-describe "a context 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
diff --git a/vendor/plugins/rspec/examples/io_processor.rb b/vendor/plugins/rspec/examples/io_processor.rb
deleted file mode 100644
index 6b15147b6..000000000
--- a/vendor/plugins/rspec/examples/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/io_processor_spec.rb b/vendor/plugins/rspec/examples/io_processor_spec.rb
deleted file mode 100644
index 5cab7bf31..000000000
--- a/vendor/plugins/rspec/examples/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/legacy_spec.rb b/vendor/plugins/rspec/examples/legacy_spec.rb
deleted file mode 100644
index 61669e7e6..000000000
--- a/vendor/plugins/rspec/examples/legacy_spec.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-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/mocking_example.rb b/vendor/plugins/rspec/examples/mocking_example.rb
deleted file mode 100644
index 6adbef59d..000000000
--- a/vendor/plugins/rspec/examples/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/multi_threaded_behaviour_runner.rb b/vendor/plugins/rspec/examples/multi_threaded_behaviour_runner.rb
deleted file mode 100644
index e2824a61e..000000000
--- a/vendor/plugins/rspec/examples/multi_threaded_behaviour_runner.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-
-class MultiThreadedBehaviourRunner < Spec::Runner::BehaviourRunner
- def initialize(options)
- super
- # configure these
- @thread_count = 4
- @thread_wait = 0
- end
-
- def run_behaviours(behaviours)
- @threads = []
- q = Queue.new
- behaviours.each { |b| q << b}
- @thread_count.times do
- @threads << Thread.new(q) do |queue|
- while not queue.empty?
- behaviour = queue.pop
- behaviour.run(@options.reporter, @options.dry_run, @options.reverse)
- end
- end
- sleep @thread_wait
- end
- @threads.each {|t| t.join}
- end
-end
diff --git a/vendor/plugins/rspec/examples/partial_mock_example.rb b/vendor/plugins/rspec/examples/partial_mock_example.rb
deleted file mode 100644
index 841ec8847..000000000
--- a/vendor/plugins/rspec/examples/partial_mock_example.rb
+++ /dev/null
@@ -1,28 +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/pending_example.rb b/vendor/plugins/rspec/examples/pending_example.rb
deleted file mode 100644
index 13f3d00c4..000000000
--- a/vendor/plugins/rspec/examples/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/predicate_example.rb b/vendor/plugins/rspec/examples/predicate_example.rb
deleted file mode 100644
index 1202bb670..000000000
--- a/vendor/plugins/rspec/examples/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/priority.txt b/vendor/plugins/rspec/examples/priority.txt
deleted file mode 100644
index 5b00064e2..000000000
--- a/vendor/plugins/rspec/examples/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/shared_behaviours_example.rb b/vendor/plugins/rspec/examples/shared_behaviours_example.rb
deleted file mode 100644
index 33c924643..000000000
--- a/vendor/plugins/rspec/examples/shared_behaviours_example.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require File.dirname(__FILE__) + '/spec_helper'
-
-module SharedBehaviourExample
- class OneThing
- def what_things_do
- "stuff"
- end
- end
-
- class AnotherThing
- def what_things_do
- "stuff"
- end
- end
-
- describe "All Things", :shared => true 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
- it_should_behave_like "All Things"
- before(:each) { @thing = OneThing.new }
-
- it "should have access to helper methods defined in the shared behaviour" do
- helper_method.should == "helper method"
- end
- end
-
- describe AnotherThing do
- it_should_behave_like "All Things"
- before(:each) { @thing = AnotherThing.new }
- end
-end
diff --git a/vendor/plugins/rspec/examples/spec_helper.rb b/vendor/plugins/rspec/examples/spec_helper.rb
deleted file mode 100644
index 61f51fbdb..000000000
--- a/vendor/plugins/rspec/examples/spec_helper.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.dirname(__FILE__) + '/../lib/spec'
diff --git a/vendor/plugins/rspec/examples/stack.rb b/vendor/plugins/rspec/examples/stack.rb
deleted file mode 100644
index 407173f7b..000000000
--- a/vendor/plugins/rspec/examples/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/stack_spec.rb b/vendor/plugins/rspec/examples/stack_spec.rb
deleted file mode 100644
index 22d8a652b..000000000
--- a/vendor/plugins/rspec/examples/stack_spec.rb
+++ /dev/null
@@ -1,97 +0,0 @@
-require File.dirname(__FILE__) + '/spec_helper'
-require File.dirname(__FILE__) + "/stack"
-
-describe "non-empty Stack", :shared => true do
- # NOTE that this one auto-generates the description "should not be empty"
- 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
-
-describe "non-full Stack", :shared => true do
- # NOTE that this one auto-generates the description "should not be full"
- 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
-
-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/stubbing_example.rb b/vendor/plugins/rspec/examples/stubbing_example.rb
deleted file mode 100644
index 31354aec6..000000000
--- a/vendor/plugins/rspec/examples/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/test_case_adapter_example.rb b/vendor/plugins/rspec/examples/test_case_adapter_example.rb
deleted file mode 100755
index 02ba3be17..000000000
--- a/vendor/plugins/rspec/examples/test_case_adapter_example.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#This is an example of using RSpec's expectations in test/unit.
-$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
-
-require 'test/unit'
-require 'spec/test_case_adapter'
-
-class IntegratingRSpecExpectationsIntoTestCaseTest < Test::Unit::TestCase
-
- def test_should_support_rspecs_equality_expectations
- 5.should == 5
- end
-
- def test_should_support_rspecs_comparison_expectations
- 5.should be > 4
- end
-
- class Band
- def players
- ["John", "Paul", "George", "Ringo"]
- end
- end
-
- def test_should_support_rspecs_collection_expectations
- Band.new.should have(4).players
- end
-end
diff --git a/vendor/plugins/rspec/examples/test_case_spec.rb b/vendor/plugins/rspec/examples/test_case_spec.rb
deleted file mode 100644
index 4ffa2c598..000000000
--- a/vendor/plugins/rspec/examples/test_case_spec.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-require File.dirname(__FILE__) + '/spec_helper'
-require 'test/unit'
-
-class RSpecIntegrationTest < Test::Unit::TestCase
- def self.fixtures(*args)
- @@fixtures = true
- end
-
- def self.verify_class_method
- @@fixtures.should == true
- end
-
- def setup
- @test_case_setup_called = true
- end
-
- def teardown
- @test_case_teardown_called = true
- end
-
- def run(result)
- end
-
- def helper_method
- @helper_method_called = true
- end
-end
-
-module RandomHelperModule
- def random_task
- @random_task_called = true
- end
-end
-
-describe "RSpec should integrate with Test::Unit::TestCase" do
- inherit RSpecIntegrationTest
- include RandomHelperModule
-
- fixtures :some_table
-
- prepend_before(:each) {setup}
-
- before(:each) do
- @rspec_setup_called = true
- end
-
- it "TestCase#setup should be called." do
- @test_case_setup_called.should be_true
- @rspec_setup_called.should be_true
- end
-
- it "RSpec should be able to access TestCase methods" do
- helper_method
- @helper_method_called.should be_true
- end
-
- it "RSpec should be able to accept included modules" do
- random_task
- @random_task_called.should be_true
- end
-
- after(:each) do
- RSpecIntegrationTest.verify_class_method
- end
-end