diff options
author | Louise Crow <louise.crow@gmail.com> | 2011-02-23 12:06:34 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2011-02-23 12:06:34 +0000 |
commit | 4cd0de91754f07afd0afb58d137b3adcf5a07611 (patch) | |
tree | 1a16f0c5af85f5e7561012b027545183584e15b8 /vendor/plugins/rspec/examples | |
parent | 44b78c1cd78607434b3666f5391ba68da647583f (diff) |
Removing rspec and rspec-rails plugins in favour of updated gems.
Diffstat (limited to 'vendor/plugins/rspec/examples')
45 files changed, 0 insertions, 1315 deletions
diff --git a/vendor/plugins/rspec/examples/failing/README.txt b/vendor/plugins/rspec/examples/failing/README.txt deleted file mode 100644 index 7e9f49236..000000000 --- a/vendor/plugins/rspec/examples/failing/README.txt +++ /dev/null @@ -1,11 +0,0 @@ -"Why have failing examples?", you might ask. - -They allow us to see failure messages. RSpec wants to provide meaningful and -helpful failure messages. The failures in this directory not only provide you -a way of seeing the failure messages, but they provide RSpec's own specs a way -of describing what they should look like and ensuring they stay correct. - -To see the types of messages you can expect, stand in the root directory and -run: - -bin/spec examples/failing/*.rb
\ No newline at end of file diff --git a/vendor/plugins/rspec/examples/failing/diffing_spec.rb b/vendor/plugins/rspec/examples/failing/diffing_spec.rb deleted file mode 100644 index 85e13e8c0..000000000 --- a/vendor/plugins/rspec/examples/failing/diffing_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -describe "Running specs with --diff" do - it "should print diff of different strings" do - uk = <<-EOF -RSpec is a -behaviour driven development -framework for Ruby -EOF - usa = <<-EOF -RSpec is a -behavior driven development -framework for Ruby -EOF - usa.should == uk - end - - class Animal - def initialize(name,species) - @name,@species = name,species - end - - def inspect - <<-EOA -<Animal -name=#{@name}, -species=#{@species} -> - EOA - end - end - - it "should print diff of different objects' pretty representation" do - expected = Animal.new "bob", "giraffe" - actual = Animal.new "bob", "tortoise" - expected.should eql(actual) - end -end diff --git a/vendor/plugins/rspec/examples/failing/failing_implicit_docstrings_example.rb b/vendor/plugins/rspec/examples/failing/failing_implicit_docstrings_example.rb deleted file mode 100644 index 7b0b86614..000000000 --- a/vendor/plugins/rspec/examples/failing/failing_implicit_docstrings_example.rb +++ /dev/null @@ -1,17 +0,0 @@ -# Run spec w/ -fs to see the output of this file - -describe "Failing examples with no descriptions" do - - # description is auto-generated as "should equal(5)" based on the last #should - it do - 3.should equal(2) - 5.should equal(5) - end - - it { 3.should be > 5 } - - it { ["a"].should include("b") } - - it { [1,2,3].should_not respond_to(:size) } - -end diff --git a/vendor/plugins/rspec/examples/failing/failure_in_after.rb b/vendor/plugins/rspec/examples/failing/failure_in_after.rb deleted file mode 100644 index a47338aee..000000000 --- a/vendor/plugins/rspec/examples/failing/failure_in_after.rb +++ /dev/null @@ -1,10 +0,0 @@ -describe "This example" do - - it "should be listed as failing in after" do - end - - after(:each) do - NonExistentClass.new - end - -end diff --git a/vendor/plugins/rspec/examples/failing/failure_in_before.rb b/vendor/plugins/rspec/examples/failing/failure_in_before.rb deleted file mode 100644 index b0826604e..000000000 --- a/vendor/plugins/rspec/examples/failing/failure_in_before.rb +++ /dev/null @@ -1,10 +0,0 @@ -describe "This example" do - - before(:each) do - NonExistentClass.new - end - - it "should be listed as failing in each" do - end - -end diff --git a/vendor/plugins/rspec/examples/failing/mocking_example.rb b/vendor/plugins/rspec/examples/failing/mocking_example.rb deleted file mode 100644 index 9c735e00b..000000000 --- a/vendor/plugins/rspec/examples/failing/mocking_example.rb +++ /dev/null @@ -1,38 +0,0 @@ -describe "Mocker" do - - it "should be able to call mock()" do - mock = mock("poke me") - mock.should_receive(:poke) - mock.poke - end - - it "should fail when expected message not received" do - mock = mock("poke me") - mock.should_receive(:poke) - end - - it "should fail when messages are received out of order" do - mock = mock("one two three") - mock.should_receive(:one).ordered - mock.should_receive(:two).ordered - mock.should_receive(:three).ordered - mock.one - mock.three - mock.two - end - - it "should get yelled at when sending unexpected messages" do - mock = mock("don't talk to me") - mock.should_not_receive(:any_message_at_all) - mock.any_message_at_all - end - - it "has a bug we need to fix" do - pending "here is the bug" do - # Actually, no. It's fixed. This will fail because it passes :-) - mock = mock("Bug") - mock.should_receive(:hello) - mock.hello - end - end -end diff --git a/vendor/plugins/rspec/examples/failing/mocking_with_flexmock.rb b/vendor/plugins/rspec/examples/failing/mocking_with_flexmock.rb deleted file mode 100644 index 6e79ece0e..000000000 --- a/vendor/plugins/rspec/examples/failing/mocking_with_flexmock.rb +++ /dev/null @@ -1,26 +0,0 @@ -# stub frameworks like to gum up Object, so this is deliberately -# set NOT to run so that you don't accidentally run it when you -# run this dir. - -# To run it, stand in this directory and say: -# -# RUN_FLEXMOCK_EXAMPLE=true ruby ../bin/spec mocking_with_flexmock.rb - -if ENV['RUN_FLEXMOCK_EXAMPLE'] - Spec::Runner.configure do |config| - config.mock_with :flexmock - end - - describe "Flexmocks" do - it "should fail when the expected message is received with wrong arguments" do - m = flexmock("now flex!") - m.should_receive(:msg).with("arg").once - m.msg("other arg") - end - - it "should fail when the expected message is not received at all" do - m = flexmock("now flex!") - m.should_receive(:msg).with("arg").once - end - end -end diff --git a/vendor/plugins/rspec/examples/failing/mocking_with_mocha.rb b/vendor/plugins/rspec/examples/failing/mocking_with_mocha.rb deleted file mode 100644 index f14a1a3e5..000000000 --- a/vendor/plugins/rspec/examples/failing/mocking_with_mocha.rb +++ /dev/null @@ -1,25 +0,0 @@ -# stub frameworks like to gum up Object, so this is deliberately -# set NOT to run so that you don't accidentally run it when you -# run this dir. - -# To run it, stand in this directory and say: -# -# RUN_MOCHA_EXAMPLE=true ruby ../bin/spec mocking_with_mocha.rb - -if ENV['RUN_MOCHA_EXAMPLE'] - Spec::Runner.configure do |config| - config.mock_with :mocha - end - describe "Mocha framework" do - it "should should be made available by saying config.mock_with :mocha" do - m = mock() - m.expects(:msg).with("arg") - m.msg - end - it "should should be made available by saying config.mock_with :mocha" do - o = Object.new - o.expects(:msg).with("arg") - o.msg - end - end -end diff --git a/vendor/plugins/rspec/examples/failing/mocking_with_rr.rb b/vendor/plugins/rspec/examples/failing/mocking_with_rr.rb deleted file mode 100644 index 0d2b4fe04..000000000 --- a/vendor/plugins/rspec/examples/failing/mocking_with_rr.rb +++ /dev/null @@ -1,27 +0,0 @@ -# stub frameworks like to gum up Object, so this is deliberately -# set NOT to run so that you don't accidentally run it when you -# run this dir. - -# To run it, stand in this directory and say: -# -# RUN_RR_EXAMPLE=true ruby ../bin/spec mocking_with_rr.rb - -if ENV['RUN_RR_EXAMPLE'] - Spec::Runner.configure do |config| - config.mock_with :rr - end - describe "RR framework" do - it "should should be made available by saying config.mock_with :rr" do - o = Object.new - mock(o).msg("arg") - o.msg - end - it "should should be made available by saying config.mock_with :rr" do - o = Object.new - mock(o) do |m| - m.msg("arg") - end - o.msg - end - end -end diff --git a/vendor/plugins/rspec/examples/failing/partial_mock_example.rb b/vendor/plugins/rspec/examples/failing/partial_mock_example.rb deleted file mode 100644 index 7f8d081b1..000000000 --- a/vendor/plugins/rspec/examples/failing/partial_mock_example.rb +++ /dev/null @@ -1,18 +0,0 @@ -class MockableClass - def self.find id - return :original_return - end -end - -describe "A partial mock" do - - it "should work at the class level (but fail here due to the type mismatch)" 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 - -end diff --git a/vendor/plugins/rspec/examples/failing/pending_example.rb b/vendor/plugins/rspec/examples/failing/pending_example.rb deleted file mode 100644 index 825af2ed1..000000000 --- a/vendor/plugins/rspec/examples/failing/pending_example.rb +++ /dev/null @@ -1,7 +0,0 @@ -describe "pending example (which is fixed)" do - it %Q|reports "FIXED ... Expected ... to fail. No Error was raised."| do - pending("for some reason") do - # success - end - end -end diff --git a/vendor/plugins/rspec/examples/failing/predicate_example.rb b/vendor/plugins/rspec/examples/failing/predicate_example.rb deleted file mode 100644 index aed8b14bd..000000000 --- a/vendor/plugins/rspec/examples/failing/predicate_example.rb +++ /dev/null @@ -1,32 +0,0 @@ -class BddFramework - def intuitive? - true - end - - def adopted_quickly? - #this will cause failures because it reallly SHOULD be adopted quickly - false - end -end - -describe "BDD framework" do - - before(:each) do - @bdd_framework = BddFramework.new - end - - it "should be adopted quickly" do - #this will fail because it reallly SHOULD be adopted quickly - @bdd_framework.should be_adopted_quickly - end - - it "should be intuitive" do - @bdd_framework.should be_intuitive - end - - it "should not respond to test" do - #this will fail - @bdd_framework.test - end - -end diff --git a/vendor/plugins/rspec/examples/failing/raising_example.rb b/vendor/plugins/rspec/examples/failing/raising_example.rb deleted file mode 100644 index e40b51ec8..000000000 --- a/vendor/plugins/rspec/examples/failing/raising_example.rb +++ /dev/null @@ -1,47 +0,0 @@ -describe "This example" do - - it "should show that a NoMethodError is raised but an Exception was expected" do - proc { ''.nonexistent_method }.should raise_error - end - - it "should pass" do - proc { ''.nonexistent_method }.should raise_error(NoMethodError) - end - - it "should show that a NoMethodError is raised but a SyntaxError was expected" do - proc { ''.nonexistent_method }.should raise_error(SyntaxError) - end - - it "should show that nothing is raised when SyntaxError was expected" do - proc { }.should raise_error(SyntaxError) - end - - it "should show that a NoMethodError is raised but a Exception was expected" do - proc { ''.nonexistent_method }.should_not raise_error - end - - it "should show that a NoMethodError is raised" do - proc { ''.nonexistent_method }.should_not raise_error(NoMethodError) - end - - it "should also pass" do - proc { ''.nonexistent_method }.should_not raise_error(SyntaxError) - end - - it "should show that a NoMethodError is raised when nothing expected" do - proc { ''.nonexistent_method }.should_not raise_error(Exception) - end - - it "should show that the wrong message was received" do - proc { raise StandardError.new("what is an enterprise?") }.should raise_error(StandardError, "not this") - end - - it "should show that the unexpected error/message was thrown" do - proc { raise StandardError.new("abc") }.should_not raise_error(StandardError, "abc") - end - - it "should pass too" do - proc { raise StandardError.new("abc") }.should_not raise_error(StandardError, "xyz") - end - -end diff --git a/vendor/plugins/rspec/examples/failing/syntax_error_example.rb b/vendor/plugins/rspec/examples/failing/syntax_error_example.rb deleted file mode 100644 index c9bb90774..000000000 --- a/vendor/plugins/rspec/examples/failing/syntax_error_example.rb +++ /dev/null @@ -1,7 +0,0 @@ -describe "when passing a block to a matcher" do - it "you should use {} instead of do/end" do - Object.new.should satisfy do - "this block is being passed to #should instead of #satisfy - use {} instead" - end - end -end diff --git a/vendor/plugins/rspec/examples/failing/team_spec.rb b/vendor/plugins/rspec/examples/failing/team_spec.rb deleted file mode 100644 index ab35b5274..000000000 --- a/vendor/plugins/rspec/examples/failing/team_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Team - attr_reader :players - def initialize - @players = Players.new - end -end - -class Players - def initialize - @players = [] - end - def size - @players.size - end - def include? player - raise "player must be a string" unless player.is_a?(String) - @players.include? player - end -end - -describe "A new team" do - - before(:each) do - @team = Team.new - end - - it "should have 3 players (failing example)" do - @team.should have(3).players - end - - it "should include some player (failing example)" do - @team.players.should include("Some Player") - end - - it "should include 5 (failing example)" do - @team.players.should include(5) - end - - it "should have no players" - -end diff --git a/vendor/plugins/rspec/examples/failing/timeout_behaviour.rb b/vendor/plugins/rspec/examples/failing/timeout_behaviour.rb deleted file mode 100644 index 1a3615ff0..000000000 --- a/vendor/plugins/rspec/examples/failing/timeout_behaviour.rb +++ /dev/null @@ -1,5 +0,0 @@ -describe "Something really slow" do - it "should be failed by RSpec when it takes longer than --timeout" do - sleep(2) - end -end diff --git a/vendor/plugins/rspec/examples/passing/custom_formatter.rb b/vendor/plugins/rspec/examples/passing/custom_formatter.rb deleted file mode 100644 index 4c7482190..000000000 --- a/vendor/plugins/rspec/examples/passing/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 examples/failing -r examples/passing/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/passing/custom_matchers.rb b/vendor/plugins/rspec/examples/passing/custom_matchers.rb deleted file mode 100644 index 075bb542d..000000000 --- a/vendor/plugins/rspec/examples/passing/custom_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/passing/dynamic_spec.rb b/vendor/plugins/rspec/examples/passing/dynamic_spec.rb deleted file mode 100644 index 7c0372631..000000000 --- a/vendor/plugins/rspec/examples/passing/dynamic_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -describe "The square root" do - (1..10).each do |n| - it "of #{n*n} should be #{n}" do - Math.sqrt(n*n).should == n - end - end -end diff --git a/vendor/plugins/rspec/examples/passing/file_accessor.rb b/vendor/plugins/rspec/examples/passing/file_accessor.rb deleted file mode 100644 index e67f44735..000000000 --- a/vendor/plugins/rspec/examples/passing/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 'examples/passing/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/passing/file_accessor_spec.rb b/vendor/plugins/rspec/examples/passing/file_accessor_spec.rb deleted file mode 100644 index 84428b6fc..000000000 --- a/vendor/plugins/rspec/examples/passing/file_accessor_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'examples/passing/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/passing/filtered_formatter.rb b/vendor/plugins/rspec/examples/passing/filtered_formatter.rb deleted file mode 100644 index eaeabbcfa..000000000 --- a/vendor/plugins/rspec/examples/passing/filtered_formatter.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec/runner/formatter/nested_text_formatter' - -class FilteredFormatter < Spec::Runner::Formatter::NestedTextFormatter - def add_example_group(example_group) - if example_group.options[:show] == false - @showing = false - else - @showing = true - puts example_group.description - end - end - - def example_passed(example) - puts " " << example.description if @showing unless example.options[:show] == false - end -end - diff --git a/vendor/plugins/rspec/examples/passing/filtered_formatter_example.rb b/vendor/plugins/rspec/examples/passing/filtered_formatter_example.rb deleted file mode 100644 index 3c9d067f1..000000000 --- a/vendor/plugins/rspec/examples/passing/filtered_formatter_example.rb +++ /dev/null @@ -1,31 +0,0 @@ -# This demonstrates how you can write custom formatters to handle arbitrary -# options passed to the +describe+ and +it+ methods. To see it in action, stand -# in the project root and say: -# -# bin/spec -r examples/passing/filtered_formatter.rb examples/passing/filtered_formatter_example.rb -f FilteredFormatter -# -# You should only see the examples and groups below that are not explicitly -# marked :show => false -# -# group 1 -# example 1 a -# group 3 -# example 3 - - -describe "group 1", :show => true do - it "example 1 a", :show => true do - end - it "example 1 b", :show => false do - end -end - -describe "group 2", :show => false do - it "example 2" do - end -end - -describe "group 3" do - it "example 3" do - end -end
\ No newline at end of file diff --git a/vendor/plugins/rspec/examples/passing/greeter_spec.rb b/vendor/plugins/rspec/examples/passing/greeter_spec.rb deleted file mode 100644 index 7d67e3187..000000000 --- a/vendor/plugins/rspec/examples/passing/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/passing/helper_method_example.rb b/vendor/plugins/rspec/examples/passing/helper_method_example.rb deleted file mode 100644 index eb3dca92f..000000000 --- a/vendor/plugins/rspec/examples/passing/helper_method_example.rb +++ /dev/null @@ -1,12 +0,0 @@ -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/passing/implicit_docstrings_example.rb b/vendor/plugins/rspec/examples/passing/implicit_docstrings_example.rb deleted file mode 100644 index 889cef425..000000000 --- a/vendor/plugins/rspec/examples/passing/implicit_docstrings_example.rb +++ /dev/null @@ -1,16 +0,0 @@ -# Run "spec implicit_docstrings_example.rb --format specdoc" to see the output of this file - -describe "Examples with no docstrings generate their own:" do - - specify { 3.should be < 5 } - - specify { ["a"].should include("a") } - - specify { [1,2,3].should respond_to(:size) } - -end - -describe 1 do - it { should == 1 } - it { should be < 2} -end diff --git a/vendor/plugins/rspec/examples/passing/io_processor.rb b/vendor/plugins/rspec/examples/passing/io_processor.rb deleted file mode 100644 index 6b15147b6..000000000 --- a/vendor/plugins/rspec/examples/passing/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/passing/io_processor_spec.rb b/vendor/plugins/rspec/examples/passing/io_processor_spec.rb deleted file mode 100644 index 1f5020e76..000000000 --- a/vendor/plugins/rspec/examples/passing/io_processor_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'examples/passing/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/passing/mocking_example.rb b/vendor/plugins/rspec/examples/passing/mocking_example.rb deleted file mode 100644 index 1d342c735..000000000 --- a/vendor/plugins/rspec/examples/passing/mocking_example.rb +++ /dev/null @@ -1,25 +0,0 @@ -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/passing/multi_threaded_example_group_runner.rb b/vendor/plugins/rspec/examples/passing/multi_threaded_example_group_runner.rb deleted file mode 100644 index d5458ddf8..000000000 --- a/vendor/plugins/rspec/examples/passing/multi_threaded_example_group_runner.rb +++ /dev/null @@ -1,26 +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
\ No newline at end of file diff --git a/vendor/plugins/rspec/examples/passing/nested_classes_example.rb b/vendor/plugins/rspec/examples/passing/nested_classes_example.rb deleted file mode 100644 index ce5499591..000000000 --- a/vendor/plugins/rspec/examples/passing/nested_classes_example.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'examples/passing/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/passing/options_example.rb b/vendor/plugins/rspec/examples/passing/options_example.rb deleted file mode 100644 index bed3077eb..000000000 --- a/vendor/plugins/rspec/examples/passing/options_example.rb +++ /dev/null @@ -1,29 +0,0 @@ -# This demonstrates the use of the options hash to support custom reporting. -# To see the result, run this command from the project root: -# -# bin/spec --require examples/passing/options_formatter.rb examples/passing/options_example.rb \ -# --format OptionsFormatter - -describe "this group will be reported", :report => true do - it "this example will be reported", :report => true do - # no-op - end - - it "this example will not be reported", :report => false do - # no-op - end - - it "this example will also not be reported", :foo => 'bar' do - # no-op - end - - it "this example will also also not be reported" do - # no-op - end -end - -describe "this group will not be reported", :report => false do - it "though this example will", :report => true do - # no-op - end -end
\ No newline at end of file diff --git a/vendor/plugins/rspec/examples/passing/options_formatter.rb b/vendor/plugins/rspec/examples/passing/options_formatter.rb deleted file mode 100644 index b88bebbc5..000000000 --- a/vendor/plugins/rspec/examples/passing/options_formatter.rb +++ /dev/null @@ -1,20 +0,0 @@ -# This is an example of how you can use a custom formatter to do custom -# reporting. This formatter will only report example groups and examples that -# have :report => true (or anything truthy) in the declaration. See -# options_example.rb in this directory. - -require 'spec/runner/formatter/base_text_formatter' - -class OptionsFormatter < Spec::Runner::Formatter::BaseTextFormatter - def example_started(proxy) - if proxy.options[:report] - puts proxy.description - end - end - - def example_group_started(proxy) - if proxy.options[:report] - puts proxy.description - end - end -end diff --git a/vendor/plugins/rspec/examples/passing/partial_mock_example.rb b/vendor/plugins/rspec/examples/passing/partial_mock_example.rb deleted file mode 100644 index 38aafa149..000000000 --- a/vendor/plugins/rspec/examples/passing/partial_mock_example.rb +++ /dev/null @@ -1,27 +0,0 @@ -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/passing/pending_example.rb b/vendor/plugins/rspec/examples/passing/pending_example.rb deleted file mode 100644 index 7ce382742..000000000 --- a/vendor/plugins/rspec/examples/passing/pending_example.rb +++ /dev/null @@ -1,18 +0,0 @@ -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/passing/predicate_example.rb b/vendor/plugins/rspec/examples/passing/predicate_example.rb deleted file mode 100644 index f10c386f3..000000000 --- a/vendor/plugins/rspec/examples/passing/predicate_example.rb +++ /dev/null @@ -1,25 +0,0 @@ -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/passing/shared_example_group_example.rb b/vendor/plugins/rspec/examples/passing/shared_example_group_example.rb deleted file mode 100644 index f034a11b5..000000000 --- a/vendor/plugins/rspec/examples/passing/shared_example_group_example.rb +++ /dev/null @@ -1,79 +0,0 @@ -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 a module. If you create one like this it gets - # assigned to the constant MostThings - 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/passing/shared_stack_examples.rb b/vendor/plugins/rspec/examples/passing/shared_stack_examples.rb deleted file mode 100644 index e14fd146d..000000000 --- a/vendor/plugins/rspec/examples/passing/shared_stack_examples.rb +++ /dev/null @@ -1,36 +0,0 @@ -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/passing/simple_matcher_example.rb b/vendor/plugins/rspec/examples/passing/simple_matcher_example.rb deleted file mode 100644 index 5a0fc0fa5..000000000 --- a/vendor/plugins/rspec/examples/passing/simple_matcher_example.rb +++ /dev/null @@ -1,29 +0,0 @@ -describe "arrays" do - def contain_same_elements_as(expected) - simple_matcher "array with same elements in any order as #{expected.inspect}" do |actual| - if actual.size == expected.size - a, e = actual.dup, expected.dup - until e.empty? do - if i = a.index(e.pop) then a.delete_at(i) end - end - a.empty? - else - false - end - end - end - - describe "can be matched by their contents disregarding order" do - subject { [1,2,2,3] } - it { should contain_same_elements_as([1,2,2,3]) } - it { should contain_same_elements_as([2,3,2,1]) } - it { should_not contain_same_elements_as([3,3,2,1]) } - end - - describe "fail the match with different contents" do - subject { [1,2,3] } - it { should_not contain_same_elements_as([2,3,4])} - it { should_not contain_same_elements_as([1,2,2,3])} - it { should_not contain_same_elements_as([1,2])} - end -end
\ No newline at end of file diff --git a/vendor/plugins/rspec/examples/passing/stack.rb b/vendor/plugins/rspec/examples/passing/stack.rb deleted file mode 100644 index 407173f7b..000000000 --- a/vendor/plugins/rspec/examples/passing/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/passing/stack_spec.rb b/vendor/plugins/rspec/examples/passing/stack_spec.rb deleted file mode 100644 index 6d0d06366..000000000 --- a/vendor/plugins/rspec/examples/passing/stack_spec.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'examples/passing/stack' -require 'examples/passing/shared_stack_examples' - -describe Stack, " (empty)" do - before(:each) do - @stack = Stack.new - end - - # This uses @stack (because the described class is Stack) auto-generates the - # description "should be empty" - it { 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/passing/stack_spec_with_nested_example_groups.rb b/vendor/plugins/rspec/examples/passing/stack_spec_with_nested_example_groups.rb deleted file mode 100644 index 6e36df789..000000000 --- a/vendor/plugins/rspec/examples/passing/stack_spec_with_nested_example_groups.rb +++ /dev/null @@ -1,66 +0,0 @@ -require 'examples/passing/stack' -require 'examples/passing/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/passing/stubbing_example.rb b/vendor/plugins/rspec/examples/passing/stubbing_example.rb deleted file mode 100644 index dab8982ee..000000000 --- a/vendor/plugins/rspec/examples/passing/stubbing_example.rb +++ /dev/null @@ -1,67 +0,0 @@ -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/passing/yielding_example.rb b/vendor/plugins/rspec/examples/passing/yielding_example.rb deleted file mode 100644 index e7b43fffa..000000000 --- a/vendor/plugins/rspec/examples/passing/yielding_example.rb +++ /dev/null @@ -1,31 +0,0 @@ -class MessageAppender - - def initialize(appendage) - @appendage = appendage - end - - def append_to(message) - if_told_to_yield do - message << @appendage - end - end - -end - -describe "a message expectation yielding to a block" do - it "should yield if told to" do - appender = MessageAppender.new("appended to") - appender.should_receive(:if_told_to_yield).and_yield - message = "" - appender.append_to(message) - message.should == "appended to" - end - - it "should not yield if not told to" do - appender = MessageAppender.new("appended to") - appender.should_receive(:if_told_to_yield) - message = "" - appender.append_to(message) - message.should == "" - end -end
\ No newline at end of file diff --git a/vendor/plugins/rspec/examples/ruby1.9.compatibility/access_to_constants_spec.rb b/vendor/plugins/rspec/examples/ruby1.9.compatibility/access_to_constants_spec.rb deleted file mode 100644 index b34b8ba6d..000000000 --- a/vendor/plugins/rspec/examples/ruby1.9.compatibility/access_to_constants_spec.rb +++ /dev/null @@ -1,85 +0,0 @@ -# courtesy of Matthias Hennemeyer -# -# The following should pass against ruby 1.8 and 1.9. It currently only passes -# 1.8 (as of 1/2/2009) -# -# Once cucumber supports ruby 1.9, this should be moved to cucumber scenarios instead. -module Foo - module Bar - - module ModuleInEnclosingModule;end - class ClassInEnclosingModule;end - def method_in_enclosing_module;end - CONSTANT_IN_ENCLOSING_MODULE = 0 - - describe "Examples trying to access constants defined in an enclosing module" do - - it "can access Modules" do - ModuleInEnclosingModule - end - it "can access Classes" do - ClassInEnclosingModule.new - end - it "can access CONSTANTS" do - CONSTANT_IN_ENCLOSING_MODULE - end - it "can NOT access methods" do - lambda {method_in_enclosing_module}.should raise_error(/undefined/) - end - - describe "from a nested example group" do - - it "can access Modules" do - ModuleInEnclosingModule - end - it "can access Classes" do - ClassInEnclosingModule.new - end - it "can access CONSTANTS" do - CONSTANT_IN_ENCLOSING_MODULE - end - it "can NOT access methods" do - lambda {method_in_enclosing_module}.should raise_error(/undefined/) - end - - end - - end - - describe "Examples trying to access constants defined in the example group" do - - module ModuleDefinedInGroup;end - class ClassDefinedInGroup; end - def method_defined_in_group; end - CONSTANT_DEFINED_IN_GROUP = 0 - - it "can access Modules" do - ModuleDefinedInGroup - end - it "can access Classes" do - ClassDefinedInGroup.new - end - it "can access CONSTANTS" do - CONSTANT_DEFINED_IN_GROUP - end - it "can access methods" do - method_defined_in_group - end - - describe "that live inside a nested group" do - it "can access Modules" do - ModuleDefinedInGroup - end - it "can access Classes" do - ClassDefinedInGroup.new - end - it "can access CONSTANTS" do - CONSTANT_DEFINED_IN_GROUP - end - it "can access methods" do - method_defined_in_group - end - end - end - end -end |