==
instead of .equal?
).
+
+Lastly, should_be used to handle true and false differently from any other values. We've removed
+this special handling, so now actual.should_be true will fail for any value other than true (it
+used to pass for any non-nil, non-false value), and actual.should_be false will fail for any
+value other than false (it used to pass for nil or false).
+
+Here's what you'll need to do to update your specs:
+# search for "should_equal" and replace with "should_eql"
+# run specs
+
+If any specs still fail, they are probably related to should be_true or should_be_false using
+non-boolean values. Those you'll just have to inspect manually and adjust appropriately (sorry!).
+
+--------------------------------------------------
+Specifying multiple return values in mocks now works like this:
+
+mock.should_receive(:message).and_return(1,2,3)
+
+It used to work like this:
+
+mock.should_receive(:message).and_return([1,2,3])
+
+but we decided that was counter intuitive and otherwise lame.
+
+Here's what you'll need to do to update your specs:
+# search for "and_return(["
+# get rid of the "[" and "]"
+
+--------------------------------------------------
+RSpec on Rails now supports the following (thanks to ZenTest upon which it is built):
+
+# Separate specs for models, views, controllers and helpers
+# Controller specs are completely decoupled from the views by default (though you can tell them to couple themselves if you prefer)
+# View specs are completely decoupled from app-specific controllers
+
+See http://rspec.rubyforge.org/documentation/rails/index.html for more information
+--------------------------------------------------
+As usual, there are also other new features and bug fixes:
+
+* Added lots of documentation on mocks/stubs and the rails plugin.
+* Added support for assigns[key] syntax for controller specs (to align w/ pre-existing syntax for view specs)
+* Added support for controller.should_redirect_to
+* RSpec on Rails automatically checks whether it's compatible with the installed RSpec
+* Applied [#6393] rspec_on_rails uses deprecated '@response' instead of the accessor
+* RSpec now has 100% spec coverage(!)
+* Added support for stubbing and partial mocking
+* Progress (....F..F.) is now coloured. Tweaked patch from KAKUTANI Shintaro.
+* Backtrace now excludes the rcov runner (/usr/local/bin/rcov)
+* Fixed [#5539] predicates do not work w/ rails
+* Added [#6091] support for Regexp matching messages sent to should_raise
+* Added [#6333] support for Regexp matching in mock arguments
+* Applied [#6283] refactoring of diff support to allow selectable formats and custom differs
+* Fixed [#5564] "ruby spec_file.rb" doesn't work the same way as "spec spec_file.rb"
+* Fixed [#6056] Multiple output of failing-spec notice
+* Fixed [#6233] Colours in specdoc
+* Applied [#6207] Allows --diff option to diff target and expected's #inspect output (Patch by Lachie Cox)
+* Fixed [#6203] Failure messages are misleading - consider using inspect.
+* Added [#6334] subject.should_have_xyz will try to call subject.has_xyz? - use this for hash.should_have_key(key)
+* Fixed [#6017] Rake task should ignore empty or non-existent spec-dirs
+
+== Version 0.6.4
+
+In addition to a number of bug fixes and patches, this release begins to formalize the support for
+RSpec on Rails.
+
+* Added Christopher Petrilli's TextMate bundle to vendor/textmate/RSpec.tmbundle
+* Fixed [#5909], once again supporting multi_word_predicates
+* Applied [#5873] - response.should_have_rjs (initial patch from Jake Howerton, based on ARTS by Kevin Clark)
+* Added generation of view specs for rspec_on_rails
+* Applied [#5815] active_record_subclass.should_have(3).records
+* Added support in "rake stats" for view specs (in spec/views)
+* Applied [#5801] QuickRef.pdf should say RSpec, not rSpec
+* Applied [#5728] rails_spec_runner fails on Windows (Patch from Lindsay Evans).
+* Applied [#5708] RSpec Rails plugin rspec_controller generator makes specs that do not parse.
+* Cleaned up RSpec on Rails so it doesn't pollute as much during bootstrapping.
+* Added support for response.should_have_tag and response.should_not_have_tag (works just like assert_tag in rails)
+* Added new -c, --colour, --color option for colourful (red/green) output. Inspired from Pat Eyler's Redgreen gem.
+* Added examples for Watir and Selenium under the gem's vendor directory.
+* Renamed rails_spec_runner to rails_spec_server (as referred to in the docs)
+* Added support for trying a plural for arbitrary predicates. E.g. Album.should_exist(:name => "Hey Jude") will call Album.exists?(:name => "Hey Jude")
+* Added support for should_have to work with methods taking args returning a collection. E.g. @dave.should_have(3).albums_i_have_that_this_guy_doesnt(@aslak)
+* Added [#5570] should_not_receive(:msg).with(:specific, "args")
+* Applied [#5065] to support using define_method rather than method_missing to capture expected messages on mocks. Thanks to Eero Saynatkari for the tip that made it work.
+* Restructured directories and Modules in order to separate rspec into three distinct Modules: Spec::Expectations, Spec::Runner and Spec::Mocks. This will allow us to more easily integrate other mock frameworks and/or allow test/unit users to take advantage of the expectation API.
+* Applied [#5620] support any boolean method and arbitrary comparisons (5.should_be < 6) (Patch from Mike Williams)
+
+== Version 0.6.3
+
+This release fixes some minor bugs related to RSpec on Rails
+Note that if you upgrade a rails app with this version of the rspec_on_rails plugin
+you should remove your lib/tasks/rspec.rake if it exists.
+
+* Backtraces from drb (and other standard ruby libraries) are now stripped from backtraces.
+* Applied [#5557] Put rspec.rake into the task directory of the RSpec on Rails plugin (Patch from Daniel Siemssen)
+* Applied [#5556] rails_spec_server loads environment.rb twice (Patch from Daniel Siemssen)
+
+== Version 0.6.2
+This release fixes a couple of regressions with the rake task that were introduced in the previous version (0.6.1)
+
+* Fixed [#5518] ruby -w: warnings in 0.6.1
+* Applied [#5525] fix rake task path to spec tool for gem-installed rspec (patch from Riley Lynch)
+* Fixed a teensey regression with the rake task - introduced in 0.6.1. The spec command is now quoted so it works on windows.
+
+== Version 0.6.1
+This is the "fix the most annoying bugs release" of RSpec. There are 9 bugfixes this time.
+Things that may break backwards compatibility:
+1) Spec::Rake::SpecTask no longer has the options attribute. Use ruby_opts, spec_opts and rcov_opts instead.
+
+* Fixed [#4891] RCOV task failing on windows
+* Fixed [#4896] Shouldn't modify user's $LOAD_PATH (Tip from Gavin Sinclair)
+* Fixed [#5369] ruby -w: warnings in RSpec 0.5.16 (Tip from Suraj Kurapati)
+* Applied [#5141] ExampleMatcher doesn't escape strings before matching (Patch from Nikolai Weibull).
+* Fixed [#5224] Move 'require diff-lcs' from test_helper.rb to diff_test.rb (Tip from Chris Roos)
+* Applied [#5449] Rake stats for specs (Patch from Nick Sieger)
+* Applied [#5468, #5058] Fix spec runner to correctly run controller specs (Patch from Daniel Siemssen)
+* Applied fixes to rails_spec_server to improve its ability to run several times. (Patch from Daniel Siemssen)
+* Changed RCov::VerifyTask to fail if the coverage is above the threshold. This is to ensure it gets bumped when coverage improves.
+
+== Version 0.6.0
+This release makes an official commitment to underscore_syntax (with no more support for dot.syntax)
+
+* Fixed bug (5292) that caused mock argument matching to fail
+* Converted ALL tests to use underscore syntax
+* Fixed all remaining problems with underscores revealed by converting all the tests to underscores
+* Enhanced sugar to support combinations of methods (i.e. once.and_return)
+* Simplified helper structure taking advantage of dot/underscore combos (i.e. should.be.an_instance_of, which can be expressed as should be_an_instance_of)
+* Added support for at_most in mocks
+* Added support for should_not_receive(:msg) (will be removing should_receive(:msg).never some time soon)
+* Added support for should_have_exactly(5).items_in_collection
+
+== Version 0.5.16
+This release improves Rails support and test2spec translation.
+
+* Fixed underscore problems that occurred when RSpec was used in Rails
+* Simplified the Rails support by packaging it as a plugin instead of a generator gem.
+* Fixed [#5063] 'rspec_on_rails' require line in spec_helper.rb
+* Added pre_commit rake task to reduce risk of regressions. Useful for RSpec developers and patchers.
+* Added failure_message to RSpec Rake task
+* test2spec now defines converted helper methods outside of the setup block (bug #5057).
+
+== Version 0.5.15
+This release removes a prematurely added feature that shouldn't have been added.
+
+* Removed support for differences that was added in 0.5.14. The functionality is not aligned with RSpec's vision.
+
+== Version 0.5.14
+This release introduces better ways to extend specs, improves some of the core API and
+a experimental support for faster rails specs.
+
+* Added proc methods for specifying differences (increments and decrements). See difference_test.rb
+* Methods can now be defined alongside specs. This obsoletes the need for defining methods in setup. (Patch #5002 from Brian Takita)
+* Sugar (underscores) now works correctly with should be_a_kind_of and should be_an_instance_of
+* Added support for include and inherit in contexts. (Patch #4971 from Brian Takita)
+* Added rails_spec and rails_spec_server for faster specs on rails (still buggy - help needed)
+* Fixed bug that caused should_render to break if given a :symbol (in Rails)
+* Added support for comparing exception message in should_raise and should_not_raise
+
+== Version 0.5.13
+This release fixes some subtle bugs in the mock API.
+
+* Use fully-qualified class name of Exceptions in failure message. Easier to debug that way.
+* Fixed a bug that caused mocks to yield a one-element array (rather than the element) when one yield arg specified.
+* Mocks not raise AmbiguousReturnError if an explicit return is used at the same time as an expectation block.
+* Blocks passed to yielding mocks can now raise without causing mock verification to fail.
+
+== Version 0.5.12
+This release adds diff support for failure messages, a HTML formatter plus some other
+minor enhancements.
+
+* Added HTML formatter.
+* Added fail_on_error option to spectask.
+* Added support for diffing, using the diff-lcs Rubygem (#2648).
+* Remove RSpec on Rails files from backtrace (#4694).
+* All of RSpec's own tests run successfully after translation with test2spec.
+* Added --verbose mode for test2spec - useful for debugging when classes fail to translate.
+* Output of various formatters is now flushed - to get more continuous output.
+
+== Version 0.5.11
+This release makes test2spec usable with Rails (with some manual steps).
+See http://rspec.rubyforge.org/tools/rails.html for more details
+
+* test2spec now correctly translates bodies of helper methods (non- test_*, setup and teardown ones).
+* Added more documentation about how to get test2spec to work with Rails.
+
+== Version 0.5.10
+This version features a second rewrite of test2spec - hopefully better than the previous one.
+
+* Improved test2spec's internals. It now transforms the syntax tree before writing out the code.
+
+== Version 0.5.9
+This release improves test2spec by allowing more control over the output
+
+* Added --template option to test2spec, which allows for custom output driven by ERB
+* Added --quiet option to test2spec
+* Removed unnecessary dependency on RubyToC
+
+== Version 0.5.8
+This release features a new Test::Unit to RSpec translation tool.
+Also note that the RubyGem of the previous release (0.5.7) was corrupt.
+We're close to being able to translate all of RSpec's own Test::Unit
+tests and have them run successfully!
+
+* Updated test2spec documentation.
+* Replaced old test2rspec with a new test2spec, which is based on ParseTree and RubyInline.
+
+== Version 0.5.7
+This release changes examples and documentation to recommend underscores rather than dots,
+and addresses some bugfixes and changes to the spec commandline.
+
+* spec DIR now works correctly, recursing down and slurping all *.rb files
+* All documentation and examples are now using '_' instead of '.'
+* Custom external formatters can now be specified via --require and --format.
+
+== Version 0.5.6
+This release fixes a bug in the Rails controller generator
+
+* The controller generator did not write correct source code (missing 'do'). Fixed.
+
+== Version 0.5.5
+This release adds initial support for Ruby on Rails in the rspec_generator gem.
+
+* [Rails] Reorganised Lachie's original code to be a generator packaged as a gem rather than a plugin.
+* [Rails] Imported code from http://lachie.info/svn/projects/rails_plugins/rspec_on_rails (Written by Lachie Cox)
+* Remove stack trace lines from TextMate's Ruby bundle
+* Better error message from spectask when no spec files are found.
+
+== Version 0.5.4
+The "the tutorial is ahead of the gem" release
+
+* Support for running a single spec with --spec
+* Exitcode is now 1 unless all specs pass, in which case it's 0.
+* -v, --version now both mean the same thing
+* For what was verbose output (-v), use --format specdoc or -f s
+* --format rdoc always runs in dry-run mode
+* Removed --doc and added --format and --dry-run
+* Refactored towards more pluggable formatters
+* Use webgen's execute tag when generating website (more accurate)
+* Fixed incorrect quoting of spec_opts in SpecTask
+* Added patch to enable underscored shoulds like 1.should_equal(1) - patch from Rich Kilmer
+* Removed most inherited instance method from Mock, making more methods mockable.
+* Made the RCovVerify task part of the standard toolset.
+* Documented Rake task and how to use it with Rcov
+* Implemented tags for website (hooking into ERB, RedCloth and syntax)
+* RSpec Rake task now takes spec_opts and out params so it can be used for doc generation
+* RCov integration for RSpec Rake task (#4058)
+* Group all results instead of printing them several times (#4057)
+* Mocks can now yield
+* Various improvements to error reporting (including #4191)
+* backtrace excludes rspec code - use -b to include it
+* split examples into examples (passing) and failing_examples
+
+== Version 0.5.3
+The "hurry up, CoR is in two days" release.
+
+* Don't run rcov by default
+* Make separate task for running tests with RCov
+* Added Rake task to fail build if coverage drops below a certain threshold
+* Even more failure output cleanup (simplification)
+* Added duck_type constraint for mocks
+
+== Version 0.5.2
+This release has minor improvements to the commandline and fixes some gem warnings
+
+* Readded README to avoid RDoc warnings
+* Added --version switch to commandline
+* More changes to the mock API
+
+== Version 0.5.1
+This release is the first release of RSpec with a new website. It will look better soon.
+
+* Added initial documentation for API
+* Added website based on webgen
+* Modified test task to use rcov
+* Deleted unused code (thanks, rcov!)
+* Various changes to the mock API,
+* Various improvements to failure reporting
+
+== Version 0.5.0
+This release introduces a new API and obsolesces previous versions.
+
+* Moved source code to separate subfolders
+* Added new DSL runner based on instance_exec
+* Added spike for testdox/rdoc generation
+* merge Astels' and Chelimsky's work on ShouldHelper
+* this would be 0.5.0 if I updated the documentation
+* it breaks all of your existing specifications. We're not sorry.
+
+== Version 0.3.2
+
+The "srbaker is an idiot" release.
+
+* also forgot to update the path to the actual Subversion repository
+* this should be it
+
+== Version 0.3.1
+
+This is just 0.3.0, but with the TUTORIAL added to the documentation list.
+
+* forgot to include TUTORIAL in the documentation
+
+== Version 0.3.0
+
+It's been a while since last release, lots of new stuff is available. For instance:
+
+* improvements to the runners
+* addition of should_raise expectation (thanks to Brian Takita)
+* some documentation improvements
+* RSpec usable as a DSL
+
+== Version 0.2.0
+
+This release provides a tutorial for new users wishing to get started with
+RSpec, and many improvements.
+
+* improved reporting in the spec runner output
+* update the examples to the new mock api
+* added TUTORIAL, a getting started document for new users of RSpec
+
+== Version 0.1.7
+
+This release improves installation and documentation, mock integration and error reporting.
+
+* Comparison errors now print the class name too.
+* Mocks now take an optional +options+ parameter to specify behaviour.
+* Removed __expects in favour of should_receive
+* Added line number reporting in mock error messages for unreceived message expectations.
+* Added should_match and should_not_match.
+* Added a +mock+ method to Spec::Context which will create mocks that autoverify (no need to call __verify).
+* Mocks now require names in the constructor to ensure sensible error messages.
+* Made 'spec' executable and updated usage instructions in README accordingly.
+* Made more parts of the Spec::Context API private to avoid accidental usage.
+* Added more RDoc to Spec::Context.
+
+== Version 0.1.6
+
+More should methods.
+
+* Added should_match and should_not_match.
+
+== Version 0.1.5
+
+Included examples and tests in gem.
+
+== Version 0.1.4
+
+More tests on block based Mock expectations.
+
+== Version 0.1.3
+
+Improved mocking:
+
+* block based Mock expectations.
+
+== Version 0.1.2
+
+This release adds some improvements to the mock API and minor syntax improvements
+
+* Added Mock.should_expect for a more consistent DSL.
+* Added MockExpectation.and_returns for a better DSL.
+* Made Mock behave as a null object after a call to Mock.ignore_missing
+* Internal syntax improvements.
+* Improved exception trace by adding exception class name to error message.
+* Renamed some tests for better consistency.
+
+== Version 0.1.1
+
+This release adds some shoulds and improves error reporting
+
+* Added should be_same_as and should_not be_same_as.
+* Improved error reporting for comparison expectations.
+
+== Version 0.1.0
+
+This is the first preview release of RSpec, a Behaviour-Driven Development library for Ruby
+
+* Added Rake script with tasks for gems, rdoc etc.
+* Added an XForge task to make release go easier.
diff --git a/vendor/gems/rspec-1.1.2/MIT-LICENSE b/vendor/gems/rspec-1.1.2/MIT-LICENSE
new file mode 100644
index 000000000..1d11ea59e
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2005-2007 The RSpec Development Team
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/gems/rspec-1.1.2/README b/vendor/gems/rspec-1.1.2/README
new file mode 100644
index 000000000..0683b0deb
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/README
@@ -0,0 +1,71 @@
+== RSpec
+
+RSpec is a Behaviour Driven Development framework with tools to express User Stories
+with Executable Scenarios and Executable Examples at the code level.
+
+RSpec ships with several modules:
+
+Spec::Story provides a framework for expressing User Stories
+
+Spec::Example provides a framework for expressing code Examples
+
+Spec::Matchers provides Expression Matchers for use with Spec::Expectations
+and Spec::Mocks.
+
+Spec::Expectations supports setting expectations on your objects so you
+can do things like:
+
+ result.should equal(expected_result)
+
+Spec::Mocks supports creating Mock Objects, Stubs, and adding Mock/Stub
+behaviour to your existing objects.
+
+== Installation
+
+The simplest approach is to install the gem:
+
+ gem install -r rspec #mac users must sudo
+
+== Building the RSpec gem
+If you prefer to build the gem locally, check out source from svn://rubyforge.org/var/svn/rspec/trunk. Then
+do the following:
+
+ rake gem
+ gem install pkg/rspec-0.x.x.gem (you may have to sudo)
+
+== Running RSpec's specs
+In order to run RSpec's full suite of specs (rake pre_commit) you must install the following gems:
+
+* rake # Runs the build script
+* rcov # Verifies that the code is 100% covered by specs
+* webby # Generates the static HTML website
+* syntax # Required to highlight ruby code
+* diff-lcs # Required if you use the --diff switch
+* win32console # Required by the --colour switch if you're on Windows
+* meta_project # Required in order to make releases at RubyForge
+* heckle # Required if you use the --heckle switch
+* hpricot # Used for parsing HTML from the HTML output formatter in RSpec's own specs
+
+Once those are all installed, you should be able to run the suite with the following steps:
+
+* svn co svn://rubyforge.org/var/svn/rspec/trunk rspec
+* cd rspec
+* rake install_dependencies
+* cd example_rails_app
+* export RSPEC_RAILS_VERSION=1.2.3
+* rake rspec:generate_mysql_config
+* mysql -u root < db/mysql_setup.sql
+* cd ..
+* rake pre_commit
+
+Note that RSpec itself - once built - doesn't have any dependencies outside the Ruby core
+and stdlib - with a few exceptions:
+
+* The spec command line uses diff-lcs when --diff is specified.
+* The spec command line uses heckle when --heckle is specified.
+* The Spec::Rake::SpecTask needs RCov if RCov is enabled in the task.
+
+See http://rspec.rubyforge.org for further documentation.
+
+== Contributing
+
diff --git a/vendor/gems/rspec-1.1.2/Rakefile b/vendor/gems/rspec-1.1.2/Rakefile
new file mode 100644
index 000000000..84d0b7da5
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/Rakefile
@@ -0,0 +1,276 @@
+$:.unshift('lib')
+require 'rubygems'
+require 'rake/gempackagetask'
+require 'rake/contrib/rubyforgepublisher'
+require 'rake/clean'
+require 'rake/rdoctask'
+require 'rake/testtask'
+require 'spec/version'
+dir = File.dirname(__FILE__)
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../pre_commit/lib"))
+require "pre_commit"
+
+# Some of the tasks are in separate files since they are also part of the website documentation
+load File.dirname(__FILE__) + '/rake_tasks/examples.rake'
+load File.dirname(__FILE__) + '/rake_tasks/examples_with_rcov.rake'
+load File.dirname(__FILE__) + '/rake_tasks/failing_examples_with_html.rake'
+load File.dirname(__FILE__) + '/rake_tasks/verify_rcov.rake'
+
+PKG_NAME = "rspec"
+PKG_VERSION = Spec::VERSION::STRING
+PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
+PKG_FILES = FileList[
+ '[A-Z]*',
+ 'lib/**/*.rb',
+ 'spec/**/*.rb',
+ 'examples/**/*',
+ 'plugins/**/*',
+ 'stories/**/*'
+]
+
+task :default => [:verify_rcov]
+task :verify_rcov => [:spec, :stories]
+
+desc "Run all specs"
+Spec::Rake::SpecTask.new do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.spec_opts = ['--options', 'spec.opts']
+ unless ENV['NO_RCOV']
+ t.rcov = true
+ t.rcov_dir = '../doc/output/coverage'
+ t.rcov_opts = ['--exclude', 'spec\/spec,bin\/spec,examples,\/var\/lib\/gems,\/Library\/Ruby,\.autotest']
+ end
+end
+
+desc "Run all stories"
+task :stories do
+ html = 'story_server/prototype/rspec_stories.html'
+ ruby "stories/all.rb --colour --format plain --format html:#{html}"
+ unless IO.read(html) =~ //m
+ raise 'highlighted parameters are broken in story HTML'
+ end
+end
+
+desc "Run all specs and store html output in doc/output/report.html"
+Spec::Rake::SpecTask.new('spec_html') do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb', '../../RSpec.tmbundle/Support/spec/*_spec.rb']
+ t.spec_opts = ['--format html:../doc/output/report.html','--backtrace']
+end
+
+desc "Run all failing examples"
+Spec::Rake::SpecTask.new('failing_examples') do |t|
+ t.spec_files = FileList['failing_examples/**/*_spec.rb']
+end
+
+desc 'Generate RDoc'
+rd = Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_dir = '../doc/output/rdoc'
+ rdoc.options << '--title' << 'RSpec' << '--line-numbers' << '--inline-source' << '--main' << 'README'
+ rdoc.rdoc_files.include('README', 'CHANGES', 'MIT-LICENSE', 'UPGRADE', 'lib/**/*.rb')
+end
+
+spec = Gem::Specification.new do |s|
+ s.name = PKG_NAME
+ s.version = PKG_VERSION
+ s.summary = Spec::VERSION::DESCRIPTION
+ s.description = <<-EOF
+ RSpec is a behaviour driven development (BDD) framework for Ruby. RSpec was
+ created in response to Dave Astels' article _A New Look at Test Driven Development_
+ which can be read at: http://daveastels.com/index.php?p=5 RSpec is intended to
+ provide the features discussed in Dave's article.
+ EOF
+
+ s.files = PKG_FILES.to_a
+ s.require_path = 'lib'
+
+ s.has_rdoc = true
+ s.rdoc_options = rd.options
+ s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$|^EXAMPLES.rd$/ }.to_a
+
+ s.bindir = 'bin'
+ s.executables = ['spec', 'spec_translator']
+ s.default_executable = 'spec'
+ s.author = "RSpec Development Team"
+ s.email = "rspec-devel@rubyforge.org"
+ s.homepage = "http://rspec.rubyforge.org"
+ s.platform = Gem::Platform::RUBY
+ s.rubyforge_project = "rspec"
+end
+
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_zip = true
+ pkg.need_tar = true
+end
+
+def egrep(pattern)
+ Dir['**/*.rb'].each do |fn|
+ count = 0
+ open(fn) do |f|
+ while line = f.gets
+ count += 1
+ if line =~ pattern
+ puts "#{fn}:#{count}:#{line}"
+ end
+ end
+ end
+ end
+end
+
+desc "Look for TODO and FIXME tags in the code"
+task :todo do
+ egrep /(FIXME|TODO|TBD)/
+end
+
+task :clobber do
+ core.clobber
+end
+
+task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_news]
+
+desc "Verifies that there is no uncommitted code"
+task :verify_committed do
+ IO.popen('svn stat') do |io|
+ io.each_line do |line|
+ raise "\n!!! Do a svn commit first !!!\n\n" if line =~ /^\s*M\s*/
+ end
+ end
+end
+
+desc "Creates a tag in svn"
+task :tag do
+ from = `svn info #{File.dirname(__FILE__)}`.match(/URL: (.*)\/rspec/n)[1]
+ to = from.gsub(/trunk/, "tags/#{Spec::VERSION::TAG}")
+ current = from.gsub(/trunk/, "tags/CURRENT")
+
+ puts "Creating tag in SVN"
+ tag_cmd = "svn cp #{from} #{to} -m \"Tag release #{Spec::VERSION::FULL_VERSION}\""
+ `#{tag_cmd}` ; raise "ERROR: #{tag_cmd}" unless $? == 0
+
+ puts "Removing CURRENT"
+ remove_current_cmd = "svn rm #{current} -m \"Remove tags/CURRENT\""
+ `#{remove_current_cmd}` ; raise "ERROR: #{remove_current_cmd}" unless $? == 0
+
+ puts "Re-Creating CURRENT"
+ create_current_cmd = "svn cp #{to} #{current} -m \"Copy #{Spec::VERSION::TAG} to tags/CURRENT\""
+ `#{create_current_cmd}` ; "ERROR: #{create_current_cmd}" unless $? == 0
+end
+
+desc "Run this task before you commit. You should see 'OK TO COMMIT'"
+task(:pre_commit) {core.pre_commit}
+
+desc "Build the website, but do not publish it"
+task(:website) {core.website}
+
+task(:rdoc_rails) {core.rdoc_rails}
+
+task :verify_user do
+ raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
+end
+
+desc "Upload Website to RubyForge"
+task :publish_website => [:verify_user, :website] do
+ unless Spec::VERSION::RELEASE_CANDIDATE
+ publisher = Rake::SshDirPublisher.new(
+ "rspec-website@rubyforge.org",
+ "/var/www/gforge-projects/#{PKG_NAME}",
+ "../doc/output"
+ )
+ publisher.upload
+ else
+ puts "** Not publishing packages to RubyForge - this is a prerelease"
+ end
+end
+
+desc "Upload Website archive to RubyForge"
+task :archive_website => [:verify_user, :website] do
+ publisher = Rake::SshDirPublisher.new(
+ "rspec-website@rubyforge.org",
+ "/var/www/gforge-projects/#{PKG_NAME}/#{Spec::VERSION::TAG}",
+ "../doc/output"
+ )
+ publisher.upload
+end
+
+desc "Package the Rails plugin"
+task :package_rspec_on_rails do
+ mkdir 'pkg' rescue nil
+ rm_rf 'pkg/rspec_on_rails' rescue nil
+ `svn export ../rspec_on_rails pkg/rspec_on_rails-#{PKG_VERSION}`
+ Dir.chdir 'pkg' do
+ `tar cvzf rspec_on_rails-#{PKG_VERSION}.tgz rspec_on_rails-#{PKG_VERSION}`
+ end
+end
+task :pkg => :package_rspec_on_rails
+
+desc "Package the RSpec.tmbundle"
+task :package_tmbundle do
+ mkdir 'pkg' rescue nil
+ rm_rf 'pkg/RSpec.tmbundle' rescue nil
+ `svn export ../RSpec.tmbundle pkg/RSpec.tmbundle`
+ Dir.chdir 'pkg' do
+ `tar cvzf RSpec-#{PKG_VERSION}.tmbundle.tgz RSpec.tmbundle`
+ end
+end
+task :pkg => :package_tmbundle
+
+desc "Publish gem+tgz+zip on RubyForge. You must make sure lib/version.rb is aligned with the CHANGELOG file"
+task :publish_packages => [:verify_user, :package] do
+ release_files = FileList[
+ "pkg/#{PKG_FILE_NAME}.gem",
+ "pkg/#{PKG_FILE_NAME}.tgz",
+ "pkg/rspec_on_rails-#{PKG_VERSION}.tgz",
+ "pkg/#{PKG_FILE_NAME}.zip",
+ "pkg/RSpec-#{PKG_VERSION}.tmbundle.tgz"
+ ]
+ unless Spec::VERSION::RELEASE_CANDIDATE
+ require 'meta_project'
+ require 'rake/contrib/xforge'
+
+ Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |xf|
+ # Never hardcode user name and password in the Rakefile!
+ xf.user_name = ENV['RUBYFORGE_USER']
+ xf.files = release_files.to_a
+ xf.release_name = "RSpec #{PKG_VERSION}"
+ end
+ else
+ puts "SINCE THIS IS A PRERELEASE, FILES ARE UPLOADED WITH SSH, NOT TO THE RUBYFORGE FILE SECTION"
+ puts "YOU MUST TYPE THE PASSWORD #{release_files.length} TIMES..."
+
+ host = "rspec-website@rubyforge.org"
+ remote_dir = "/var/www/gforge-projects/#{PKG_NAME}"
+
+ publisher = Rake::SshFilePublisher.new(
+ host,
+ remote_dir,
+ File.dirname(__FILE__),
+ *release_files
+ )
+ publisher.upload
+
+ puts "UPLADED THE FOLLOWING FILES:"
+ release_files.each do |file|
+ name = file.match(/pkg\/(.*)/)[1]
+ puts "* http://rspec.rubyforge.org/#{name}"
+ end
+
+ puts "They are not linked to anywhere, so don't forget to tell people!"
+ end
+end
+
+desc "Publish news on RubyForge"
+task :publish_news => [:verify_user] do
+ unless Spec::VERSION::RELEASE_CANDIDATE
+ require 'meta_project'
+ require 'rake/contrib/xforge'
+ Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |news|
+ # Never hardcode user name and password in the Rakefile!
+ news.user_name = ENV['RUBYFORGE_USER']
+ end
+ else
+ puts "** Not publishing news to RubyForge - this is a prerelease"
+ end
+end
+
+def core
+ PreCommit::Core.new(self)
+end
diff --git a/vendor/gems/rspec-1.1.2/TODO b/vendor/gems/rspec-1.1.2/TODO
new file mode 100644
index 000000000..250bb66c2
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/TODO
@@ -0,0 +1,2 @@
+=== Before releasing 1.1.0:
+
diff --git a/vendor/gems/rspec-1.1.2/UPGRADE b/vendor/gems/rspec-1.1.2/UPGRADE
new file mode 100644
index 000000000..0a2c6f528
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/UPGRADE
@@ -0,0 +1,31 @@
+= Upgrading existing code to RSpec-0.9
+
+== General (see below for Spec::Rails specifics)
+
+=== New Syntax for should and should_not
+
+* Use translator (should get 90% of your code)
+* Manually fix "parenthesis" warnings
+
+=== Change before_context_eval to before_eval
+
+before_context_eval is an un-published hook used by
+Spec::Rails to create specialized behaviour contexts.
+Most of you don't need to change this, but for those
+who have exploited it, you'll need to change it to
+before_eval.
+
+== Spec::Rails
+
+=== spec_helper.rb
+
+We've added a new way to configure Spec::Runner to do
+things like use_transactional_fixtures and use_instantiated_fixtures.
+You'll need to update spec/spec_helper.rb accordingly. You can either
+just re-generate it:
+
+ script/generate rspec
+
+Or modify spec_helper.rb based on the template, which can be found at:
+
+ vendor/plugins/rspec_on_rails/generators/rspec/templates/spec_helper.rb
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/bin/spec b/vendor/gems/rspec-1.1.2/bin/spec
new file mode 100644
index 000000000..283176d76
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/bin/spec
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
+require 'spec'
+exit ::Spec::Runner::CommandLine.run(rspec_options)
diff --git a/vendor/gems/rspec-1.1.2/bin/spec_translator b/vendor/gems/rspec-1.1.2/bin/spec_translator
new file mode 100644
index 000000000..abd50b743
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/bin/spec_translator
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+raise "\n\nUsage: spec_translator from_dir to_dir\n\n" if ARGV.size != 2
+$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
+require 'spec/translator'
+t = ::Spec::Translator.new
+from = ARGV[0]
+to = ARGV[1]
+t.translate(from, to)
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/autogenerated_docstrings_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/autogenerated_docstrings_example.rb
new file mode 100644
index 000000000..a4928ef4a
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/autogenerated_docstrings_example.rb
@@ -0,0 +1,19 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+# Run spec w/ -fs to see the output of this file
+
+describe "Examples with no descriptions" do
+
+ # description is auto-generated as "should equal(5)" based on the last #should
+ it do
+ 3.should equal(3)
+ 5.should equal(5)
+ end
+
+ it { 3.should be < 5 }
+
+ it { ["a"].should include("a") }
+
+ it { [1,2,3].should respond_to(:size) }
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/before_and_after_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/before_and_after_example.rb
new file mode 100644
index 000000000..7db6274ef
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/before_and_after_example.rb
@@ -0,0 +1,40 @@
+require File.dirname(__FILE__) + '/spec_helper'
+$global = 0
+
+describe "State created in before(:all)" do
+ before :all do
+ @sideeffect = 1
+ $global +=1
+ end
+
+ before :each do
+ @isolated = 1
+ end
+
+ it "should be accessible from example" do
+ @sideeffect.should == 1
+ $global.should == 1
+ @isolated.should == 1
+
+ @sideeffect += 1
+ @isolated += 1
+ end
+
+ it "should not have sideffects" do
+ @sideeffect.should == 1
+ $global.should == 2
+ @isolated.should == 1
+
+ @sideeffect += 1
+ @isolated += 1
+ end
+
+ after :each do
+ $global += 1
+ end
+
+ after :all do
+ $global.should == 3
+ $global = 0
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/behave_as_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/behave_as_example.rb
new file mode 100644
index 000000000..e95d1469a
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/behave_as_example.rb
@@ -0,0 +1,45 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+def behave_as_electric_musician
+ respond_to(:read_notes, :turn_down_amp)
+end
+
+def behave_as_musician
+ respond_to(:read_notes)
+end
+
+module BehaveAsExample
+
+ class BluesGuitarist
+ def read_notes; end
+ def turn_down_amp; end
+ end
+
+ class RockGuitarist
+ def read_notes; end
+ def turn_down_amp; end
+ end
+
+ class ClassicGuitarist
+ def read_notes; end
+ end
+
+ describe BluesGuitarist do
+ it "should behave as guitarist" do
+ BluesGuitarist.new.should behave_as_electric_musician
+ end
+ end
+
+ describe RockGuitarist do
+ it "should behave as guitarist" do
+ RockGuitarist.new.should behave_as_electric_musician
+ end
+ end
+
+ describe ClassicGuitarist do
+ it "should not behave as guitarist" do
+ ClassicGuitarist.new.should behave_as_musician
+ end
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/custom_expectation_matchers.rb b/vendor/gems/rspec-1.1.2/examples/pure/custom_expectation_matchers.rb
new file mode 100644
index 000000000..075bb542d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/custom_expectation_matchers.rb
@@ -0,0 +1,54 @@
+module AnimalSpecHelper
+ class Eat
+ def initialize(food)
+ @food = food
+ end
+
+ def matches?(animal)
+ @animal = animal
+ @animal.eats?(@food)
+ end
+
+ def failure_message
+ "expected #{@animal} to eat #{@food}, but it does not"
+ end
+
+ def negative_failure_message
+ "expected #{@animal} not to eat #{@food}, but it does"
+ end
+ end
+
+ def eat(food)
+ Eat.new(food)
+ end
+end
+
+module Animals
+ class Animal
+ def eats?(food)
+ return foods_i_eat.include?(food)
+ end
+ end
+
+ class Mouse < Animal
+ def foods_i_eat
+ [:cheese]
+ end
+ end
+
+ describe Mouse do
+ include AnimalSpecHelper
+ before(:each) do
+ @mouse = Animals::Mouse.new
+ end
+
+ it "should eat cheese" do
+ @mouse.should eat(:cheese)
+ end
+
+ it "should not eat cat" do
+ @mouse.should_not eat(:cat)
+ end
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/custom_formatter.rb b/vendor/gems/rspec-1.1.2/examples/pure/custom_formatter.rb
new file mode 100644
index 000000000..c449fdc2e
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/custom_formatter.rb
@@ -0,0 +1,12 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require 'spec/runner/formatter/progress_bar_formatter'
+
+# Example of a formatter with custom bactrace printing. Run me with:
+# ruby bin/spec failing_examples -r examples/custom_formatter.rb -f CustomFormatter
+class CustomFormatter < Spec::Runner::Formatter::ProgressBarFormatter
+ def backtrace_line(line)
+ line.gsub(/([^:]*\.rb):(\d*)/) do
+ "#{$1}:#{$2} "
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/dynamic_spec.rb b/vendor/gems/rspec-1.1.2/examples/pure/dynamic_spec.rb
new file mode 100644
index 000000000..15d473d61
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/dynamic_spec.rb
@@ -0,0 +1,9 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "Some integers" do
+ (1..10).each do |n|
+ it "The root of #{n} square should be #{n}" do
+ Math.sqrt(n*n).should == n
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/file_accessor.rb b/vendor/gems/rspec-1.1.2/examples/pure/file_accessor.rb
new file mode 100644
index 000000000..ff6fb743c
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/file_accessor.rb
@@ -0,0 +1,19 @@
+require File.dirname(__FILE__) + '/spec_helper'
+class FileAccessor
+ def open_and_handle_with(pathname, processor)
+ pathname.open do |io|
+ processor.process(io)
+ end
+ end
+end
+
+if __FILE__ == $0
+ require File.dirname(__FILE__) + '/io_processor'
+ require 'pathname'
+
+ accessor = FileAccessor.new
+ io_processor = IoProcessor.new
+ file = Pathname.new ARGV[0]
+
+ accessor.open_and_handle_with(file, io_processor)
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/file_accessor_spec.rb b/vendor/gems/rspec-1.1.2/examples/pure/file_accessor_spec.rb
new file mode 100644
index 000000000..628d4c0b0
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/file_accessor_spec.rb
@@ -0,0 +1,38 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/file_accessor'
+require 'stringio'
+
+describe "A FileAccessor" do
+ # This sequence diagram illustrates what this spec specifies.
+ #
+ # +--------------+ +----------+ +-------------+
+ # | FileAccessor | | Pathname | | IoProcessor |
+ # +--------------+ +----------+ +-------------+
+ # | | |
+ # open_and_handle_with | | |
+ # -------------------->| | open | |
+ # | |--------------->| | |
+ # | | io | | |
+ # | |<...............| | |
+ # | | | process(io) |
+ # | |---------------------------------->| |
+ # | | | | |
+ # | |<..................................| |
+ # | | |
+ #
+ it "should open a file and pass it to the processor's process method" do
+ # This is the primary actor
+ accessor = FileAccessor.new
+
+ # These are the primary actor's neighbours, which we mock.
+ file = mock "Pathname"
+ io_processor = mock "IoProcessor"
+
+ io = StringIO.new "whatever"
+ file.should_receive(:open).and_yield io
+ io_processor.should_receive(:process).with(io)
+
+ accessor.open_and_handle_with(file, io_processor)
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/greeter_spec.rb b/vendor/gems/rspec-1.1.2/examples/pure/greeter_spec.rb
new file mode 100644
index 000000000..ec7669dcc
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/greeter_spec.rb
@@ -0,0 +1,31 @@
+require File.dirname(__FILE__) + '/spec_helper'
+# greeter.rb
+#
+# Based on http://glu.ttono.us/articles/2006/12/19/tormenting-your-tests-with-heckle
+#
+# Run with:
+#
+# spec greeter_spec.rb --heckle Greeter
+#
+class Greeter
+ def initialize(person = nil)
+ @person = person
+ end
+
+ def greet
+ @person.nil? ? "Hi there!" : "Hi #{@person}!"
+ end
+end
+
+describe "Greeter" do
+ it "should say Hi to person" do
+ greeter = Greeter.new("Kevin")
+ greeter.greet.should == "Hi Kevin!"
+ end
+
+ it "should say Hi to nobody" do
+ greeter = Greeter.new
+ # Uncomment the next line to make Heckle happy
+ #greeter.greet.should == "Hi there!"
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/helper_method_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/helper_method_example.rb
new file mode 100644
index 000000000..d97f19e65
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/helper_method_example.rb
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+module HelperMethodExample
+ describe "an example group with helper a method" do
+ def helper_method
+ "received call"
+ end
+
+ it "should make that method available to specs" do
+ helper_method.should == "received call"
+ end
+ end
+end
+
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/io_processor.rb b/vendor/gems/rspec-1.1.2/examples/pure/io_processor.rb
new file mode 100644
index 000000000..6b15147b6
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/io_processor.rb
@@ -0,0 +1,8 @@
+class DataTooShort < StandardError; end
+
+class IoProcessor
+ # Does some fancy stuff unless the length of +io+ is shorter than 32
+ def process(io)
+ raise DataTooShort if io.read.length < 32
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/io_processor_spec.rb b/vendor/gems/rspec-1.1.2/examples/pure/io_processor_spec.rb
new file mode 100644
index 000000000..5cab7bf31
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/io_processor_spec.rb
@@ -0,0 +1,21 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/io_processor'
+require 'stringio'
+
+describe "An IoProcessor" do
+ before(:each) do
+ @processor = IoProcessor.new
+ end
+
+ it "should raise nothing when the file is exactly 32 bytes" do
+ lambda {
+ @processor.process(StringIO.new("z"*32))
+ }.should_not raise_error
+ end
+
+ it "should raise an exception when the file length is less than 32 bytes" do
+ lambda {
+ @processor.process(StringIO.new("z"*31))
+ }.should raise_error(DataTooShort)
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/legacy_spec.rb b/vendor/gems/rspec-1.1.2/examples/pure/legacy_spec.rb
new file mode 100644
index 000000000..c86369515
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/legacy_spec.rb
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/spec_helper'
+context "A legacy spec" do
+ setup do
+ end
+
+ specify "should work fine" do
+ end
+
+ teardown do
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/mocking_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/mocking_example.rb
new file mode 100644
index 000000000..6adbef59d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/mocking_example.rb
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "A consumer of a mock" do
+ it "should be able to send messages to the mock" do
+ mock = mock("poke me")
+ mock.should_receive(:poke)
+ mock.poke
+ end
+end
+
+describe "a mock" do
+ it "should be able to mock the same message twice w/ different args" do
+ mock = mock("mock")
+ mock.should_receive(:msg).with(:arg1).and_return(:val1)
+ mock.should_receive(:msg).with(:arg2).and_return(:val2)
+ mock.msg(:arg1).should eql(:val1)
+ mock.msg(:arg2).should eql(:val2)
+ end
+
+ it "should be able to mock the same message twice w/ different args in reverse order" do
+ mock = mock("mock")
+ mock.should_receive(:msg).with(:arg1).and_return(:val1)
+ mock.should_receive(:msg).with(:arg2).and_return(:val2)
+ mock.msg(:arg2).should eql(:val2)
+ mock.msg(:arg1).should eql(:val1)
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/multi_threaded_behaviour_runner.rb b/vendor/gems/rspec-1.1.2/examples/pure/multi_threaded_behaviour_runner.rb
new file mode 100644
index 000000000..36edcd497
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/multi_threaded_behaviour_runner.rb
@@ -0,0 +1,28 @@
+class MultiThreadedExampleGroupRunner < Spec::Runner::ExampleGroupRunner
+ def initialize(options, arg)
+ super(options)
+ # configure these
+ @thread_count = 4
+ @thread_wait = 0
+ end
+
+ def run
+ @threads = []
+ q = Queue.new
+ example_groups.each { |b| q << b}
+ success = true
+ @thread_count.times do
+ @threads << Thread.new(q) do |queue|
+ while not queue.empty?
+ example_group = queue.pop
+ success &= example_group.suite.run(nil)
+ end
+ end
+ sleep @thread_wait
+ end
+ @threads.each {|t| t.join}
+ success
+ end
+end
+
+MultiThreadedBehaviourRunner = MultiThreadedExampleGroupRunner
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/nested_classes_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/nested_classes_example.rb
new file mode 100644
index 000000000..abe43b0a6
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/nested_classes_example.rb
@@ -0,0 +1,36 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/stack'
+
+class StackExamples < Spec::ExampleGroup
+ describe(Stack)
+ before(:each) do
+ @stack = Stack.new
+ end
+end
+
+class EmptyStackExamples < StackExamples
+ describe("when empty")
+ it "should be empty" do
+ @stack.should be_empty
+ end
+end
+
+class AlmostFullStackExamples < StackExamples
+ describe("when almost full")
+ before(:each) do
+ (1..9).each {|n| @stack.push n}
+ end
+ it "should be full" do
+ @stack.should_not be_full
+ end
+end
+
+class FullStackExamples < StackExamples
+ describe("when full")
+ before(:each) do
+ (1..10).each {|n| @stack.push n}
+ end
+ it "should be full" do
+ @stack.should be_full
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/partial_mock_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/partial_mock_example.rb
new file mode 100644
index 000000000..841ec8847
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/partial_mock_example.rb
@@ -0,0 +1,28 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+class MockableClass
+ def self.find id
+ return :original_return
+ end
+end
+
+describe "A partial mock" do
+
+ it "should work at the class level" do
+ MockableClass.should_receive(:find).with(1).and_return {:stub_return}
+ MockableClass.find(1).should equal(:stub_return)
+ end
+
+ it "should revert to the original after each spec" do
+ MockableClass.find(1).should equal(:original_return)
+ end
+
+ it "can be mocked w/ ordering" do
+ MockableClass.should_receive(:msg_1).ordered
+ MockableClass.should_receive(:msg_2).ordered
+ MockableClass.should_receive(:msg_3).ordered
+ MockableClass.msg_1
+ MockableClass.msg_2
+ MockableClass.msg_3
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/pending_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/pending_example.rb
new file mode 100644
index 000000000..13f3d00c4
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/pending_example.rb
@@ -0,0 +1,20 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "pending example (using pending method)" do
+ it %Q|should be reported as "PENDING: for some reason"| do
+ pending("for some reason")
+ end
+end
+
+describe "pending example (with no block)" do
+ it %Q|should be reported as "PENDING: Not Yet Implemented"|
+end
+
+describe "pending example (with block for pending)" do
+ it %Q|should have a failing block, passed to pending, reported as "PENDING: for some reason"| do
+ pending("for some reason") do
+ raise "some reason"
+ end
+ end
+end
+
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/predicate_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/predicate_example.rb
new file mode 100644
index 000000000..1202bb670
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/predicate_example.rb
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+class BddFramework
+ def intuitive?
+ true
+ end
+
+ def adopted_quickly?
+ true
+ end
+end
+
+describe "BDD framework" do
+
+ before(:each) do
+ @bdd_framework = BddFramework.new
+ end
+
+ it "should be adopted quickly" do
+ @bdd_framework.should be_adopted_quickly
+ end
+
+ it "should be intuitive" do
+ @bdd_framework.should be_intuitive
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/priority.txt b/vendor/gems/rspec-1.1.2/examples/pure/priority.txt
new file mode 100644
index 000000000..5b00064e2
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/priority.txt
@@ -0,0 +1 @@
+examples/custom_expectation_matchers.rb
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/shared_example_group_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/shared_example_group_example.rb
new file mode 100644
index 000000000..fb81af1ec
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/shared_example_group_example.rb
@@ -0,0 +1,81 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+module SharedExampleGroupExample
+ class OneThing
+ def what_things_do
+ "stuff"
+ end
+ end
+
+ class AnotherThing
+ def what_things_do
+ "stuff"
+ end
+ end
+
+ class YetAnotherThing
+ def what_things_do
+ "stuff"
+ end
+ end
+
+ # A SharedExampleGroup is an example group that doesn't get run.
+ # You can create one like this:
+ share_examples_for "most things" do
+ def helper_method
+ "helper method"
+ end
+
+ it "should do what things do" do
+ @thing.what_things_do.should == "stuff"
+ end
+ end
+
+ # A SharedExampleGroup is also module. If you create one like this
+ # it gets assigned to the constant AllThings
+ share_as :MostThings do
+ def helper_method
+ "helper method"
+ end
+
+ it "should do what things do" do
+ @thing.what_things_do.should == "stuff"
+ end
+ end
+
+ describe OneThing do
+ # Now you can include the shared example group like this, which
+ # feels more like what you might say ...
+ it_should_behave_like "most things"
+
+ before(:each) { @thing = OneThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
+ end
+
+ describe AnotherThing do
+ # ... or you can include the example group like this, which
+ # feels more like the programming language we love.
+ it_should_behave_like MostThings
+
+ before(:each) { @thing = AnotherThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
+ end
+
+ describe YetAnotherThing do
+ # ... or you can include the example group like this, which
+ # feels more like the programming language we love.
+ include MostThings
+
+ before(:each) { @thing = AnotherThing.new }
+
+ it "should have access to helper methods defined in the shared example group" do
+ helper_method.should == "helper method"
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/shared_stack_examples.rb b/vendor/gems/rspec-1.1.2/examples/pure/shared_stack_examples.rb
new file mode 100644
index 000000000..7a0816250
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/shared_stack_examples.rb
@@ -0,0 +1,38 @@
+require File.join(File.dirname(__FILE__), *%w[spec_helper])
+
+shared_examples_for "non-empty Stack" do
+
+ it { @stack.should_not be_empty }
+
+ it "should return the top item when sent #peek" do
+ @stack.peek.should == @last_item_added
+ end
+
+ it "should NOT remove the top item when sent #peek" do
+ @stack.peek.should == @last_item_added
+ @stack.peek.should == @last_item_added
+ end
+
+ it "should return the top item when sent #pop" do
+ @stack.pop.should == @last_item_added
+ end
+
+ it "should remove the top item when sent #pop" do
+ @stack.pop.should == @last_item_added
+ unless @stack.empty?
+ @stack.pop.should_not == @last_item_added
+ end
+ end
+
+end
+
+shared_examples_for "non-full Stack" do
+
+ it { @stack.should_not be_full }
+
+ it "should add to the top when sent #push" do
+ @stack.push "newly added top item"
+ @stack.peek.should == "newly added top item"
+ end
+
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/spec_helper.rb b/vendor/gems/rspec-1.1.2/examples/pure/spec_helper.rb
new file mode 100644
index 000000000..1e880796c
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/spec_helper.rb
@@ -0,0 +1,3 @@
+lib_path = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
+$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
+require 'spec'
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/stack.rb b/vendor/gems/rspec-1.1.2/examples/pure/stack.rb
new file mode 100644
index 000000000..407173f7b
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/stack.rb
@@ -0,0 +1,36 @@
+class StackUnderflowError < RuntimeError
+end
+
+class StackOverflowError < RuntimeError
+end
+
+class Stack
+
+ def initialize
+ @items = []
+ end
+
+ def push object
+ raise StackOverflowError if @items.length == 10
+ @items.push object
+ end
+
+ def pop
+ raise StackUnderflowError if @items.empty?
+ @items.delete @items.last
+ end
+
+ def peek
+ raise StackUnderflowError if @items.empty?
+ @items.last
+ end
+
+ def empty?
+ @items.empty?
+ end
+
+ def full?
+ @items.length == 10
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/stack_spec.rb b/vendor/gems/rspec-1.1.2/examples/pure/stack_spec.rb
new file mode 100644
index 000000000..2a769da00
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/stack_spec.rb
@@ -0,0 +1,63 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + "/stack"
+require File.dirname(__FILE__) + '/shared_stack_examples'
+
+describe Stack, " (empty)" do
+ before(:each) do
+ @stack = Stack.new
+ end
+
+ # NOTE that this one auto-generates the description "should be empty"
+ it { @stack.should be_empty }
+
+ it_should_behave_like "non-full Stack"
+
+ it "should complain when sent #peek" do
+ lambda { @stack.peek }.should raise_error(StackUnderflowError)
+ end
+
+ it "should complain when sent #pop" do
+ lambda { @stack.pop }.should raise_error(StackUnderflowError)
+ end
+end
+
+describe Stack, " (with one item)" do
+ before(:each) do
+ @stack = Stack.new
+ @stack.push 3
+ @last_item_added = 3
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+
+end
+
+describe Stack, " (with one item less than capacity)" do
+ before(:each) do
+ @stack = Stack.new
+ (1..9).each { |i| @stack.push i }
+ @last_item_added = 9
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+end
+
+describe Stack, " (full)" do
+ before(:each) do
+ @stack = Stack.new
+ (1..10).each { |i| @stack.push i }
+ @last_item_added = 10
+ end
+
+ # NOTE that this one auto-generates the description "should be full"
+ it { @stack.should be_full }
+
+ it_should_behave_like "non-empty Stack"
+
+ it "should complain on #push" do
+ lambda { @stack.push Object.new }.should raise_error(StackOverflowError)
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/stack_spec_with_nested_example_groups.rb b/vendor/gems/rspec-1.1.2/examples/pure/stack_spec_with_nested_example_groups.rb
new file mode 100644
index 000000000..05f6ad464
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/stack_spec_with_nested_example_groups.rb
@@ -0,0 +1,67 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/stack'
+require File.dirname(__FILE__) + '/shared_stack_examples'
+
+describe Stack do
+
+ before(:each) do
+ @stack = Stack.new
+ end
+
+ describe "(empty)" do
+
+ it { @stack.should be_empty }
+
+ it_should_behave_like "non-full Stack"
+
+ it "should complain when sent #peek" do
+ lambda { @stack.peek }.should raise_error(StackUnderflowError)
+ end
+
+ it "should complain when sent #pop" do
+ lambda { @stack.pop }.should raise_error(StackUnderflowError)
+ end
+
+ end
+
+ describe "(with one item)" do
+
+ before(:each) do
+ @stack.push 3
+ @last_item_added = 3
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+
+ end
+
+ describe "(with one item less than capacity)" do
+
+ before(:each) do
+ (1..9).each { |i| @stack.push i }
+ @last_item_added = 9
+ end
+
+ it_should_behave_like "non-empty Stack"
+ it_should_behave_like "non-full Stack"
+ end
+
+ describe "(full)" do
+
+ before(:each) do
+ (1..10).each { |i| @stack.push i }
+ @last_item_added = 10
+ end
+
+ it { @stack.should be_full }
+
+ it_should_behave_like "non-empty Stack"
+
+ it "should complain on #push" do
+ lambda { @stack.push Object.new }.should raise_error(StackOverflowError)
+ end
+
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/stubbing_example.rb b/vendor/gems/rspec-1.1.2/examples/pure/stubbing_example.rb
new file mode 100644
index 000000000..31354aec6
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/pure/stubbing_example.rb
@@ -0,0 +1,69 @@
+require File.dirname(__FILE__) + '/spec_helper'
+
+describe "A consumer of a stub" do
+ it "should be able to stub methods on any Object" do
+ obj = Object.new
+ obj.stub!(:foobar).and_return {:return_value}
+ obj.foobar.should equal(:return_value)
+ end
+end
+
+class StubbableClass
+ def self.find id
+ return :original_return
+ end
+end
+
+describe "A stubbed method on a class" do
+ it "should return the stubbed value" do
+ StubbableClass.stub!(:find).and_return(:stub_return)
+ StubbableClass.find(1).should equal(:stub_return)
+ end
+
+ it "should revert to the original method after each spec" do
+ StubbableClass.find(1).should equal(:original_return)
+ end
+
+ it "can stub! and mock the same message" do
+ StubbableClass.stub!(:msg).and_return(:stub_value)
+ StubbableClass.should_receive(:msg).with(:arg).and_return(:mock_value)
+
+ StubbableClass.msg.should equal(:stub_value)
+ StubbableClass.msg(:other_arg).should equal(:stub_value)
+ StubbableClass.msg(:arg).should equal(:mock_value)
+ StubbableClass.msg(:another_arg).should equal(:stub_value)
+ StubbableClass.msg(:yet_another_arg).should equal(:stub_value)
+ StubbableClass.msg.should equal(:stub_value)
+ end
+end
+
+describe "A mock" do
+ it "can stub!" do
+ mock = mock("stubbing mock")
+ mock.stub!(:msg).and_return(:value)
+ (1..10).each {mock.msg.should equal(:value)}
+ end
+
+ it "can stub! and mock" do
+ mock = mock("stubbing mock")
+ mock.stub!(:stub_message).and_return(:stub_value)
+ mock.should_receive(:mock_message).once.and_return(:mock_value)
+ (1..10).each {mock.stub_message.should equal(:stub_value)}
+ mock.mock_message.should equal(:mock_value)
+ (1..10).each {mock.stub_message.should equal(:stub_value)}
+ end
+
+ it "can stub! and mock the same message" do
+ mock = mock("stubbing mock")
+ mock.stub!(:msg).and_return(:stub_value)
+ mock.should_receive(:msg).with(:arg).and_return(:mock_value)
+ mock.msg.should equal(:stub_value)
+ mock.msg(:other_arg).should equal(:stub_value)
+ mock.msg(:arg).should equal(:mock_value)
+ mock.msg(:another_arg).should equal(:stub_value)
+ mock.msg(:yet_another_arg).should equal(:stub_value)
+ mock.msg.should equal(:stub_value)
+ end
+end
+
+
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/adder.rb b/vendor/gems/rspec-1.1.2/examples/stories/adder.rb
new file mode 100644
index 000000000..0b027b0ff
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/adder.rb
@@ -0,0 +1,13 @@
+class Adder
+ def initialize
+ @addends = []
+ end
+
+ def <<(val)
+ @addends << val
+ end
+
+ def sum
+ @addends.inject(0) { |sum_so_far, val| sum_so_far + val }
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/addition b/vendor/gems/rspec-1.1.2/examples/stories/addition
new file mode 100644
index 000000000..58f092990
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/addition
@@ -0,0 +1,34 @@
+This is a story about a calculator. The text up here above the Story: declaration
+won't be processed, so you can write whatever you wish!
+
+Story: simple addition
+
+ As an accountant
+ I want to add numbers
+ So that I can count beans
+
+ Scenario: add one plus one
+ Given an addend of 1
+ And an addend of 1
+
+ When the addends are addeds
+
+ Then the sum should be 3
+ And the corks should be popped
+
+ Scenario: add two plus five
+ Given an addend of 2
+ And an addend of 5
+
+ When the addends are added
+
+ Then the sum should be 7
+ Then it should snow
+
+ Scenario: add three more
+ GivenScenario add two plus five
+ And an addend of 3
+
+ When the addends are added
+
+ Then the sum should be 10
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/addition.rb b/vendor/gems/rspec-1.1.2/examples/stories/addition.rb
new file mode 100644
index 000000000..e43f5cf39
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/addition.rb
@@ -0,0 +1,9 @@
+require File.join(File.dirname(__FILE__), "helper")
+require File.join(File.dirname(__FILE__), "adder")
+
+# with_steps_for :addition, :more_addition do
+with_steps_for :addition, :more_addition do
+ # Then("the corks should be popped") { }
+ run File.expand_path(__FILE__).gsub(".rb","")
+end
+
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/calculator.rb b/vendor/gems/rspec-1.1.2/examples/stories/calculator.rb
new file mode 100644
index 000000000..390437c55
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/calculator.rb
@@ -0,0 +1,65 @@
+$:.push File.join(File.dirname(__FILE__), *%w[.. .. lib])
+require 'spec'
+
+class AdditionMatchers < Spec::Story::StepGroup
+ steps do |add|
+ add.given("an addend of $addend") do |addend|
+ @adder ||= Adder.new
+ @adder << addend.to_i
+ end
+ end
+end
+
+steps = AdditionMatchers.new do |add|
+ add.then("the sum should be $sum") do |sum|
+ @sum.should == sum.to_i
+ end
+end
+
+steps.when("they are added") do
+ @sum = @adder.sum
+end
+
+# This Story uses steps (see above) instead of blocks
+# passed to Given, When and Then
+
+Story "addition", %{
+ As an accountant
+ I want to add numbers
+ So that I can count some beans
+}, :steps => steps do
+ Scenario "2 + 3" do
+ Given "an addend of 2"
+ And "an addend of 3"
+ When "they are added"
+ Then "the sum should be 5"
+ end
+
+ # This scenario uses GivenScenario, which silently runs
+ # all the steps in a previous scenario.
+
+ Scenario "add 4 more" do
+ GivenScenario "2 + 3"
+ Given "an addend of 4"
+ When "they are added"
+ Then "the sum should be 9"
+ end
+end
+
+# And the class that makes the story pass
+
+class Adder
+ def << addend
+ addends << addend
+ end
+
+ def sum
+ @addends.inject(0) do |result, addend|
+ result + addend.to_i
+ end
+ end
+
+ def addends
+ @addends ||= []
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/README.txt b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/README.txt
new file mode 100644
index 000000000..9624ad411
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/README.txt
@@ -0,0 +1,21 @@
+John Conway's Game of Life
+
+The Rules
+---------
+The Game of Life was invented by John Conway (as you might have gathered).
+The game is played on a field of cells, each of which has eight neighbors (adjacent cells).
+A cell is either occupied (by an organism) or not.
+The rules for deriving a generation from the previous one are these:
+
+Survival
+--------
+If an occupied cell has 2 or 3 neighbors, the organism survives to the next generation.
+
+Death
+-----
+If an occupied cell has 0, 1, 4, 5, 6, 7, or 8 occupied neighbors, the organism dies
+(0, 1: of loneliness; 4 thru 8: of overcrowding).
+
+Birth
+-----
+If an unoccupied cell has 3 occupied neighbors, it becomes occupied.
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/everything.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/everything.rb
new file mode 100644
index 000000000..90a281da5
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/everything.rb
@@ -0,0 +1,6 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'lib')
+$:.unshift File.join(File.dirname(__FILE__), '..')
+
+require 'spec'
+require 'behaviour/examples/examples'
+require 'behaviour/stories/stories'
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/examples.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/examples.rb
new file mode 100644
index 000000000..1cadfb3c1
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/examples.rb
@@ -0,0 +1,3 @@
+require 'spec'
+require 'behaviour/examples/game_behaviour'
+require 'behaviour/examples/grid_behaviour'
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
new file mode 100644
index 000000000..ff5b357f0
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
@@ -0,0 +1,35 @@
+require 'life'
+
+describe Game do
+ it 'should have a grid' do
+ # given
+ game = Game.new(5, 5)
+
+ # then
+ game.grid.should be_kind_of(Grid)
+ end
+
+ it 'should create a cell' do
+ # given
+ game = Game.new(2, 2)
+ expected_grid = Grid.from_string( 'X. ..' )
+
+ # when
+ game.create_at(0, 0)
+
+ # then
+ game.grid.should == expected_grid
+ end
+
+ it 'should destroy a cell' do
+ # given
+ game = Game.new(2,2)
+ game.grid = Grid.from_string('X. ..')
+
+ # when
+ game.destroy_at(0,0)
+
+ # then
+ game.grid.should == Grid.from_string('.. ..')
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
new file mode 100644
index 000000000..5be3af519
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
@@ -0,0 +1,66 @@
+describe Grid do
+ it 'should be empty when created' do
+ # given
+ expected_contents = [
+ [0, 0, 0],
+ [0, 0, 0]
+ ]
+ grid = Grid.new(2, 3)
+
+ # when
+ contents = grid.contents
+
+ # then
+ contents.should == expected_contents
+ end
+
+ it 'should compare equal based on its contents' do
+ # given
+ grid1 = Grid.new(2, 3)
+ grid2 = Grid.new(2, 3)
+
+ # then
+ grid1.should == grid2
+ end
+
+ it 'should be able to replace its contents' do
+ # given
+ grid = Grid.new(2,2)
+ new_contents = [[0,1,0], [1,0,1]]
+
+ # when
+ grid.contents = new_contents
+
+ # then
+ grid.contents.should == new_contents
+ grid.rows.should == 2
+ grid.columns.should == 3
+ end
+
+ it 'should add an organism' do
+ # given
+ grid = Grid.new(2, 2)
+ expected = Grid.new(2, 2)
+ expected.contents = [[1,0],[0,0]]
+
+ # when
+ grid.create_at(0,0)
+
+ # then
+ grid.should == expected
+ end
+
+ it 'should create itself from a string' do
+ # given
+ expected = Grid.new 3, 3
+ expected.create_at(0,0)
+ expected.create_at(1,0)
+ expected.create_at(2,2)
+
+ # when
+ actual = Grid.from_string "X.. X.. ..X"
+
+ # then
+ actual.should == expected
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
new file mode 100644
index 000000000..8374e86c5
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
@@ -0,0 +1,21 @@
+Story: cells with less than two neighbours die
+
+As a game producer
+I want cells with less than two neighbours to die
+So that I can illustrate how the game works to people with money
+
+Scenario: cells with zero or one neighbour die
+
+Given the grid looks like
+........
+.XX.XX..
+.XX.....
+....X...
+........
+When the next step occurs
+Then the grid should look like
+........
+.XX.....
+.XX.....
+........
+........
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
new file mode 100644
index 000000000..0d30b59be
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
@@ -0,0 +1,21 @@
+Story: cells with more than three neighbours die
+
+As a game producer
+I want cells with more than three neighbours to die
+So that I can show the people with money how we are getting on
+
+Scenario: blink
+
+Given the grid looks like
+.....
+...XX
+...XX
+.XX..
+.XX..
+When the next step occurs
+Then the grid should look like
+.....
+...XX
+....X
+.X...
+.XX..
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
new file mode 100644
index 000000000..cbc248e73
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
@@ -0,0 +1,42 @@
+Story: Empty spaces with three neighbours create a cell
+
+As a game producer
+I want empty cells with three neighbours to die
+So that I have a minimum feature set to ship
+
+Scenario: the glider
+
+Given the grid looks like
+...X..
+..X...
+..XXX.
+......
+......
+When the next step occurs
+Then the grid should look like
+......
+..X.X.
+..XX..
+...X..
+......
+When the next step occurs
+Then the grid should look like
+......
+..X...
+..X.X.
+..XX..
+......
+When the next step occurs
+Then the grid should look like
+......
+...X..
+.XX...
+..XX..
+......
+When the next step occurs
+Then the grid should look like
+......
+..X...
+.X....
+.XXX..
+......
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
new file mode 100644
index 000000000..88895cb69
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
@@ -0,0 +1,42 @@
+Story: I can create a cell
+
+As a game producer
+I want to create a cell
+So that I can show the grid to people
+
+Scenario: nothing to see here
+
+Given a 3 x 3 game
+Then the grid should look like
+...
+...
+...
+
+Scenario: all on its lonesome
+
+Given a 3 x 3 game
+When I create a cell at 1, 1
+Then the grid should look like
+...
+.X.
+...
+
+Scenario: the grid has three cells
+
+Given a 3 x 3 game
+When I create a cell at 0, 0
+and I create a cell at 0, 1
+and I create a cell at 2, 2
+Then the grid should look like
+XX.
+...
+..X
+
+Scenario: more cells more more
+
+Given the grid has three cells
+When I create a celll at 3, 1
+Then the grid should look like
+XX.
+..X
+..X
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
new file mode 100644
index 000000000..a9cf1ac64
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
@@ -0,0 +1,17 @@
+Story: I can kill a cell
+
+As a game producer
+I want to kill a cell
+So that when I make a mistake I dont have to start again
+
+Scenario: bang youre dead
+
+Given the grid looks like
+XX.
+.X.
+..X
+When I destroy the cell at 0, 1
+Then the grid should look like
+X..
+.X.
+..X
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
new file mode 100644
index 000000000..aeeede77d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
@@ -0,0 +1,53 @@
+Story: The grid wraps
+
+As a game player
+I want the grid to wrap
+So that untidy stuff at the edges is avoided
+
+Scenario: crowded in the corners
+
+Given the grid looks like
+X.X
+...
+X.X
+When the next step is taken
+Then the grid should look like
+X.X
+...
+X.X
+
+
+Scenario: the glider returns
+
+Given the glider
+......
+..X...
+.X....
+.XXX..
+......
+When the next step is taken
+and the next step is taken
+and the next step is taken
+and the next step is taken
+Then the grid should look like
+......
+......
+.X....
+X.....
+XXX...
+When the next step is taken
+Then the grid should look like
+.X....
+......
+......
+X.X...
+XX....
+When the next step is taken
+Then the grid should look like
+XX....
+......
+......
+X.....
+X.X...
+
+
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
new file mode 100644
index 000000000..81f86baba
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
@@ -0,0 +1,52 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+
+Story "I can create a cell",
+ %(As a game producer
+ I want to create a cell
+ So that I can show the grid to people), :steps_for => :life do
+
+ Scenario "nothing to see here" do
+ Given "a game with dimensions", 3, 3 do |rows,cols|
+ @game = Game.new(rows,cols)
+ end
+
+ Then "the grid should look like", %(
+ ...
+ ...
+ ...
+ )
+ end
+
+ Scenario "all on its lonesome" do
+ Given "a game with dimensions", 2, 2
+ When "I create a cell at", 1, 1 do |row,col|
+ @game.create_at(row,col)
+ end
+ Then "the grid should look like", %(
+ ..
+ .X
+ )
+ end
+
+ Scenario "the grid has three cells" do
+ Given "a game with dimensions", 3, 3
+ When "I create a cell at", 0, 0
+ When "I create a cell at", 0, 1
+ When "I create a cell at", 2, 2
+ Then "the grid should look like", %(
+ XX.
+ ...
+ ..X
+ )
+ end
+
+ Scenario "more cells more more" do
+ GivenScenario "the grid has three cells"
+ When "I create a cell at", 2, 0
+ Then "the grid should look like", %(
+ XX.
+ ...
+ X.X
+ )
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/helper.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/helper.rb
new file mode 100644
index 000000000..70ed21ec5
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/helper.rb
@@ -0,0 +1,6 @@
+dir = File.dirname(__FILE__)
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../../../../../../rspec/lib"))
+require 'spec'
+$LOAD_PATH.unshift(File.expand_path("#{dir}/../../"))
+require "#{dir}/../../life"
+require File.join(File.dirname(__FILE__), *%w[steps])
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
new file mode 100644
index 000000000..7ae2d912d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
@@ -0,0 +1,26 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+
+Story 'I can kill a cell',
+ %(As a game producer
+ I want to kill a cell
+ So that when I make a mistake I don't have to start again), :steps_for => :life do
+
+ Scenario "bang, you're dead" do
+
+ Given 'a game that looks like', %(
+ XX.
+ .X.
+ ..X
+ ) do |dots|
+ @game = Game.from_string dots
+ end
+ When 'I destroy the cell at', 0, 1 do |row,col|
+ @game.destroy_at(row,col)
+ end
+ Then 'the grid should look like', %(
+ X..
+ .X.
+ ..X
+ )
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/steps.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/steps.rb
new file mode 100644
index 000000000..793590d70
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/steps.rb
@@ -0,0 +1,5 @@
+steps_for :life do
+ Then "the grid should look like" do |dots|
+ @game.grid.should == Grid.from_string(dots)
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/stories.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/stories.rb
new file mode 100644
index 000000000..e60fe01de
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/stories.rb
@@ -0,0 +1,3 @@
+require File.join(File.dirname(__FILE__), *%w[helper])
+require 'behaviour/stories/create_a_cell'
+require 'behaviour/stories/kill_a_cell'
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/stories.txt b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/stories.txt
new file mode 100644
index 000000000..d8f809be3
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/behaviour/stories/stories.txt
@@ -0,0 +1,22 @@
+Story: Show the game field
+ As a game player
+ I want to see the field
+ so that I can observe the progress of the organisms
+
+Scenario: an empty field
+ Given a new game starts
+ When the game displays the field
+ Then the field should be empty
+
+
+
+
+
+StoryBuilder story = stories.createStory().called("a story")
+ .asA("person")
+ .iWant("to do something")
+ .soThat("I can rule the world");
+story.addScenario().called("happy path").as()
+ .given("some context")
+ .when("some event happens")
+ .then("expect some outcome");
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life.rb
new file mode 100644
index 000000000..88263bd00
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life.rb
@@ -0,0 +1,3 @@
+$: << File.dirname(__FILE__)
+require 'life/game'
+require 'life/grid'
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb
new file mode 100644
index 000000000..5411b01bf
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/game.rb
@@ -0,0 +1,23 @@
+class Game
+ attr_accessor :grid
+ def initialize(rows,cols)
+ @grid = Grid.new(rows, cols)
+ end
+
+ def create_at(row,col)
+ @grid.create_at(row,col)
+ end
+
+ def destroy_at(row,col)
+ @grid.destroy_at(row, col)
+ end
+
+ def self.from_string(dots)
+ grid = Grid.from_string(dots)
+ game = new(grid.rows, grid.columns)
+ game.instance_eval do
+ @grid = grid
+ end
+ return game
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/grid.rb b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/grid.rb
new file mode 100644
index 000000000..aca23087c
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/game-of-life/life/grid.rb
@@ -0,0 +1,43 @@
+class Grid
+
+ attr_accessor :contents
+
+ def initialize(rows, cols)
+ @contents = []
+ rows.times do @contents << [0] * cols end
+ end
+
+ def rows
+ @contents.size
+ end
+
+ def columns
+ @contents[0].size
+ end
+
+ def ==(other)
+ self.contents == other.contents
+ end
+
+ def create_at(row,col)
+ @contents[row][col] = 1
+ end
+
+ def destroy_at(row,col)
+ @contents[row][col] = 0
+ end
+
+ def self.from_string(str)
+ row_strings = str.split(' ')
+ grid = new(row_strings.size, row_strings[0].size)
+
+ row_strings.each_with_index do |row, row_index|
+ row_chars = row.split(//)
+ row_chars.each_with_index do |col_char, col_index|
+ grid.create_at(row_index, col_index) if col_char == 'X'
+ end
+ end
+ return grid
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/helper.rb b/vendor/gems/rspec-1.1.2/examples/stories/helper.rb
new file mode 100644
index 000000000..2e825b278
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/helper.rb
@@ -0,0 +1,9 @@
+$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
+require 'spec/story'
+
+# won't have to do this once plain_text_story_runner is moved into the library
+# require File.join(File.dirname(__FILE__), "plain_text_story_runner")
+
+Dir[File.join(File.dirname(__FILE__), "steps/*.rb")].each do |file|
+ require file
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/examples/stories/steps/addition_steps.rb b/vendor/gems/rspec-1.1.2/examples/stories/steps/addition_steps.rb
new file mode 100644
index 000000000..3f27095a9
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/examples/stories/steps/addition_steps.rb
@@ -0,0 +1,18 @@
+require File.expand_path("#{File.dirname(__FILE__)}/../helper")
+
+# This creates steps for :addition
+steps_for(:addition) do
+ Given("an addend of $addend") do |addend|
+ @adder ||= Adder.new
+ @adder << addend.to_i
+ end
+end
+
+# This appends to them
+steps_for(:addition) do
+ When("the addends are added") { @sum = @adder.sum }
+end
+
+steps_for(:more_addition) do
+ Then("the sum should be $sum") { |sum| @sum.should == sum.to_i }
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/autotest/discover.rb b/vendor/gems/rspec-1.1.2/lib/autotest/discover.rb
new file mode 100644
index 000000000..81914c3b7
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/autotest/discover.rb
@@ -0,0 +1,3 @@
+Autotest.add_discovery do
+ "rspec" if File.exist?('spec')
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/autotest/rspec.rb b/vendor/gems/rspec-1.1.2/lib/autotest/rspec.rb
new file mode 100644
index 000000000..cf7421ee1
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/autotest/rspec.rb
@@ -0,0 +1,88 @@
+require 'autotest'
+
+Autotest.add_hook :initialize do |at|
+ at.clear_mappings
+ # watch out: Ruby bug (1.8.6):
+ # %r(/) != /\//
+ at.add_mapping(%r%^spec/.*\.rb$%) { |filename, _|
+ filename
+ }
+ at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
+ ["spec/#{m[1]}_spec.rb"]
+ }
+ at.add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
+ at.files_matching %r%^spec/.*_spec\.rb$%
+ }
+end
+
+class RspecCommandError < StandardError; end
+
+class Autotest::Rspec < Autotest
+
+ def tests_for_file(filename)
+ super.select { |f| @files.has_key? f }
+ end
+
+ alias :specs_for_file :tests_for_file
+
+ def failed_results(results)
+ results.scan(/^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m)
+ end
+
+ def handle_results(results)
+ @files_to_test = consolidate_failures failed_results(results)
+ unless @files_to_test.empty? then
+ hook :red
+ else
+ hook :green
+ end unless $TESTING
+ @tainted = true unless @files_to_test.empty?
+ end
+
+ def consolidate_failures(failed)
+ filters = Hash.new { |h,k| h[k] = [] }
+ failed.each do |spec, failed_trace|
+ @files.keys.select{|f| f =~ /spec\//}.each do |f|
+ if failed_trace =~ Regexp.new(f)
+ filters[f] << spec
+ break
+ end
+ end
+ end
+ return filters
+ end
+
+ def make_test_cmd(files_to_test)
+ return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}"
+ end
+
+ def add_options_if_present
+ File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : ""
+ end
+
+ # Finds the proper spec command to use. Precendence
+ # is set in the lazily-evaluated method spec_commands. Alias + Override
+ # that in ~/.autotest to provide a different spec command
+ # then the default paths provided.
+ def spec_command
+ @spec_command ||= spec_commands.each do |command|
+ if File.exists?(command)
+ return @alt_separator ? (command.gsub @separator, @alt_separator) : command
+ end
+ end
+ raise RspecCommandError, "No spec command could be found!"
+ end
+
+ # Autotest will look for spec commands in the following
+ # locations, in this order:
+ #
+ # * bin/spec
+ # * default spec bin/loader installed in Rubygems
+ def spec_commands
+ [
+ File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')),
+ File.join(Config::CONFIG['bindir'], 'spec')
+ ]
+ end
+
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec.rb b/vendor/gems/rspec-1.1.2/lib/spec.rb
new file mode 100644
index 000000000..a0fc64750
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec.rb
@@ -0,0 +1,37 @@
+require 'spec/version'
+require 'spec/matchers'
+require 'spec/expectations'
+require 'spec/example'
+require 'spec/extensions'
+require 'spec/runner'
+
+if Object.const_defined?(:Test); \
+ require 'spec/interop/test'; \
+end
+
+module Spec
+ class << self
+ def run?
+ @run || rspec_options.examples_run?
+ end
+
+ def run; \
+ return true if run?; \
+ result = rspec_options.run_examples; \
+ @run = true; \
+ result; \
+ end
+ attr_writer :run
+
+ def exit?; \
+ !Object.const_defined?(:Test) || Test::Unit.run?; \
+ end
+ end
+end
+
+at_exit do \
+ unless $! || Spec.run?; \
+ success = Spec.run; \
+ exit success if Spec.exit?; \
+ end \
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example.rb b/vendor/gems/rspec-1.1.2/lib/spec/example.rb
new file mode 100644
index 000000000..39ff76b99
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example.rb
@@ -0,0 +1,12 @@
+require 'timeout'
+require 'forwardable'
+require 'spec/example/pending'
+require 'spec/example/module_reopening_fix'
+require 'spec/example/example_group_methods'
+require 'spec/example/example_methods'
+require 'spec/example/example_group'
+require 'spec/example/shared_example_group'
+require 'spec/example/example_group_factory'
+require 'spec/example/errors'
+require 'spec/example/configuration'
+require 'spec/example/example_matcher'
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/configuration.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/configuration.rb
new file mode 100644
index 000000000..674184727
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/configuration.rb
@@ -0,0 +1,144 @@
+module Spec
+ module Example
+ class Configuration
+ # Chooses what mock framework to use. Example:
+ #
+ # Spec::Runner.configure do |config|
+ # config.mock_with :rspec, :mocha, :flexmock, or :rr
+ # end
+ #
+ # To use any other mock framework, you'll have to provide
+ # your own adapter. This is simply a module that responds to
+ # setup_mocks_for_rspec, verify_mocks_for_rspec and teardown_mocks_for_rspec.
+ # These are your hooks into the lifecycle of a given example. RSpec will
+ # call setup_mocks_for_rspec before running anything else in each Example.
+ # After executing the #after methods, RSpec will then call verify_mocks_for_rspec
+ # and teardown_mocks_for_rspec (this is guaranteed to run even if there are
+ # failures in verify_mocks_for_rspec).
+ #
+ # Once you've defined this module, you can pass that to mock_with:
+ #
+ # Spec::Runner.configure do |config|
+ # config.mock_with MyMockFrameworkAdapter
+ # end
+ #
+ def mock_with(mock_framework)
+ @mock_framework = case mock_framework
+ when Symbol
+ mock_framework_path(mock_framework.to_s)
+ else
+ mock_framework
+ end
+ end
+
+ def mock_framework # :nodoc:
+ @mock_framework ||= mock_framework_path("rspec")
+ end
+
+ # Declares modules to be included in all example groups (describe blocks).
+ #
+ # config.include(My::Bottle, My::Cup)
+ #
+ # If you want to restrict the inclusion to a subset of all the example groups then
+ # specify this in a Hash as the last argument:
+ #
+ # config.include(My::Pony, My::Horse, :type => :farm)
+ #
+ # Only example groups that have that type will get the modules included:
+ #
+ # describe "Downtown", :type => :city do
+ # # Will *not* get My::Pony and My::Horse included
+ # end
+ #
+ # describe "Old Mac Donald", :type => :farm do
+ # # *Will* get My::Pony and My::Horse included
+ # end
+ #
+ def include(*args)
+ args << {} unless Hash === args.last
+ modules, options = args_and_options(*args)
+ required_example_group = get_type_from_options(options)
+ required_example_group = required_example_group.to_sym if required_example_group
+ modules.each do |mod|
+ ExampleGroupFactory.get(required_example_group).send(:include, mod)
+ end
+ end
+
+ # Defines global predicate matchers. Example:
+ #
+ # config.predicate_matchers[:swim] = :can_swim?
+ #
+ # This makes it possible to say:
+ #
+ # person.should swim # passes if person.should_swim? returns true
+ #
+ def predicate_matchers
+ @predicate_matchers ||= {}
+ end
+
+ # Prepends a global before block to all example groups.
+ # See #append_before for filtering semantics.
+ def prepend_before(*args, &proc)
+ scope, options = scope_and_options(*args)
+ example_group = ExampleGroupFactory.get(
+ get_type_from_options(options)
+ )
+ example_group.prepend_before(scope, &proc)
+ end
+ # Appends a global before block to all example groups.
+ #
+ # If you want to restrict the block to a subset of all the example groups then
+ # specify this in a Hash as the last argument:
+ #
+ # config.prepend_before(:all, :type => :farm)
+ #
+ # or
+ #
+ # config.prepend_before(:type => :farm)
+ #
+ def append_before(*args, &proc)
+ scope, options = scope_and_options(*args)
+ example_group = ExampleGroupFactory.get(
+ get_type_from_options(options)
+ )
+ example_group.append_before(scope, &proc)
+ end
+ alias_method :before, :append_before
+
+ # Prepends a global after block to all example groups.
+ # See #append_before for filtering semantics.
+ def prepend_after(*args, &proc)
+ scope, options = scope_and_options(*args)
+ example_group = ExampleGroupFactory.get(
+ get_type_from_options(options)
+ )
+ example_group.prepend_after(scope, &proc)
+ end
+ alias_method :after, :prepend_after
+ # Appends a global after block to all example groups.
+ # See #append_before for filtering semantics.
+ def append_after(*args, &proc)
+ scope, options = scope_and_options(*args)
+ example_group = ExampleGroupFactory.get(
+ get_type_from_options(options)
+ )
+ example_group.append_after(scope, &proc)
+ end
+
+ private
+
+ def scope_and_options(*args)
+ args, options = args_and_options(*args)
+ scope = (args[0] || :each), options
+ end
+
+ def get_type_from_options(options)
+ options[:type] || options[:behaviour_type]
+ end
+
+ def mock_framework_path(framework_name)
+ File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "plugins", "mock_frameworks", framework_name))
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/errors.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/errors.rb
new file mode 100644
index 000000000..c6cb22453
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/errors.rb
@@ -0,0 +1,9 @@
+module Spec
+ module Example
+ class ExamplePendingError < StandardError
+ end
+
+ class PendingExampleFixedError < StandardError
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/example_group.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/example_group.rb
new file mode 100644
index 000000000..d6e156f93
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/example_group.rb
@@ -0,0 +1,16 @@
+module Spec
+ module Example
+ # The superclass for all regular RSpec examples.
+ class ExampleGroup
+ extend Spec::Example::ExampleGroupMethods
+ include Spec::Example::ExampleMethods
+
+ def initialize(defined_description, &implementation)
+ @_defined_description = defined_description
+ @_implementation = implementation
+ end
+ end
+ end
+end
+
+Spec::ExampleGroup = Spec::Example::ExampleGroup
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/example_group_factory.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/example_group_factory.rb
new file mode 100644
index 000000000..0414a3b96
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/example_group_factory.rb
@@ -0,0 +1,62 @@
+module Spec
+ module Example
+ class ExampleGroupFactory
+ class << self
+ def reset
+ @example_group_types = nil
+ default(ExampleGroup)
+ end
+
+ # Registers an example group class +klass+ with the symbol
+ # +type+. For example:
+ #
+ # Spec::Example::ExampleGroupFactory.register(:farm, Spec::Farm::Example::FarmExampleGroup)
+ #
+ # This will cause Main#describe from a file living in
+ # spec/farm to create example group instances of type
+ # Spec::Farm::Example::FarmExampleGroup.
+ def register(id, example_group_class)
+ @example_group_types[id] = example_group_class
+ end
+
+ # Sets the default ExampleGroup class
+ def default(example_group_class)
+ old = @example_group_types
+ @example_group_types = Hash.new(example_group_class)
+ @example_group_types.merge(old) if old
+ end
+
+ def get(id=nil)
+ if @example_group_types.values.include?(id)
+ id
+ else
+ @example_group_types[id]
+ end
+ end
+
+ def create_example_group(*args, &block)
+ opts = Hash === args.last ? args.last : {}
+ if opts[:shared]
+ SharedExampleGroup.new(*args, &block)
+ else
+ superclass = determine_superclass(opts)
+ superclass.describe(*args, &block)
+ end
+ end
+
+ protected
+
+ def determine_superclass(opts)
+ id = if opts[:type]
+ opts[:type]
+ elsif opts[:spec_path] =~ /spec(\\|\/)(#{@example_group_types.keys.join('|')})/
+ $2 == '' ? nil : $2.to_sym
+ end
+ get(id)
+ end
+
+ end
+ self.reset
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/example_group_methods.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/example_group_methods.rb
new file mode 100644
index 000000000..8f73a9853
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/example_group_methods.rb
@@ -0,0 +1,418 @@
+module Spec
+ module Example
+
+ module ExampleGroupMethods
+ class << self
+ def description_text(*args)
+ args.inject("") do |result, arg|
+ result << " " unless (result == "" || arg.to_s =~ /^(\s|\.|#)/)
+ result << arg.to_s
+ end
+ end
+ end
+
+ attr_reader :description_text, :description_args, :description_options, :spec_path
+
+ def inherited(klass)
+ super
+ klass.register
+ end
+
+ # Makes the describe/it syntax available from a class. For example:
+ #
+ # class StackSpec < Spec::ExampleGroup
+ # describe Stack, "with no elements"
+ #
+ # before
+ # @stack = Stack.new
+ # end
+ #
+ # it "should raise on pop" do
+ # lambda{ @stack.pop }.should raise_error
+ # end
+ # end
+ #
+ def describe(*args, &example_group_block)
+ if example_group_block
+ self.subclass("Subclass") do
+ describe(*args)
+ module_eval(&example_group_block)
+ end
+ else
+ set_description(*args)
+ before_eval
+ self
+ end
+ end
+
+ # Use this to pull in examples from shared example groups.
+ # See Spec::Runner for information about shared example groups.
+ def it_should_behave_like(shared_example_group)
+ case shared_example_group
+ when SharedExampleGroup
+ include shared_example_group
+ else
+ example_group = SharedExampleGroup.find_shared_example_group(shared_example_group)
+ unless example_group
+ raise RuntimeError.new("Shared Example Group '#{shared_example_group}' can not be found")
+ end
+ include(example_group)
+ end
+ end
+
+ # :call-seq:
+ # predicate_matchers[matcher_name] = method_on_object
+ # predicate_matchers[matcher_name] = [method1_on_object, method2_on_object]
+ #
+ # Dynamically generates a custom matcher that will match
+ # a predicate on your class. RSpec provides a couple of these
+ # out of the box:
+ #
+ # exist (or state expectations)
+ # File.should exist("path/to/file")
+ #
+ # an_instance_of (for mock argument constraints)
+ # mock.should_receive(:message).with(an_instance_of(String))
+ #
+ # == Examples
+ #
+ # class Fish
+ # def can_swim?
+ # true
+ # end
+ # end
+ #
+ # describe Fish do
+ # predicate_matchers[:swim] = :can_swim?
+ # it "should swim" do
+ # Fish.new.should swim
+ # end
+ # end
+ def predicate_matchers
+ @predicate_matchers ||= {:an_instance_of => :is_a?}
+ end
+
+ # Creates an instance of Spec::Example::Example and adds
+ # it to a collection of examples of the current example group.
+ def it(description=nil, &implementation)
+ e = new(description, &implementation)
+ example_objects << e
+ e
+ end
+
+ alias_method :specify, :it
+
+ # Use this to temporarily disable an example.
+ def xit(description=nil, opts={}, &block)
+ Kernel.warn("Example disabled: #{description}")
+ end
+
+ def run
+ examples = examples_to_run
+ return true if examples.empty?
+ reporter.add_example_group(self)
+ return dry_run(examples) if dry_run?
+
+ plugin_mock_framework
+ define_methods_from_predicate_matchers
+
+ success, before_all_instance_variables = run_before_all
+ success, after_all_instance_variables = execute_examples(success, before_all_instance_variables, examples)
+ success = run_after_all(success, after_all_instance_variables)
+ end
+
+ def description
+ result = ExampleGroupMethods.description_text(*description_parts)
+ if result.nil? || result == ""
+ return to_s
+ else
+ result
+ end
+ end
+
+ def described_type
+ description_parts.find {|part| part.is_a?(Module)}
+ end
+
+ def description_parts #:nodoc:
+ parts = []
+ execute_in_class_hierarchy do |example_group|
+ parts << example_group.description_args
+ end
+ parts.flatten.compact
+ end
+
+ def set_description(*args)
+ args, options = args_and_options(*args)
+ @description_args = args
+ @description_options = options
+ @description_text = ExampleGroupMethods.description_text(*args)
+ @spec_path = File.expand_path(options[:spec_path]) if options[:spec_path]
+ if described_type.class == Module
+ include described_type
+ end
+ self
+ end
+
+ def examples #:nodoc:
+ examples = example_objects.dup
+ add_method_examples(examples)
+ rspec_options.reverse ? examples.reverse : examples
+ end
+
+ def number_of_examples #:nodoc:
+ examples.length
+ end
+
+ # Registers a block to be executed before each example.
+ # This method prepends +block+ to existing before blocks.
+ def prepend_before(*args, &block)
+ scope, options = scope_and_options(*args)
+ parts = before_parts_from_scope(scope)
+ parts.unshift(block)
+ end
+
+ # Registers a block to be executed before each example.
+ # This method appends +block+ to existing before blocks.
+ def append_before(*args, &block)
+ scope, options = scope_and_options(*args)
+ parts = before_parts_from_scope(scope)
+ parts << block
+ end
+ alias_method :before, :append_before
+
+ # Registers a block to be executed after each example.
+ # This method prepends +block+ to existing after blocks.
+ def prepend_after(*args, &block)
+ scope, options = scope_and_options(*args)
+ parts = after_parts_from_scope(scope)
+ parts.unshift(block)
+ end
+ alias_method :after, :prepend_after
+
+ # Registers a block to be executed after each example.
+ # This method appends +block+ to existing after blocks.
+ def append_after(*args, &block)
+ scope, options = scope_and_options(*args)
+ parts = after_parts_from_scope(scope)
+ parts << block
+ end
+
+ def remove_after(scope, &block)
+ after_each_parts.delete(block)
+ end
+
+ # Deprecated. Use before(:each)
+ def setup(&block)
+ before(:each, &block)
+ end
+
+ # Deprecated. Use after(:each)
+ def teardown(&block)
+ after(:each, &block)
+ end
+
+ def before_all_parts # :nodoc:
+ @before_all_parts ||= []
+ end
+
+ def after_all_parts # :nodoc:
+ @after_all_parts ||= []
+ end
+
+ def before_each_parts # :nodoc:
+ @before_each_parts ||= []
+ end
+
+ def after_each_parts # :nodoc:
+ @after_each_parts ||= []
+ end
+
+ # Only used from RSpec's own examples
+ def reset # :nodoc:
+ @before_all_parts = nil
+ @after_all_parts = nil
+ @before_each_parts = nil
+ @after_each_parts = nil
+ end
+
+ def register
+ rspec_options.add_example_group self
+ end
+
+ def unregister #:nodoc:
+ rspec_options.remove_example_group self
+ end
+
+ def run_before_each(example)
+ execute_in_class_hierarchy do |example_group|
+ example.eval_each_fail_fast(example_group.before_each_parts)
+ end
+ end
+
+ def run_after_each(example)
+ execute_in_class_hierarchy(:superclass_first) do |example_group|
+ example.eval_each_fail_slow(example_group.after_each_parts)
+ end
+ end
+
+ private
+ def dry_run(examples)
+ examples.each do |example|
+ rspec_options.reporter.example_started(example)
+ rspec_options.reporter.example_finished(example)
+ end
+ return true
+ end
+
+ def run_before_all
+ before_all = new("before(:all)")
+ begin
+ execute_in_class_hierarchy do |example_group|
+ before_all.eval_each_fail_fast(example_group.before_all_parts)
+ end
+ return [true, before_all.instance_variable_hash]
+ rescue Exception => e
+ reporter.failure(before_all, e)
+ return [false, before_all.instance_variable_hash]
+ end
+ end
+
+ def execute_examples(success, instance_variables, examples)
+ return [success, instance_variables] unless success
+
+ after_all_instance_variables = instance_variables
+ examples.each do |example_group_instance|
+ success &= example_group_instance.execute(rspec_options, instance_variables)
+ after_all_instance_variables = example_group_instance.instance_variable_hash
+ end
+ return [success, after_all_instance_variables]
+ end
+
+ def run_after_all(success, instance_variables)
+ after_all = new("after(:all)")
+ after_all.set_instance_variables_from_hash(instance_variables)
+ execute_in_class_hierarchy(:superclass_first) do |example_group|
+ after_all.eval_each_fail_slow(example_group.after_all_parts)
+ end
+ return success
+ rescue Exception => e
+ reporter.failure(after_all, e)
+ return false
+ end
+
+ def examples_to_run
+ all_examples = examples
+ return all_examples unless specified_examples?
+ all_examples.reject do |example|
+ matcher = ExampleMatcher.new(description.to_s, example.description)
+ !matcher.matches?(specified_examples)
+ end
+ end
+
+ def specified_examples?
+ specified_examples && !specified_examples.empty?
+ end
+
+ def specified_examples
+ rspec_options.examples
+ end
+
+ def reporter
+ rspec_options.reporter
+ end
+
+ def dry_run?
+ rspec_options.dry_run
+ end
+
+ def example_objects
+ @example_objects ||= []
+ end
+
+ def execute_in_class_hierarchy(superclass_last=false)
+ classes = []
+ current_class = self
+ while is_example_group?(current_class)
+ superclass_last ? classes << current_class : classes.unshift(current_class)
+ current_class = current_class.superclass
+ end
+ superclass_last ? classes << ExampleMethods : classes.unshift(ExampleMethods)
+
+ classes.each do |example_group|
+ yield example_group
+ end
+ end
+
+ def is_example_group?(klass)
+ Module === klass && klass.kind_of?(ExampleGroupMethods)
+ end
+
+ def plugin_mock_framework
+ case mock_framework = Spec::Runner.configuration.mock_framework
+ when Module
+ include mock_framework
+ else
+ require Spec::Runner.configuration.mock_framework
+ include Spec::Plugins::MockFramework
+ end
+ end
+
+ def define_methods_from_predicate_matchers # :nodoc:
+ all_predicate_matchers = predicate_matchers.merge(
+ Spec::Runner.configuration.predicate_matchers
+ )
+ all_predicate_matchers.each_pair do |matcher_method, method_on_object|
+ define_method matcher_method do |*args|
+ eval("be_#{method_on_object.to_s.gsub('?','')}(*args)")
+ end
+ end
+ end
+
+ def scope_and_options(*args)
+ args, options = args_and_options(*args)
+ scope = (args[0] || :each), options
+ end
+
+ def before_parts_from_scope(scope)
+ case scope
+ when :each; before_each_parts
+ when :all; before_all_parts
+ end
+ end
+
+ def after_parts_from_scope(scope)
+ case scope
+ when :each; after_each_parts
+ when :all; after_all_parts
+ end
+ end
+
+ def before_eval
+ end
+
+ def add_method_examples(examples)
+ instance_methods.sort.each do |method_name|
+ if example_method?(method_name)
+ examples << new(method_name) do
+ __send__(method_name)
+ end
+ end
+ end
+ end
+
+ def example_method?(method_name)
+ should_method?(method_name)
+ end
+
+ def should_method?(method_name)
+ !(method_name =~ /^should(_not)?$/) &&
+ method_name =~ /^should/ && (
+ instance_method(method_name).arity == 0 ||
+ instance_method(method_name).arity == -1
+ )
+ end
+ end
+
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/example_matcher.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/example_matcher.rb
new file mode 100644
index 000000000..435eabf52
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/example_matcher.rb
@@ -0,0 +1,42 @@
+module Spec
+ module Example
+ class ExampleMatcher
+ def initialize(example_group_description, example_name)
+ @example_group_description = example_group_description
+ @example_name = example_name
+ end
+
+ def matches?(specified_examples)
+ specified_examples.each do |specified_example|
+ return true if matches_literal_example?(specified_example) || matches_example_not_considering_modules?(specified_example)
+ end
+ false
+ end
+
+ protected
+ def matches_literal_example?(specified_example)
+ specified_example =~ /(^#{example_group_regex} #{example_regexp}$|^#{example_group_regex}$|^#{example_group_with_before_all_regexp}$|^#{example_regexp}$)/
+ end
+
+ def matches_example_not_considering_modules?(specified_example)
+ specified_example =~ /(^#{example_group_regex_not_considering_modules} #{example_regexp}$|^#{example_group_regex_not_considering_modules}$|^#{example_regexp}$)/
+ end
+
+ def example_group_regex
+ Regexp.escape(@example_group_description)
+ end
+
+ def example_group_with_before_all_regexp
+ Regexp.escape("#{@example_group_description} before(:all)")
+ end
+
+ def example_group_regex_not_considering_modules
+ Regexp.escape(@example_group_description.split('::').last)
+ end
+
+ def example_regexp
+ Regexp.escape(@example_name)
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/example_methods.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/example_methods.rb
new file mode 100644
index 000000000..6dd4c9c72
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/example_methods.rb
@@ -0,0 +1,102 @@
+module Spec
+ module Example
+ module ExampleMethods
+ extend ExampleGroupMethods
+ extend ModuleReopeningFix
+
+ PENDING_EXAMPLE_BLOCK = lambda {
+ raise Spec::Example::ExamplePendingError.new("Not Yet Implemented")
+ }
+
+ def execute(options, instance_variables)
+ options.reporter.example_started(self)
+ set_instance_variables_from_hash(instance_variables)
+
+ execution_error = nil
+ Timeout.timeout(options.timeout) do
+ begin
+ before_example
+ run_with_description_capturing
+ rescue Exception => e
+ execution_error ||= e
+ end
+ begin
+ after_example
+ rescue Exception => e
+ execution_error ||= e
+ end
+ end
+
+ options.reporter.example_finished(self, execution_error)
+ success = execution_error.nil? || ExamplePendingError === execution_error
+ end
+
+ def instance_variable_hash
+ instance_variables.inject({}) do |variable_hash, variable_name|
+ variable_hash[variable_name] = instance_variable_get(variable_name)
+ variable_hash
+ end
+ end
+
+ def violated(message="")
+ raise Spec::Expectations::ExpectationNotMetError.new(message)
+ end
+
+ def eval_each_fail_fast(procs) #:nodoc:
+ procs.each do |proc|
+ instance_eval(&proc)
+ end
+ end
+
+ def eval_each_fail_slow(procs) #:nodoc:
+ first_exception = nil
+ procs.each do |proc|
+ begin
+ instance_eval(&proc)
+ rescue Exception => e
+ first_exception ||= e
+ end
+ end
+ raise first_exception if first_exception
+ end
+
+ def description
+ @_defined_description || @_matcher_description || "NO NAME"
+ end
+
+ def set_instance_variables_from_hash(ivars)
+ ivars.each do |variable_name, value|
+ # Ruby 1.9 requires variable.to_s on the next line
+ unless ['@_implementation', '@_defined_description', '@_matcher_description', '@method_name'].include?(variable_name.to_s)
+ instance_variable_set variable_name, value
+ end
+ end
+ end
+
+ def run_with_description_capturing
+ begin
+ return instance_eval(&(@_implementation || PENDING_EXAMPLE_BLOCK))
+ ensure
+ @_matcher_description = Spec::Matchers.generated_description
+ Spec::Matchers.clear_generated_description
+ end
+ end
+
+ protected
+ include Matchers
+ include Pending
+
+ def before_example
+ setup_mocks_for_rspec
+ self.class.run_before_each(self)
+ end
+
+ def after_example
+ self.class.run_after_each(self)
+ verify_mocks_for_rspec
+ ensure
+ teardown_mocks_for_rspec
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/module_reopening_fix.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/module_reopening_fix.rb
new file mode 100644
index 000000000..dc01dd666
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/module_reopening_fix.rb
@@ -0,0 +1,21 @@
+module Spec
+ module Example
+ # This is a fix for ...Something in Ruby 1.8.6??... (Someone fill in here please - Aslak)
+ module ModuleReopeningFix
+ def child_modules
+ @child_modules ||= []
+ end
+
+ def included(mod)
+ child_modules << mod
+ end
+
+ def include(mod)
+ super
+ child_modules.each do |child_module|
+ child_module.__send__(:include, mod)
+ end
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/pending.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/pending.rb
new file mode 100644
index 000000000..b1f27c866
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/pending.rb
@@ -0,0 +1,18 @@
+module Spec
+ module Example
+ module Pending
+ def pending(message = "TODO")
+ if block_given?
+ begin
+ yield
+ rescue Exception => e
+ raise Spec::Example::ExamplePendingError.new(message)
+ end
+ raise Spec::Example::PendingExampleFixedError.new("Expected pending '#{message}' to fail. No Error was raised.")
+ else
+ raise Spec::Example::ExamplePendingError.new(message)
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/example/shared_example_group.rb b/vendor/gems/rspec-1.1.2/lib/spec/example/shared_example_group.rb
new file mode 100644
index 000000000..a6fd6211c
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/example/shared_example_group.rb
@@ -0,0 +1,58 @@
+module Spec
+ module Example
+ class SharedExampleGroup < Module
+ class << self
+ def add_shared_example_group(new_example_group)
+ guard_against_redefining_existing_example_group(new_example_group)
+ shared_example_groups << new_example_group
+ end
+
+ def find_shared_example_group(example_group_description)
+ shared_example_groups.find do |b|
+ b.description == example_group_description
+ end
+ end
+
+ def shared_example_groups
+ # TODO - this needs to be global, or at least accessible from
+ # from subclasses of Example in a centralized place. I'm not loving
+ # this as a solution, but it works for now.
+ $shared_example_groups ||= []
+ end
+
+ private
+ def guard_against_redefining_existing_example_group(new_example_group)
+ existing_example_group = find_shared_example_group(new_example_group.description)
+ return unless existing_example_group
+ return if new_example_group.equal?(existing_example_group)
+ return if spec_path(new_example_group) == spec_path(existing_example_group)
+ raise ArgumentError.new("Shared Example '#{existing_example_group.description}' already exists")
+ end
+
+ def spec_path(example_group)
+ File.expand_path(example_group.spec_path)
+ end
+ end
+ include ExampleGroupMethods
+ public :include
+
+ def initialize(*args, &example_group_block)
+ describe(*args)
+ @example_group_block = example_group_block
+ self.class.add_shared_example_group(self)
+ end
+
+ def included(mod) # :nodoc:
+ mod.module_eval(&@example_group_block)
+ end
+
+ def execute_in_class_hierarchy(superclass_last=false)
+ classes = [self]
+ superclass_last ? classes << ExampleMethods : classes.unshift(ExampleMethods)
+ classes.each do |example_group|
+ yield example_group
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/expectations.rb b/vendor/gems/rspec-1.1.2/lib/spec/expectations.rb
new file mode 100644
index 000000000..65ea47425
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/expectations.rb
@@ -0,0 +1,56 @@
+require 'spec/matchers'
+require 'spec/expectations/errors'
+require 'spec/expectations/extensions'
+require 'spec/expectations/handler'
+
+module Spec
+
+ # Spec::Expectations lets you set expectations on your objects.
+ #
+ # result.should == 37
+ # team.should have(11).players_on_the_field
+ #
+ # == How Expectations work.
+ #
+ # Spec::Expectations adds two methods to Object:
+ #
+ # should(matcher=nil)
+ # should_not(matcher=nil)
+ #
+ # Both methods take an optional Expression Matcher (See Spec::Matchers).
+ #
+ # When +should+ receives an Expression Matcher, it calls matches?(self). If
+ # it returns +true+, the spec passes and execution continues. If it returns
+ # +false+, then the spec fails with the message returned by matcher.failure_message.
+ #
+ # Similarly, when +should_not+ receives a matcher, it calls matches?(self). If
+ # it returns +false+, the spec passes and execution continues. If it returns
+ # +true+, then the spec fails with the message returned by matcher.negative_failure_message.
+ #
+ # RSpec ships with a standard set of useful matchers, and writing your own
+ # matchers is quite simple. See Spec::Matchers for details.
+ module Expectations
+ class << self
+ attr_accessor :differ
+
+ # raises a Spec::Expectations::ExpectationNotMetError with message
+ #
+ # When a differ has been assigned and fail_with is passed
+ # expected
and target
, passes them
+ # to the differ to append a diff message to the failure message.
+ def fail_with(message, expected=nil, target=nil) # :nodoc:
+ if Array === message && message.length == 3
+ message, expected, target = message[0], message[1], message[2]
+ end
+ unless (differ.nil? || expected.nil? || target.nil?)
+ if expected.is_a?(String)
+ message << "\nDiff:" << self.differ.diff_as_string(target.to_s, expected)
+ elsif !target.is_a?(Proc)
+ message << "\nDiff:" << self.differ.diff_as_object(target, expected)
+ end
+ end
+ Kernel::raise(Spec::Expectations::ExpectationNotMetError.new(message))
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/expectations/differs/default.rb b/vendor/gems/rspec-1.1.2/lib/spec/expectations/differs/default.rb
new file mode 100644
index 000000000..a5eb1bb89
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/expectations/differs/default.rb
@@ -0,0 +1,66 @@
+begin
+ require 'rubygems'
+ require 'diff/lcs' #necessary due to loading bug on some machines - not sure why - DaC
+ require 'diff/lcs/hunk'
+rescue LoadError ; raise "You must gem install diff-lcs to use diffing" ; end
+
+require 'pp'
+
+module Spec
+ module Expectations
+ module Differs
+
+ # TODO add some rdoc
+ class Default
+ def initialize(options)
+ @options = options
+ end
+
+ # This is snagged from diff/lcs/ldiff.rb (which is a commandline tool)
+ def diff_as_string(data_old, data_new)
+ data_old = data_old.split(/\n/).map! { |e| e.chomp }
+ data_new = data_new.split(/\n/).map! { |e| e.chomp }
+ output = ""
+ diffs = Diff::LCS.diff(data_old, data_new)
+ return output if diffs.empty?
+ oldhunk = hunk = nil
+ file_length_difference = 0
+ diffs.each do |piece|
+ begin
+ hunk = Diff::LCS::Hunk.new(data_old, data_new, piece, context_lines,
+ file_length_difference)
+ file_length_difference = hunk.file_length_difference
+ next unless oldhunk
+ # Hunks may overlap, which is why we need to be careful when our
+ # diff includes lines of context. Otherwise, we might print
+ # redundant lines.
+ if (context_lines > 0) and hunk.overlaps?(oldhunk)
+ hunk.unshift(oldhunk)
+ else
+ output << oldhunk.diff(format)
+ end
+ ensure
+ oldhunk = hunk
+ output << "\n"
+ end
+ end
+ #Handle the last remaining hunk
+ output << oldhunk.diff(format) << "\n"
+ end
+
+ def diff_as_object(target,expected)
+ diff_as_string(PP.pp(target,""), PP.pp(expected,""))
+ end
+
+ protected
+ def format
+ @options.diff_format
+ end
+
+ def context_lines
+ @options.context_lines
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/expectations/errors.rb b/vendor/gems/rspec-1.1.2/lib/spec/expectations/errors.rb
new file mode 100644
index 000000000..1fabd105d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/expectations/errors.rb
@@ -0,0 +1,12 @@
+module Spec
+ module Expectations
+ # If Test::Unit is loaed, we'll use its error as baseclass, so that Test::Unit
+ # will report unmet RSpec expectations as failures rather than errors.
+ superclass = ['Test::Unit::AssertionFailedError', '::StandardError'].map do |c|
+ eval(c) rescue nil
+ end.compact.first
+
+ class ExpectationNotMetError < superclass
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions.rb b/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions.rb
new file mode 100644
index 000000000..60c9b9e7d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions.rb
@@ -0,0 +1,2 @@
+require 'spec/expectations/extensions/object'
+require 'spec/expectations/extensions/string_and_symbol'
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions/object.rb b/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions/object.rb
new file mode 100644
index 000000000..a3925bbee
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions/object.rb
@@ -0,0 +1,71 @@
+module Spec
+ module Expectations
+ # rspec adds #should and #should_not to every Object (and,
+ # implicitly, every Class).
+ module ObjectExpectations
+ # :call-seq:
+ # should(matcher)
+ # should == expected
+ # should === expected
+ # should =~ expected
+ #
+ # receiver.should(matcher)
+ # => Passes if matcher.matches?(receiver)
+ #
+ # receiver.should == expected #any value
+ # => Passes if (receiver == expected)
+ #
+ # receiver.should === expected #any value
+ # => Passes if (receiver === expected)
+ #
+ # receiver.should =~ regexp
+ # => Passes if (receiver =~ regexp)
+ #
+ # See Spec::Matchers for more information about matchers
+ #
+ # == Warning
+ #
+ # NOTE that this does NOT support receiver.should != expected.
+ # Instead, use receiver.should_not == expected
+ def should(matcher = :default_parameter, &block)
+ if :default_parameter == matcher
+ Spec::Matchers::PositiveOperatorMatcher.new(self)
+ else
+ ExpectationMatcherHandler.handle_matcher(self, matcher, &block)
+ end
+ end
+
+ # :call-seq:
+ # should_not(matcher)
+ # should_not == expected
+ # should_not === expected
+ # should_not =~ expected
+ #
+ # receiver.should_not(matcher)
+ # => Passes unless matcher.matches?(receiver)
+ #
+ # receiver.should_not == expected
+ # => Passes unless (receiver == expected)
+ #
+ # receiver.should_not === expected
+ # => Passes unless (receiver === expected)
+ #
+ # receiver.should_not =~ regexp
+ # => Passes unless (receiver =~ regexp)
+ #
+ # See Spec::Matchers for more information about matchers
+ def should_not(matcher = :default_parameter, &block)
+ if :default_parameter == matcher
+ Spec::Matchers::NegativeOperatorMatcher.new(self)
+ else
+ NegativeExpectationMatcherHandler.handle_matcher(self, matcher, &block)
+ end
+ end
+
+ end
+ end
+end
+
+class Object
+ include Spec::Expectations::ObjectExpectations
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions/string_and_symbol.rb b/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions/string_and_symbol.rb
new file mode 100644
index 000000000..29cfbddfa
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/expectations/extensions/string_and_symbol.rb
@@ -0,0 +1,17 @@
+module Spec
+ module Expectations
+ module StringHelpers
+ def starts_with?(prefix)
+ to_s[0..(prefix.to_s.length - 1)] == prefix.to_s
+ end
+ end
+ end
+end
+
+class String
+ include Spec::Expectations::StringHelpers
+end
+
+class Symbol
+ include Spec::Expectations::StringHelpers
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/expectations/handler.rb b/vendor/gems/rspec-1.1.2/lib/spec/expectations/handler.rb
new file mode 100644
index 000000000..e6dce0846
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/expectations/handler.rb
@@ -0,0 +1,52 @@
+module Spec
+ module Expectations
+ class InvalidMatcherError < ArgumentError; end
+
+ module MatcherHandlerHelper
+ def describe_matcher(matcher)
+ matcher.respond_to?(:description) ? matcher.description : "[#{matcher.class.name} does not provide a description]"
+ end
+ end
+
+ class ExpectationMatcherHandler
+ class << self
+ include MatcherHandlerHelper
+ def handle_matcher(actual, matcher, &block)
+ unless matcher.respond_to?(:matches?)
+ raise InvalidMatcherError, "Expected a matcher, got #{matcher.inspect}."
+ end
+
+ match = matcher.matches?(actual, &block)
+ ::Spec::Matchers.generated_description = "should #{describe_matcher(matcher)}"
+ Spec::Expectations.fail_with(matcher.failure_message) unless match
+ end
+ end
+ end
+
+ class NegativeExpectationMatcherHandler
+ class << self
+ include MatcherHandlerHelper
+ def handle_matcher(actual, matcher, &block)
+ unless matcher.respond_to?(:matches?)
+ raise InvalidMatcherError, "Expected a matcher, got #{matcher.inspect}."
+ end
+
+ unless matcher.respond_to?(:negative_failure_message)
+ Spec::Expectations.fail_with(
+<<-EOF
+Matcher does not support should_not.
+See Spec::Matchers for more information
+about matchers.
+EOF
+)
+ end
+ match = matcher.matches?(actual, &block)
+ ::Spec::Matchers.generated_description = "should not #{describe_matcher(matcher)}"
+ Spec::Expectations.fail_with(matcher.negative_failure_message) if match
+ end
+ end
+ end
+
+ end
+end
+
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/extensions.rb b/vendor/gems/rspec-1.1.2/lib/spec/extensions.rb
new file mode 100644
index 000000000..9a313d0e7
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/extensions.rb
@@ -0,0 +1,3 @@
+require 'spec/extensions/object'
+require 'spec/extensions/class'
+require 'spec/extensions/main'
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/extensions/class.rb b/vendor/gems/rspec-1.1.2/lib/spec/extensions/class.rb
new file mode 100644
index 000000000..30730f87e
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/extensions/class.rb
@@ -0,0 +1,24 @@
+class Class
+ # Creates a new subclass of self, with a name "under" our own name.
+ # Example:
+ #
+ # x = Foo::Bar.subclass('Zap'){}
+ # x.name # => Foo::Bar::Zap_1
+ # x.superclass.name # => Foo::Bar
+ def subclass(base_name, &body)
+ klass = Class.new(self)
+ class_name = "#{base_name}_#{class_count!}"
+ instance_eval do
+ const_set(class_name, klass)
+ end
+ klass.instance_eval(&body)
+ klass
+ end
+
+ private
+ def class_count!
+ @class_count ||= 0
+ @class_count += 1
+ @class_count
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/extensions/main.rb b/vendor/gems/rspec-1.1.2/lib/spec/extensions/main.rb
new file mode 100644
index 000000000..281cbf879
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/extensions/main.rb
@@ -0,0 +1,102 @@
+module Spec
+ module Extensions
+ module Main
+ # Creates and returns a class that includes the ExampleGroupMethods
+ # module. Which ExampleGroup type is created depends on the directory of the file
+ # calling this method. For example, Spec::Rails will use different
+ # classes for specs living in spec/models,
+ # spec/helpers, spec/views and
+ # spec/controllers.
+ #
+ # It is also possible to override autodiscovery of the example group
+ # type with an options Hash as the last argument:
+ #
+ # describe "name", :type => :something_special do ...
+ #
+ # The reason for using different behaviour classes is to have different
+ # matcher methods available from within the describe block.
+ #
+ # See Spec::Example::ExampleFactory#register for details about how to
+ # register special implementations.
+ #
+ def describe(*args, &block)
+ raise ArgumentError if args.empty?
+ raise ArgumentError unless block
+ args << {} unless Hash === args.last
+ args.last[:spec_path] = caller(0)[1]
+ Spec::Example::ExampleGroupFactory.create_example_group(*args, &block)
+ end
+ alias :context :describe
+
+ # Creates an example group that can be shared by other example groups
+ #
+ # == Examples
+ #
+ # share_examples_for "All Editions" do
+ # it "all editions behaviour" ...
+ # end
+ #
+ # describe SmallEdition do
+ # it_should_behave_like "All Editions"
+ #
+ # it "should do small edition stuff" do
+ # ...
+ # end
+ # end
+ def share_examples_for(name, &block)
+ describe(name, :shared => true, &block)
+ end
+
+ alias :shared_examples_for :share_examples_for
+
+ # Creates a Shared Example Group and assigns it to a constant
+ #
+ # share_as :AllEditions do
+ # it "should do all editions stuff" ...
+ # end
+ #
+ # describe SmallEdition do
+ # it_should_behave_like AllEditions
+ #
+ # it "should do small edition stuff" do
+ # ...
+ # end
+ # end
+ #
+ # And, for those of you who prefer to use something more like Ruby, you
+ # can just include the module directly
+ #
+ # describe SmallEdition do
+ # include AllEditions
+ #
+ # it "should do small edition stuff" do
+ # ...
+ # end
+ # end
+ def share_as(name, &block)
+ begin
+ Object.const_set(name, share_examples_for(name, &block))
+ rescue NameError => e
+ raise NameError.new(e.message + "\nThe first argument to share_as must be a legal name for a constant\n")
+ end
+ end
+
+ private
+
+ def rspec_options
+ $rspec_options ||= begin; \
+ parser = ::Spec::Runner::OptionParser.new(STDERR, STDOUT); \
+ parser.order!(ARGV); \
+ $rspec_options = parser.options; \
+ end
+ $rspec_options
+ end
+
+ def init_rspec_options(options)
+ $rspec_options = options if $rspec_options.nil?
+ end
+ end
+ end
+end
+
+include Spec::Extensions::Main
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/extensions/object.rb b/vendor/gems/rspec-1.1.2/lib/spec/extensions/object.rb
new file mode 100644
index 000000000..e9f6364e2
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/extensions/object.rb
@@ -0,0 +1,10 @@
+class Object
+ def args_and_options(*args)
+ options = Hash === args.last ? args.pop : {}
+ return args, options
+ end
+
+ def metaclass
+ class << self; self; end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/interop/test.rb b/vendor/gems/rspec-1.1.2/lib/spec/interop/test.rb
new file mode 100644
index 000000000..5c9543398
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/interop/test.rb
@@ -0,0 +1,10 @@
+require 'test/unit'
+require 'test/unit/testresult'
+
+require 'spec/interop/test/unit/testcase'
+require 'spec/interop/test/unit/testsuite_adapter'
+require 'spec/interop/test/unit/autorunner'
+require 'spec/interop/test/unit/testresult'
+require 'spec/interop/test/unit/ui/console/testrunner'
+
+Spec::Example::ExampleGroupFactory.default(Test::Unit::TestCase)
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/autorunner.rb b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/autorunner.rb
new file mode 100644
index 000000000..3944e6995
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/autorunner.rb
@@ -0,0 +1,6 @@
+class Test::Unit::AutoRunner
+ remove_method :process_args
+ def process_args(argv)
+ true
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testcase.rb b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testcase.rb
new file mode 100644
index 000000000..b32a820c1
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testcase.rb
@@ -0,0 +1,61 @@
+require 'test/unit/testcase'
+
+module Test
+ module Unit
+ # This extension of the standard Test::Unit::TestCase makes RSpec
+ # available from within, so that you can do things like:
+ #
+ # require 'test/unit'
+ # require 'spec'
+ #
+ # class MyTest < Test::Unit::TestCase
+ # it "should work with Test::Unit assertions" do
+ # assert_equal 4, 2+1
+ # end
+ #
+ # def test_should_work_with_rspec_expectations
+ # (3+1).should == 5
+ # end
+ # end
+ #
+ # See also Spec::Example::ExampleGroup
+ class TestCase
+ extend Spec::Example::ExampleGroupMethods
+ include Spec::Example::ExampleMethods
+
+ before(:each) {setup}
+ after(:each) {teardown}
+
+ class << self
+ def suite
+ Test::Unit::TestSuiteAdapter.new(self)
+ end
+
+ def example_method?(method_name)
+ should_method?(method_name) || test_method?(method_name)
+ end
+
+ def test_method?(method_name)
+ method_name =~ /^test[_A-Z]./ && (
+ instance_method(method_name).arity == 0 ||
+ instance_method(method_name).arity == -1
+ )
+ end
+ end
+
+ def initialize(defined_description, &implementation)
+ @_defined_description = defined_description
+ @_implementation = implementation
+
+ @_result = ::Test::Unit::TestResult.new
+ # @method_name is important to set here because it "complies" with Test::Unit's interface.
+ # Some Test::Unit extensions depend on @method_name being present.
+ @method_name = @_defined_description
+ end
+
+ def run(ignore_this_argument=nil)
+ super()
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testresult.rb b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testresult.rb
new file mode 100644
index 000000000..1386dc728
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testresult.rb
@@ -0,0 +1,6 @@
+class Test::Unit::TestResult
+ alias_method :tu_passed?, :passed?
+ def passed?
+ return tu_passed? & ::Spec.run
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testsuite_adapter.rb b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testsuite_adapter.rb
new file mode 100644
index 000000000..7c0ed092d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/testsuite_adapter.rb
@@ -0,0 +1,34 @@
+module Test
+ module Unit
+ class TestSuiteAdapter < TestSuite
+ attr_reader :example_group, :examples
+ alias_method :tests, :examples
+ def initialize(example_group)
+ @example_group = example_group
+ @examples = example_group.examples
+ end
+
+ def name
+ example_group.description
+ end
+
+ def run(*args)
+ return true unless args.empty?
+ example_group.run
+ end
+
+ def size
+ example_group.number_of_examples
+ end
+
+ def delete(example)
+ examples.delete example
+ end
+
+ def empty?
+ examples.empty?
+ end
+ end
+ end
+end
+
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/ui/console/testrunner.rb b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/ui/console/testrunner.rb
new file mode 100644
index 000000000..663dd4722
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/interop/test/unit/ui/console/testrunner.rb
@@ -0,0 +1,60 @@
+require 'test/unit/ui/console/testrunner'
+
+module Test
+ module Unit
+ module UI
+ module Console
+ class TestRunner
+
+ alias_method :started_without_rspec, :started
+ def started_with_rspec(result)
+ @result = result
+ @need_to_output_started = true
+ end
+ alias_method :started, :started_with_rspec
+
+ alias_method :test_started_without_rspec, :test_started
+ def test_started_with_rspec(name)
+ if @need_to_output_started
+ if @rspec_io
+ @rspec_io.rewind
+ output(@rspec_io.read)
+ end
+ output("Started")
+ @need_to_output_started = false
+ end
+ test_started_without_rspec(name)
+ end
+ alias_method :test_started, :test_started_with_rspec
+
+ alias_method :test_finished_without_rspec, :test_finished
+ def test_finished_with_rspec(name)
+ test_finished_without_rspec(name)
+ @ran_test = true
+ end
+ alias_method :test_finished, :test_finished_with_rspec
+
+ alias_method :finished_without_rspec, :finished
+ def finished_with_rspec(elapsed_time)
+ if @ran_test
+ finished_without_rspec(elapsed_time)
+ end
+ end
+ alias_method :finished, :finished_with_rspec
+
+ alias_method :setup_mediator_without_rspec, :setup_mediator
+ def setup_mediator_with_rspec
+ orig_io = @io
+ @io = StringIO.new
+ setup_mediator_without_rspec
+ ensure
+ @rspec_io = @io
+ @io = orig_io
+ end
+ alias_method :setup_mediator, :setup_mediator_with_rspec
+
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers.rb
new file mode 100644
index 000000000..afae5ae5f
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers.rb
@@ -0,0 +1,156 @@
+require 'spec/matchers/simple_matcher'
+require 'spec/matchers/be'
+require 'spec/matchers/be_close'
+require 'spec/matchers/change'
+require 'spec/matchers/eql'
+require 'spec/matchers/equal'
+require 'spec/matchers/exist'
+require 'spec/matchers/has'
+require 'spec/matchers/have'
+require 'spec/matchers/include'
+require 'spec/matchers/match'
+require 'spec/matchers/raise_error'
+require 'spec/matchers/respond_to'
+require 'spec/matchers/satisfy'
+require 'spec/matchers/throw_symbol'
+require 'spec/matchers/operator_matcher'
+
+module Spec
+
+ # RSpec ships with a number of useful Expression Matchers. An Expression Matcher
+ # is any object that responds to the following methods:
+ #
+ # matches?(actual)
+ # failure_message
+ # negative_failure_message #optional
+ # description #optional
+ #
+ # See Spec::Expectations to learn how to use these as Expectation Matchers.
+ # See Spec::Mocks to learn how to use them as Mock Argument Constraints.
+ #
+ # == Predicates
+ #
+ # In addition to those Expression Matchers that are defined explicitly, RSpec will
+ # create custom Matchers on the fly for any arbitrary predicate, giving your specs
+ # a much more natural language feel.
+ #
+ # A Ruby predicate is a method that ends with a "?" and returns true or false.
+ # Common examples are +empty?+, +nil?+, and +instance_of?+.
+ #
+ # All you need to do is write +should be_+ followed by the predicate without
+ # the question mark, and RSpec will figure it out from there. For example:
+ #
+ # [].should be_empty => [].empty? #passes
+ # [].should_not be_empty => [].empty? #fails
+ #
+ # In addtion to prefixing the predicate matchers with "be_", you can also use "be_a_"
+ # and "be_an_", making your specs read much more naturally:
+ #
+ # "a string".should be_an_instance_of(String) =>"a string".instance_of?(String) #passes
+ #
+ # 3.should be_a_kind_of(Fixnum) => 3.kind_of?(Numeric) #passes
+ # 3.should be_a_kind_of(Numeric) => 3.kind_of?(Numeric) #passes
+ # 3.should be_an_instance_of(Fixnum) => 3.instance_of?(Fixnum) #passes
+ # 3.should_not be_instance_of(Numeric) => 3.instance_of?(Numeric) #fails
+ #
+ # RSpec will also create custom matchers for predicates like +has_key?+. To
+ # use this feature, just state that the object should have_key(:key) and RSpec will
+ # call has_key?(:key) on the target. For example:
+ #
+ # {:a => "A"}.should have_key(:a) => {:a => "A"}.has_key?(:a) #passes
+ # {:a => "A"}.should have_key(:b) => {:a => "A"}.has_key?(:b) #fails
+ #
+ # You can use this feature to invoke any predicate that begins with "has_", whether it is
+ # part of the Ruby libraries (like +Hash#has_key?+) or a method you wrote on your own class.
+ #
+ # == Custom Expectation Matchers
+ #
+ # When you find that none of the stock Expectation Matchers provide a natural
+ # feeling expectation, you can very easily write your own.
+ #
+ # For example, imagine that you are writing a game in which players can
+ # be in various zones on a virtual board. To specify that bob should
+ # be in zone 4, you could say:
+ #
+ # bob.current_zone.should eql(Zone.new("4"))
+ #
+ # But you might find it more expressive to say:
+ #
+ # bob.should be_in_zone("4")
+ #
+ # and/or
+ #
+ # bob.should_not be_in_zone("3")
+ #
+ # To do this, you would need to write a class like this:
+ #
+ # class BeInZone
+ # def initialize(expected)
+ # @expected = expected
+ # end
+ # def matches?(target)
+ # @target = target
+ # @target.current_zone.eql?(Zone.new(@expected))
+ # end
+ # def failure_message
+ # "expected #{@target.inspect} to be in Zone #{@expected}"
+ # end
+ # def negative_failure_message
+ # "expected #{@target.inspect} not to be in Zone #{@expected}"
+ # end
+ # end
+ #
+ # ... and a method like this:
+ #
+ # def be_in_zone(expected)
+ # BeInZone.new(expected)
+ # end
+ #
+ # And then expose the method to your specs. This is normally done
+ # by including the method and the class in a module, which is then
+ # included in your spec:
+ #
+ # module CustomGameMatchers
+ # class BeInZone
+ # ...
+ # end
+ #
+ # def be_in_zone(expected)
+ # ...
+ # end
+ # end
+ #
+ # describe "Player behaviour" do
+ # include CustomGameMatchers
+ # ...
+ # end
+ #
+ # or you can include in globally in a spec_helper.rb file required
+ # from your spec file(s):
+ #
+ # Spec::Runner.configure do |config|
+ # config.include(CustomGameMatchers)
+ # end
+ #
+ module Matchers
+ module ModuleMethods
+ attr_accessor :generated_description
+
+ def clear_generated_description
+ self.generated_description = nil
+ end
+ end
+
+ extend ModuleMethods
+
+ def method_missing(sym, *args, &block) # :nodoc:
+ return Matchers::Be.new(sym, *args) if sym.starts_with?("be_")
+ return Matchers::Has.new(sym, *args) if sym.starts_with?("have_")
+ super
+ end
+
+ class MatcherError < StandardError
+ end
+
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/be.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/be.rb
new file mode 100644
index 000000000..2b25b11f4
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/be.rb
@@ -0,0 +1,224 @@
+module Spec
+ module Matchers
+
+ class Be #:nodoc:
+ def initialize(*args)
+ if args.empty?
+ @expected = :satisfy_if
+ else
+ @expected = parse_expected(args.shift)
+ end
+ @args = args
+ @comparison = ""
+ end
+
+ def matches?(actual)
+ @actual = actual
+ if handling_predicate?
+ begin
+ return @result = actual.__send__(predicate, *@args)
+ rescue => predicate_error
+ # This clause should be empty, but rcov will not report it as covered
+ # unless something (anything) is executed within the clause
+ rcov_error_report = "http://eigenclass.org/hiki.rb?rcov-0.8.0"
+ end
+
+ # This supports should_exist > target.exists? in the old world.
+ # We should consider deprecating that ability as in the new world
+ # you can't write "should exist" unless you have your own custom matcher.
+ begin
+ return @result = actual.__send__(present_tense_predicate, *@args)
+ rescue
+ raise predicate_error
+ end
+ else
+ return match_or_compare
+ end
+ end
+
+ def failure_message
+ return "expected #{@comparison}#{expected}, got #{@actual.inspect}" unless handling_predicate?
+ return "expected #{predicate}#{args_to_s} to return true, got #{@result.inspect}"
+ end
+
+ def negative_failure_message
+ return "expected not #{expected}, got #{@actual.inspect}" unless handling_predicate?
+ return "expected #{predicate}#{args_to_s} to return false, got #{@result.inspect}"
+ end
+
+ def expected
+ return "if to be satisfied" if @expected == :satisfy_if
+ return true if @expected == :true
+ return false if @expected == :false
+ return "nil" if @expected == :nil
+ return @expected.inspect
+ end
+
+ def match_or_compare
+ return @actual ? true : false if @expected == :satisfy_if
+ return @actual == true if @expected == :true
+ return @actual == false if @expected == :false
+ return @actual.nil? if @expected == :nil
+ return @actual < @expected if @less_than
+ return @actual <= @expected if @less_than_or_equal
+ return @actual >= @expected if @greater_than_or_equal
+ return @actual > @expected if @greater_than
+ return @actual == @expected if @double_equal
+ return @actual === @expected if @triple_equal
+ return @actual.equal?(@expected)
+ end
+
+ def ==(expected)
+ @prefix = "be "
+ @double_equal = true
+ @comparison = "== "
+ @expected = expected
+ self
+ end
+
+ def ===(expected)
+ @prefix = "be "
+ @triple_equal = true
+ @comparison = "=== "
+ @expected = expected
+ self
+ end
+
+ def <(expected)
+ @prefix = "be "
+ @less_than = true
+ @comparison = "< "
+ @expected = expected
+ self
+ end
+
+ def <=(expected)
+ @prefix = "be "
+ @less_than_or_equal = true
+ @comparison = "<= "
+ @expected = expected
+ self
+ end
+
+ def >=(expected)
+ @prefix = "be "
+ @greater_than_or_equal = true
+ @comparison = ">= "
+ @expected = expected
+ self
+ end
+
+ def >(expected)
+ @prefix = "be "
+ @greater_than = true
+ @comparison = "> "
+ @expected = expected
+ self
+ end
+
+ def description
+ "#{prefix_to_sentence}#{comparison}#{expected_to_sentence}#{args_to_sentence}"
+ end
+
+ private
+ def parse_expected(expected)
+ if Symbol === expected
+ @handling_predicate = true
+ ["be_an_","be_a_","be_"].each do |prefix|
+ if expected.starts_with?(prefix)
+ @prefix = prefix
+ return "#{expected.to_s.sub(@prefix,"")}".to_sym
+ end
+ end
+ end
+ @prefix = ""
+ return expected
+ end
+
+ def handling_predicate?
+ return false if [:true, :false, :nil].include?(@expected)
+ return @handling_predicate
+ end
+
+ def predicate
+ "#{@expected.to_s}?".to_sym
+ end
+
+ def present_tense_predicate
+ "#{@expected.to_s}s?".to_sym
+ end
+
+ def args_to_s
+ return "" if @args.empty?
+ inspected_args = @args.collect{|a| a.inspect}
+ return "(#{inspected_args.join(', ')})"
+ end
+
+ def comparison
+ @comparison
+ end
+
+ def expected_to_sentence
+ split_words(@expected)
+ end
+
+ def prefix_to_sentence
+ split_words(@prefix)
+ end
+
+ def split_words(sym)
+ sym.to_s.gsub(/_/,' ')
+ end
+
+ def args_to_sentence
+ case @args.length
+ when 0
+ ""
+ when 1
+ " #{@args[0]}"
+ else
+ " #{@args[0...-1].join(', ')} and #{@args[-1]}"
+ end
+ end
+
+ end
+
+ # :call-seq:
+ # should be
+ # should be_true
+ # should be_false
+ # should be_nil
+ # should be_arbitrary_predicate(*args)
+ # should_not be_nil
+ # should_not be_arbitrary_predicate(*args)
+ #
+ # Given true, false, or nil, will pass if actual is
+ # true, false or nil (respectively). Given no args means
+ # the caller should satisfy an if condition (to be or not to be).
+ #
+ # Predicates are any Ruby method that ends in a "?" and returns true or false.
+ # Given be_ followed by arbitrary_predicate (without the "?"), RSpec will match
+ # convert that into a query against the target object.
+ #
+ # The arbitrary_predicate feature will handle any predicate
+ # prefixed with "be_an_" (e.g. be_an_instance_of), "be_a_" (e.g. be_a_kind_of)
+ # or "be_" (e.g. be_empty), letting you choose the prefix that best suits the predicate.
+ #
+ # == Examples
+ #
+ # target.should be
+ # target.should be_true
+ # target.should be_false
+ # target.should be_nil
+ # target.should_not be_nil
+ #
+ # collection.should be_empty #passes if target.empty?
+ # "this string".should be_an_intance_of(String)
+ #
+ # target.should_not be_empty #passes unless target.empty?
+ # target.should_not be_old_enough(16) #passes unless target.old_enough?(16)
+ def be(*args)
+ Matchers::Be.new(*args)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/be_close.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/be_close.rb
new file mode 100644
index 000000000..7763eb97e
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/be_close.rb
@@ -0,0 +1,37 @@
+module Spec
+ module Matchers
+
+ class BeClose #:nodoc:
+ def initialize(expected, delta)
+ @expected = expected
+ @delta = delta
+ end
+
+ def matches?(actual)
+ @actual = actual
+ (@actual - @expected).abs < @delta
+ end
+
+ def failure_message
+ "expected #{@expected} +/- (< #{@delta}), got #{@actual}"
+ end
+
+ def description
+ "be close to #{@expected} (within +- #{@delta})"
+ end
+ end
+
+ # :call-seq:
+ # should be_close(expected, delta)
+ # should_not be_close(expected, delta)
+ #
+ # Passes if actual == expected +/- delta
+ #
+ # == Example
+ #
+ # result.should be_close(3.0, 0.5)
+ def be_close(expected, delta)
+ Matchers::BeClose.new(expected, delta)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/change.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/change.rb
new file mode 100644
index 000000000..784e516ed
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/change.rb
@@ -0,0 +1,144 @@
+module Spec
+ module Matchers
+
+ #Based on patch from Wilson Bilkovich
+ class Change #:nodoc:
+ def initialize(receiver=nil, message=nil, &block)
+ @receiver = receiver
+ @message = message
+ @block = block
+ end
+
+ def matches?(target, &block)
+ if block
+ raise MatcherError.new(<<-EOF
+block passed to should or should_not change must use {} instead of do/end
+EOF
+)
+ end
+ @target = target
+ execute_change
+ return false if @from && (@from != @before)
+ return false if @to && (@to != @after)
+ return (@before + @amount == @after) if @amount
+ return ((@after - @before) >= @minimum) if @minimum
+ return ((@after - @before) <= @maximum) if @maximum
+ return @before != @after
+ end
+
+ def execute_change
+ @before = @block.nil? ? @receiver.send(@message) : @block.call
+ @target.call
+ @after = @block.nil? ? @receiver.send(@message) : @block.call
+ end
+
+ def failure_message
+ if @to
+ "#{result} should have been changed to #{@to.inspect}, but is now #{@after.inspect}"
+ elsif @from
+ "#{result} should have initially been #{@from.inspect}, but was #{@before.inspect}"
+ elsif @amount
+ "#{result} should have been changed by #{@amount.inspect}, but was changed by #{actual_delta.inspect}"
+ elsif @minimum
+ "#{result} should have been changed by at least #{@minimum.inspect}, but was changed by #{actual_delta.inspect}"
+ elsif @maximum
+ "#{result} should have been changed by at most #{@maximum.inspect}, but was changed by #{actual_delta.inspect}"
+ else
+ "#{result} should have changed, but is still #{@before.inspect}"
+ end
+ end
+
+ def result
+ @message || "result"
+ end
+
+ def actual_delta
+ @after - @before
+ end
+
+ def negative_failure_message
+ "#{result} should not have changed, but did change from #{@before.inspect} to #{@after.inspect}"
+ end
+
+ def by(amount)
+ @amount = amount
+ self
+ end
+
+ def by_at_least(minimum)
+ @minimum = minimum
+ self
+ end
+
+ def by_at_most(maximum)
+ @maximum = maximum
+ self
+ end
+
+ def to(to)
+ @to = to
+ self
+ end
+
+ def from (from)
+ @from = from
+ self
+ end
+ end
+
+ # :call-seq:
+ # should change(receiver, message, &block)
+ # should change(receiver, message, &block).by(value)
+ # should change(receiver, message, &block).from(old).to(new)
+ # should_not change(receiver, message, &block)
+ #
+ # Allows you to specify that a Proc will cause some value to change.
+ #
+ # == Examples
+ #
+ # lambda {
+ # team.add_player(player)
+ # }.should change(roster, :count)
+ #
+ # lambda {
+ # team.add_player(player)
+ # }.should change(roster, :count).by(1)
+ #
+ # lambda {
+ # team.add_player(player)
+ # }.should change(roster, :count).by_at_least(1)
+ #
+ # lambda {
+ # team.add_player(player)
+ # }.should change(roster, :count).by_at_most(1)
+ #
+ # string = "string"
+ # lambda {
+ # string.reverse
+ # }.should change { string }.from("string").to("gnirts")
+ #
+ # lambda {
+ # person.happy_birthday
+ # }.should change(person, :birthday).from(32).to(33)
+ #
+ # lambda {
+ # employee.develop_great_new_social_networking_app
+ # }.should change(employee, :title).from("Mail Clerk").to("CEO")
+ #
+ # Evaluates +receiver.message+ or +block+ before and
+ # after it evaluates the c object (generated by the lambdas in the examples above).
+ #
+ # Then compares the values before and after the +receiver.message+ and
+ # evaluates the difference compared to the expected difference.
+ #
+ # == Warning
+ # +should_not+ +change+ only supports the form with no subsequent calls to
+ # +by+, +by_at_least+, +by_at_most+, +to+ or +from+.
+ #
+ # blocks passed to +should+ +change+ and +should_not+ +change+
+ # must use the {} form (do/end is not supported)
+ def change(target=nil, message=nil, &block)
+ Matchers::Change.new(target, message, &block)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb
new file mode 100644
index 000000000..280ca5454
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb
@@ -0,0 +1,43 @@
+module Spec
+ module Matchers
+
+ class Eql #:nodoc:
+ def initialize(expected)
+ @expected = expected
+ end
+
+ def matches?(actual)
+ @actual = actual
+ @actual.eql?(@expected)
+ end
+
+ def failure_message
+ return "expected #{@expected.inspect}, got #{@actual.inspect} (using .eql?)", @expected, @actual
+ end
+
+ def negative_failure_message
+ return "expected #{@actual.inspect} not to equal #{@expected.inspect} (using .eql?)", @expected, @actual
+ end
+
+ def description
+ "eql #{@expected.inspect}"
+ end
+ end
+
+ # :call-seq:
+ # should eql(expected)
+ # should_not eql(expected)
+ #
+ # Passes if actual and expected are of equal value, but not necessarily the same object.
+ #
+ # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby.
+ #
+ # == Examples
+ #
+ # 5.should eql(5)
+ # 5.should_not eql(3)
+ def eql(expected)
+ Matchers::Eql.new(expected)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/equal.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/equal.rb
new file mode 100644
index 000000000..4bfc74951
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/equal.rb
@@ -0,0 +1,43 @@
+module Spec
+ module Matchers
+
+ class Equal #:nodoc:
+ def initialize(expected)
+ @expected = expected
+ end
+
+ def matches?(actual)
+ @actual = actual
+ @actual.equal?(@expected)
+ end
+
+ def failure_message
+ return "expected #{@expected.inspect}, got #{@actual.inspect} (using .equal?)", @expected, @actual
+ end
+
+ def negative_failure_message
+ return "expected #{@actual.inspect} not to equal #{@expected.inspect} (using .equal?)", @expected, @actual
+ end
+
+ def description
+ "equal #{@expected.inspect}"
+ end
+ end
+
+ # :call-seq:
+ # should equal(expected)
+ # should_not equal(expected)
+ #
+ # Passes if actual and expected are the same object (object identity).
+ #
+ # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby.
+ #
+ # == Examples
+ #
+ # 5.should equal(5) #Fixnums are equal
+ # "5".should_not equal("5") #Strings that look the same are not the same object
+ def equal(expected)
+ Matchers::Equal.new(expected)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/exist.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/exist.rb
new file mode 100644
index 000000000..a5a911132
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/exist.rb
@@ -0,0 +1,17 @@
+module Spec
+ module Matchers
+ class Exist
+ def matches? actual
+ @actual = actual
+ @actual.exist?
+ end
+ def failure_message
+ "expected #{@actual.inspect} to exist, but it doesn't."
+ end
+ def negative_failure_message
+ "expected #{@actual.inspect} to not exist, but it does."
+ end
+ end
+ def exist; Exist.new; end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/has.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/has.rb
new file mode 100644
index 000000000..cc5a250b8
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/has.rb
@@ -0,0 +1,44 @@
+module Spec
+ module Matchers
+
+ class Has #:nodoc:
+ def initialize(sym, *args)
+ @sym = sym
+ @args = args
+ end
+
+ def matches?(target)
+ @target = target
+ begin
+ return target.send(predicate, *@args)
+ rescue => @error
+ # This clause should be empty, but rcov will not report it as covered
+ # unless something (anything) is executed within the clause
+ rcov_error_report = "http://eigenclass.org/hiki.rb?rcov-0.8.0"
+ end
+ return false
+ end
+
+ def failure_message
+ raise @error if @error
+ "expected ##{predicate}(#{@args[0].inspect}) to return true, got false"
+ end
+
+ def negative_failure_message
+ raise @error if @error
+ "expected ##{predicate}(#{@args[0].inspect}) to return false, got true"
+ end
+
+ def description
+ "have key #{@args[0].inspect}"
+ end
+
+ private
+ def predicate
+ "#{@sym.to_s.sub("have_","has_")}?".to_sym
+ end
+
+ end
+
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/have.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/have.rb
new file mode 100644
index 000000000..47454e3be
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/have.rb
@@ -0,0 +1,145 @@
+module Spec
+ module Matchers
+
+ class Have #:nodoc:
+ def initialize(expected, relativity=:exactly)
+ @expected = (expected == :no ? 0 : expected)
+ @relativity = relativity
+ end
+
+ def relativities
+ @relativities ||= {
+ :exactly => "",
+ :at_least => "at least ",
+ :at_most => "at most "
+ }
+ end
+
+ def method_missing(sym, *args, &block)
+ @collection_name = sym
+ @plural_collection_name = Inflector.pluralize(sym.to_s) if Object.const_defined?(:Inflector)
+ @args = args
+ @block = block
+ self
+ end
+
+ def matches?(collection_owner)
+ if collection_owner.respond_to?(@collection_name)
+ collection = collection_owner.send(@collection_name, *@args, &@block)
+ elsif (@plural_collection_name && collection_owner.respond_to?(@plural_collection_name))
+ collection = collection_owner.send(@plural_collection_name, *@args, &@block)
+ elsif (collection_owner.respond_to?(:length) || collection_owner.respond_to?(:size))
+ collection = collection_owner
+ else
+ collection_owner.send(@collection_name, *@args, &@block)
+ end
+ @actual = collection.size if collection.respond_to?(:size)
+ @actual = collection.length if collection.respond_to?(:length)
+ raise not_a_collection if @actual.nil?
+ return @actual >= @expected if @relativity == :at_least
+ return @actual <= @expected if @relativity == :at_most
+ return @actual == @expected
+ end
+
+ def not_a_collection
+ "expected #{@collection_name} to be a collection but it does not respond to #length or #size"
+ end
+
+ def failure_message
+ "expected #{relative_expectation} #{@collection_name}, got #{@actual}"
+ end
+
+ def negative_failure_message
+ if @relativity == :exactly
+ return "expected target not to have #{@expected} #{@collection_name}, got #{@actual}"
+ elsif @relativity == :at_most
+ return <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+ should_not have_at_most(#{@expected}).#{@collection_name}
+We recommend that you use this instead:
+ should have_at_least(#{@expected + 1}).#{@collection_name}
+EOF
+ elsif @relativity == :at_least
+ return <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+ should_not have_at_least(#{@expected}).#{@collection_name}
+We recommend that you use this instead:
+ should have_at_most(#{@expected - 1}).#{@collection_name}
+EOF
+ end
+ end
+
+ def description
+ "have #{relative_expectation} #{@collection_name}"
+ end
+
+ private
+
+ def relative_expectation
+ "#{relativities[@relativity]}#{@expected}"
+ end
+ end
+
+ # :call-seq:
+ # should have(number).named_collection__or__sugar
+ # should_not have(number).named_collection__or__sugar
+ #
+ # Passes if receiver is a collection with the submitted
+ # number of items OR if the receiver OWNS a collection
+ # with the submitted number of items.
+ #
+ # If the receiver OWNS the collection, you must use the name
+ # of the collection. So if a Team instance has a
+ # collection named #players, you must use that name
+ # to set the expectation.
+ #
+ # If the receiver IS the collection, you can use any name
+ # you like for named_collection. We'd recommend using
+ # either "elements", "members", or "items" as these are all
+ # standard ways of describing the things IN a collection.
+ #
+ # This also works for Strings, letting you set an expectation
+ # about its length
+ #
+ # == Examples
+ #
+ # # Passes if team.players.size == 11
+ # team.should have(11).players
+ #
+ # # Passes if [1,2,3].length == 3
+ # [1,2,3].should have(3).items #"items" is pure sugar
+ #
+ # # Passes if "this string".length == 11
+ # "this string".should have(11).characters #"characters" is pure sugar
+ def have(n)
+ Matchers::Have.new(n)
+ end
+ alias :have_exactly :have
+
+ # :call-seq:
+ # should have_at_least(number).items
+ #
+ # Exactly like have() with >=.
+ #
+ # == Warning
+ #
+ # +should_not+ +have_at_least+ is not supported
+ def have_at_least(n)
+ Matchers::Have.new(n, :at_least)
+ end
+
+ # :call-seq:
+ # should have_at_most(number).items
+ #
+ # Exactly like have() with <=.
+ #
+ # == Warning
+ #
+ # +should_not+ +have_at_most+ is not supported
+ def have_at_most(n)
+ Matchers::Have.new(n, :at_most)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/include.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/include.rb
new file mode 100644
index 000000000..5476f97d8
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/include.rb
@@ -0,0 +1,70 @@
+module Spec
+ module Matchers
+
+ class Include #:nodoc:
+
+ def initialize(*expecteds)
+ @expecteds = expecteds
+ end
+
+ def matches?(actual)
+ @actual = actual
+ @expecteds.each do |expected|
+ return false unless actual.include?(expected)
+ end
+ true
+ end
+
+ def failure_message
+ _message
+ end
+
+ def negative_failure_message
+ _message("not ")
+ end
+
+ def description
+ "include #{_pretty_print(@expecteds)}"
+ end
+
+ private
+ def _message(maybe_not="")
+ "expected #{@actual.inspect} #{maybe_not}to include #{_pretty_print(@expecteds)}"
+ end
+
+ def _pretty_print(array)
+ result = ""
+ array.each_with_index do |item, index|
+ if index < (array.length - 2)
+ result << "#{item.inspect}, "
+ elsif index < (array.length - 1)
+ result << "#{item.inspect} and "
+ else
+ result << "#{item.inspect}"
+ end
+ end
+ result
+ end
+ end
+
+ # :call-seq:
+ # should include(expected)
+ # should_not include(expected)
+ #
+ # Passes if actual includes expected. This works for
+ # collections and Strings. You can also pass in multiple args
+ # and it will only pass if all args are found in collection.
+ #
+ # == Examples
+ #
+ # [1,2,3].should include(3)
+ # [1,2,3].should include(2,3) #would pass
+ # [1,2,3].should include(2,3,4) #would fail
+ # [1,2,3].should_not include(4)
+ # "spread".should include("read")
+ # "spread".should_not include("red")
+ def include(*expected)
+ Matchers::Include.new(*expected)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/match.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/match.rb
new file mode 100644
index 000000000..61ab52429
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/match.rb
@@ -0,0 +1,41 @@
+module Spec
+ module Matchers
+
+ class Match #:nodoc:
+ def initialize(expected)
+ @expected = expected
+ end
+
+ def matches?(actual)
+ @actual = actual
+ return true if actual =~ @expected
+ return false
+ end
+
+ def failure_message
+ return "expected #{@actual.inspect} to match #{@expected.inspect}", @expected, @actual
+ end
+
+ def negative_failure_message
+ return "expected #{@actual.inspect} not to match #{@expected.inspect}", @expected, @actual
+ end
+
+ def description
+ "match #{@expected.inspect}"
+ end
+ end
+
+ # :call-seq:
+ # should match(regexp)
+ # should_not match(regexp)
+ #
+ # Given a Regexp, passes if actual =~ regexp
+ #
+ # == Examples
+ #
+ # email.should match(/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
+ def match(regexp)
+ Matchers::Match.new(regexp)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/operator_matcher.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/operator_matcher.rb
new file mode 100644
index 000000000..dd23a0994
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/operator_matcher.rb
@@ -0,0 +1,73 @@
+module Spec
+ module Matchers
+ class BaseOperatorMatcher
+ attr_reader :generated_description
+
+ def initialize(target)
+ @target = target
+ end
+
+ def ==(expected)
+ @expected = expected
+ __delegate_method_missing_to_target("==", expected)
+ end
+
+ def ===(expected)
+ @expected = expected
+ __delegate_method_missing_to_target("===", expected)
+ end
+
+ def =~(expected)
+ @expected = expected
+ __delegate_method_missing_to_target("=~", expected)
+ end
+
+ def >(expected)
+ @expected = expected
+ __delegate_method_missing_to_target(">", expected)
+ end
+
+ def >=(expected)
+ @expected = expected
+ __delegate_method_missing_to_target(">=", expected)
+ end
+
+ def <(expected)
+ @expected = expected
+ __delegate_method_missing_to_target("<", expected)
+ end
+
+ def <=(expected)
+ @expected = expected
+ __delegate_method_missing_to_target("<=", expected)
+ end
+
+ def fail_with_message(message)
+ Spec::Expectations.fail_with(message, @expected, @target)
+ end
+
+ end
+
+ class PositiveOperatorMatcher < BaseOperatorMatcher #:nodoc:
+
+ def __delegate_method_missing_to_target(operator, expected)
+ ::Spec::Matchers.generated_description = "should #{operator} #{expected.inspect}"
+ return if @target.send(operator, expected)
+ return fail_with_message("expected: #{expected.inspect},\n got: #{@target.inspect} (using #{operator})") if ['==','===', '=~'].include?(operator)
+ return fail_with_message("expected: #{operator} #{expected.inspect},\n got: #{operator.gsub(/./, ' ')} #{@target.inspect}")
+ end
+
+ end
+
+ class NegativeOperatorMatcher < BaseOperatorMatcher #:nodoc:
+
+ def __delegate_method_missing_to_target(operator, expected)
+ ::Spec::Matchers.generated_description = "should not #{operator} #{expected.inspect}"
+ return unless @target.send(operator, expected)
+ return fail_with_message("expected not: #{operator} #{expected.inspect},\n got: #{operator.gsub(/./, ' ')} #{@target.inspect}")
+ end
+
+ end
+
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/raise_error.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/raise_error.rb
new file mode 100644
index 000000000..b45dcf65c
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/raise_error.rb
@@ -0,0 +1,105 @@
+module Spec
+ module Matchers
+
+ class RaiseError #:nodoc:
+ def initialize(error_or_message=Exception, message=nil)
+ if String === error_or_message
+ @expected_error = Exception
+ @expected_message = error_or_message
+ else
+ @expected_error = error_or_message
+ @expected_message = message
+ end
+ end
+
+ def matches?(proc)
+ @raised_expected_error = false
+ @raised_other = false
+ begin
+ proc.call
+ rescue @expected_error => @actual_error
+ if @expected_message.nil?
+ @raised_expected_error = true
+ else
+ case @expected_message
+ when Regexp
+ if @expected_message =~ @actual_error.message
+ @raised_expected_error = true
+ else
+ @raised_other = true
+ end
+ else
+ if @expected_message == @actual_error.message
+ @raised_expected_error = true
+ else
+ @raised_other = true
+ end
+ end
+ end
+ rescue => @actual_error
+ @raised_other = true
+ ensure
+ return @raised_expected_error
+ end
+ end
+
+ def failure_message
+ return "expected #{expected_error}#{actual_error}" if @raised_other || !@raised_expected_error
+ end
+
+ def negative_failure_message
+ "expected no #{expected_error}#{actual_error}"
+ end
+
+ def description
+ "raise #{expected_error}"
+ end
+
+ private
+ def expected_error
+ case @expected_message
+ when nil
+ @expected_error
+ when Regexp
+ "#{@expected_error} with message matching #{@expected_message.inspect}"
+ else
+ "#{@expected_error} with #{@expected_message.inspect}"
+ end
+ end
+
+ def actual_error
+ @actual_error.nil? ? " but nothing was raised" : ", got #{@actual_error.inspect}"
+ end
+ end
+
+ # :call-seq:
+ # should raise_error()
+ # should raise_error(NamedError)
+ # should raise_error(NamedError, String)
+ # should raise_error(NamedError, Regexp)
+ # should_not raise_error()
+ # should_not raise_error(NamedError)
+ # should_not raise_error(NamedError, String)
+ # should_not raise_error(NamedError, Regexp)
+ #
+ # With no args, matches if any error is raised.
+ # With a named error, matches only if that specific error is raised.
+ # With a named error and messsage specified as a String, matches only if both match.
+ # With a named error and messsage specified as a Regexp, matches only if both match.
+ #
+ # == Examples
+ #
+ # lambda { do_something_risky }.should raise_error
+ # lambda { do_something_risky }.should raise_error(PoorRiskDecisionError)
+ # lambda { do_something_risky }.should raise_error(PoorRiskDecisionError, "that was too risky")
+ # lambda { do_something_risky }.should raise_error(PoorRiskDecisionError, /oo ri/)
+ #
+ # lambda { do_something_risky }.should_not raise_error
+ # lambda { do_something_risky }.should_not raise_error(PoorRiskDecisionError)
+ # lambda { do_something_risky }.should_not raise_error(PoorRiskDecisionError, "that was too risky")
+ # lambda { do_something_risky }.should_not raise_error(PoorRiskDecisionError, /oo ri/)
+ def raise_error(error=Exception, message=nil)
+ Matchers::RaiseError.new(error, message)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/respond_to.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/respond_to.rb
new file mode 100644
index 000000000..3d23422aa
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/respond_to.rb
@@ -0,0 +1,45 @@
+module Spec
+ module Matchers
+
+ class RespondTo #:nodoc:
+ def initialize(*names)
+ @names = names
+ @names_not_responded_to = []
+ end
+
+ def matches?(target)
+ @names.each do |name|
+ unless target.respond_to?(name)
+ @names_not_responded_to << name
+ end
+ end
+ return @names_not_responded_to.empty?
+ end
+
+ def failure_message
+ "expected target to respond to #{@names_not_responded_to.collect {|name| name.inspect }.join(', ')}"
+ end
+
+ def negative_failure_message
+ "expected target not to respond to #{@names.collect {|name| name.inspect }.join(', ')}"
+ end
+
+ def description
+ "respond to ##{@names.to_s}"
+ end
+ end
+
+ # :call-seq:
+ # should respond_to(*names)
+ # should_not respond_to(*names)
+ #
+ # Matches if the target object responds to all of the names
+ # provided. Names can be Strings or Symbols.
+ #
+ # == Examples
+ #
+ def respond_to(*names)
+ Matchers::RespondTo.new(*names)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/satisfy.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/satisfy.rb
new file mode 100644
index 000000000..6c0ca95bc
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/satisfy.rb
@@ -0,0 +1,47 @@
+module Spec
+ module Matchers
+
+ class Satisfy #:nodoc:
+ def initialize(&block)
+ @block = block
+ end
+
+ def matches?(actual, &block)
+ @block = block if block
+ @actual = actual
+ @block.call(actual)
+ end
+
+ def failure_message
+ "expected #{@actual} to satisfy block"
+ end
+
+ def negative_failure_message
+ "expected #{@actual} not to satisfy block"
+ end
+ end
+
+ # :call-seq:
+ # should satisfy {}
+ # should_not satisfy {}
+ #
+ # Passes if the submitted block returns true. Yields target to the
+ # block.
+ #
+ # Generally speaking, this should be thought of as a last resort when
+ # you can't find any other way to specify the behaviour you wish to
+ # specify.
+ #
+ # If you do find yourself in such a situation, you could always write
+ # a custom matcher, which would likely make your specs more expressive.
+ #
+ # == Examples
+ #
+ # 5.should satisfy { |n|
+ # n > 3
+ # }
+ def satisfy(&block)
+ Matchers::Satisfy.new(&block)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/simple_matcher.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/simple_matcher.rb
new file mode 100644
index 000000000..ac547d06a
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/simple_matcher.rb
@@ -0,0 +1,29 @@
+module Spec
+ module Matchers
+ class SimpleMatcher
+ attr_reader :description
+
+ def initialize(description, &match_block)
+ @description = description
+ @match_block = match_block
+ end
+
+ def matches?(actual)
+ @actual = actual
+ return @match_block.call(@actual)
+ end
+
+ def failure_message()
+ return %[expected #{@description.inspect} but got #{@actual.inspect}]
+ end
+
+ def negative_failure_message()
+ return %[expected not to get #{@description.inspect}, but got #{@actual.inspect}]
+ end
+ end
+
+ def simple_matcher(message, &match_block)
+ SimpleMatcher.new(message, &match_block)
+ end
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/throw_symbol.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/throw_symbol.rb
new file mode 100644
index 000000000..c74d84436
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/throw_symbol.rb
@@ -0,0 +1,74 @@
+module Spec
+ module Matchers
+
+ class ThrowSymbol #:nodoc:
+ def initialize(expected=nil)
+ @expected = expected
+ @actual = nil
+ end
+
+ def matches?(proc)
+ begin
+ proc.call
+ rescue NameError => e
+ raise e unless e.message =~ /uncaught throw/
+ @actual = e.name.to_sym
+ ensure
+ if @expected.nil?
+ return @actual.nil? ? false : true
+ else
+ return @actual == @expected
+ end
+ end
+ end
+
+ def failure_message
+ if @actual
+ "expected #{expected}, got #{@actual.inspect}"
+ else
+ "expected #{expected} but nothing was thrown"
+ end
+ end
+
+ def negative_failure_message
+ if @expected
+ "expected #{expected} not to be thrown"
+ else
+ "expected no Symbol, got :#{@actual}"
+ end
+ end
+
+ def description
+ "throw #{expected}"
+ end
+
+ private
+
+ def expected
+ @expected.nil? ? "a Symbol" : @expected.inspect
+ end
+
+ end
+
+ # :call-seq:
+ # should throw_symbol()
+ # should throw_symbol(:sym)
+ # should_not throw_symbol()
+ # should_not throw_symbol(:sym)
+ #
+ # Given a Symbol argument, matches if a proc throws the specified Symbol.
+ #
+ # Given no argument, matches if a proc throws any Symbol.
+ #
+ # == Examples
+ #
+ # lambda { do_something_risky }.should throw_symbol
+ # lambda { do_something_risky }.should throw_symbol(:that_was_risky)
+ #
+ # lambda { do_something_risky }.should_not throw_symbol
+ # lambda { do_something_risky }.should_not throw_symbol(:that_was_risky)
+ def throw_symbol(sym=nil)
+ Matchers::ThrowSymbol.new(sym)
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks.rb
new file mode 100644
index 000000000..9f9cd215b
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks.rb
@@ -0,0 +1,211 @@
+require 'spec/mocks/methods'
+require 'spec/mocks/argument_constraint_matchers'
+require 'spec/mocks/spec_methods'
+require 'spec/mocks/proxy'
+require 'spec/mocks/mock'
+require 'spec/mocks/argument_expectation'
+require 'spec/mocks/message_expectation'
+require 'spec/mocks/order_group'
+require 'spec/mocks/errors'
+require 'spec/mocks/error_generator'
+require 'spec/mocks/extensions/object'
+require 'spec/mocks/space'
+
+
+module Spec
+ # == Mocks and Stubs
+ #
+ # RSpec will create Mock Objects and Stubs for you at runtime, or attach stub/mock behaviour
+ # to any of your real objects (Partial Mock/Stub). Because the underlying implementation
+ # for mocks and stubs is the same, you can intermingle mock and stub
+ # behaviour in either dynamically generated mocks or your pre-existing classes.
+ # There is a semantic difference in how they are created, however,
+ # which can help clarify the role it is playing within a given spec.
+ #
+ # == Mock Objects
+ #
+ # Mocks are objects that allow you to set and verify expectations that they will
+ # receive specific messages during run time. They are very useful for specifying how the subject of
+ # the spec interacts with its collaborators. This approach is widely known as "interaction
+ # testing".
+ #
+ # Mocks are also very powerful as a design tool. As you are
+ # driving the implementation of a given class, Mocks provide an anonymous
+ # collaborator that can change in behaviour as quickly as you can write an expectation in your
+ # spec. This flexibility allows you to design the interface of a collaborator that often
+ # does not yet exist. As the shape of the class being specified becomes more clear, so do the
+ # requirements for its collaborators - often leading to the discovery of new types that are
+ # needed in your system.
+ #
+ # Read Endo-Testing[http://www.mockobjects.com/files/endotesting.pdf] for a much
+ # more in depth description of this process.
+ #
+ # == Stubs
+ #
+ # Stubs are objects that allow you to set "stub" responses to
+ # messages. As Martin Fowler points out on his site,
+ # mocks_arent_stubs[http://www.martinfowler.com/articles/mocksArentStubs.html].
+ # Paraphrasing Fowler's paraphrasing
+ # of Gerard Meszaros: Stubs provide canned responses to messages they might receive in a test, while
+ # mocks allow you to specify and, subsquently, verify that certain messages should be received during
+ # the execution of a test.
+ #
+ # == Partial Mocks/Stubs
+ #
+ # RSpec also supports partial mocking/stubbing, allowing you to add stub/mock behaviour
+ # to instances of your existing classes. This is generally
+ # something to be avoided, because changes to the class can have ripple effects on
+ # seemingly unrelated specs. When specs fail due to these ripple effects, the fact
+ # that some methods are being mocked can make it difficult to understand why a
+ # failure is occurring.
+ #
+ # That said, partials do allow you to expect and
+ # verify interactions with class methods such as +#find+ and +#create+
+ # on Ruby on Rails model classes.
+ #
+ # == Further Reading
+ #
+ # There are many different viewpoints about the meaning of mocks and stubs. If you are interested
+ # in learning more, here is some recommended reading:
+ #
+ # * Mock Objects: http://www.mockobjects.com/
+ # * Endo-Testing: http://www.mockobjects.com/files/endotesting.pdf
+ # * Mock Roles, Not Objects: http://www.mockobjects.com/files/mockrolesnotobjects.pdf
+ # * Test Double Patterns: http://xunitpatterns.com/Test%20Double%20Patterns.html
+ # * Mocks aren't stubs: http://www.martinfowler.com/articles/mocksArentStubs.html
+ #
+ # == Creating a Mock
+ #
+ # You can create a mock in any specification (or setup) using:
+ #
+ # mock(name, options={})
+ #
+ # The optional +options+ argument is a +Hash+. Currently the only supported
+ # option is +:null_object+. Setting this to true instructs the mock to ignore
+ # any messages it hasn’t been told to expect – and quietly return itself. For example:
+ #
+ # mock("person", :null_object => true)
+ #
+ # == Creating a Stub
+ #
+ # You can create a stub in any specification (or setup) using:
+ #
+ # stub(name, stub_methods_and_values_hash)
+ #
+ # For example, if you wanted to create an object that always returns
+ # "More?!?!?!" to "please_sir_may_i_have_some_more" you would do this:
+ #
+ # stub("Mr Sykes", :please_sir_may_i_have_some_more => "More?!?!?!")
+ #
+ # == Creating a Partial Mock
+ #
+ # You don't really "create" a partial mock, you simply add method stubs and/or
+ # mock expectations to existing classes and objects:
+ #
+ # Factory.should_receive(:find).with(id).and_return(value)
+ # obj.stub!(:to_i).and_return(3)
+ # etc ...
+ #
+ # == Expecting Messages
+ #
+ # my_mock.should_receive(:sym)
+ # my_mock.should_not_receive(:sym)
+ #
+ # == Expecting Arguments
+ #
+ # my_mock.should_receive(:sym).with(*args)
+ # my_mock.should_not_receive(:sym).with(*args)
+ #
+ # == Argument Constraints using Expression Matchers
+ #
+ # Arguments that are passed to #with are compared with actual arguments received
+ # using == by default. In cases in which you want to specify things about the arguments
+ # rather than the arguments themselves, you can use any of the Expression Matchers.
+ # They don't all make syntactic sense (they were primarily designed for use with
+ # Spec::Expectations), but you are free to create your own custom Spec::Matchers.
+ #
+ # Spec::Mocks does provide one additional Matcher method named #ducktype.
+ #
+ # In addition, Spec::Mocks adds some keyword Symbols that you can use to
+ # specify certain kinds of arguments:
+ #
+ # my_mock.should_receive(:sym).with(no_args())
+ # my_mock.should_receive(:sym).with(any_args())
+ # my_mock.should_receive(:sym).with(1, an_instance_of(Numeric), "b") #2nd argument can any type of Numeric
+ # my_mock.should_receive(:sym).with(1, boolean(), "b") #2nd argument can true or false
+ # my_mock.should_receive(:sym).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
+ # my_mock.should_receive(:sym).with(1, anything(), "b") #2nd argument can be anything at all
+ # my_mock.should_receive(:sym).with(1, ducktype(:abs, :div), "b")
+ # #2nd argument can be object that responds to #abs and #div
+ #
+ # == Receive Counts
+ #
+ # my_mock.should_receive(:sym).once
+ # my_mock.should_receive(:sym).twice
+ # my_mock.should_receive(:sym).exactly(n).times
+ # my_mock.should_receive(:sym).at_least(:once)
+ # my_mock.should_receive(:sym).at_least(:twice)
+ # my_mock.should_receive(:sym).at_least(n).times
+ # my_mock.should_receive(:sym).at_most(:once)
+ # my_mock.should_receive(:sym).at_most(:twice)
+ # my_mock.should_receive(:sym).at_most(n).times
+ # my_mock.should_receive(:sym).any_number_of_times
+ #
+ # == Ordering
+ #
+ # my_mock.should_receive(:sym).ordered
+ # my_mock.should_receive(:other_sym).ordered
+ # #This will fail if the messages are received out of order
+ #
+ # == Setting Reponses
+ #
+ # Whether you are setting a mock expectation or a simple stub, you can tell the
+ # object precisely how to respond:
+ #
+ # my_mock.should_receive(:sym).and_return(value)
+ # my_mock.should_receive(:sym).exactly(3).times.and_return(value1, value2, value3)
+ # # returns value1 the first time, value2 the second, etc
+ # my_mock.should_receive(:sym).and_return { ... } #returns value returned by the block
+ # my_mock.should_receive(:sym).and_raise(error)
+ # #error can be an instantiated object or a class
+ # #if it is a class, it must be instantiable with no args
+ # my_mock.should_receive(:sym).and_throw(:sym)
+ # my_mock.should_receive(:sym).and_yield(values,to,yield)
+ # my_mock.should_receive(:sym).and_yield(values,to,yield).and_yield(some,other,values,this,time)
+ # # for methods that yield to a block multiple times
+ #
+ # Any of these responses can be applied to a stub as well, but stubs do
+ # not support any qualifiers about the message received (i.e. you can't specify arguments
+ # or receive counts):
+ #
+ # my_mock.stub!(:sym).and_return(value)
+ # my_mock.stub!(:sym).and_return(value1, value2, value3)
+ # my_mock.stub!(:sym).and_raise(error)
+ # my_mock.stub!(:sym).and_throw(:sym)
+ # my_mock.stub!(:sym).and_yield(values,to,yield)
+ # my_mock.stub!(:sym).and_yield(values,to,yield).and_yield(some,other,values,this,time)
+ #
+ # == Arbitrary Handling
+ #
+ # Once in a while you'll find that the available expectations don't solve the
+ # particular problem you are trying to solve. Imagine that you expect the message
+ # to come with an Array argument that has a specific length, but you don't care
+ # what is in it. You could do this:
+ #
+ # my_mock.should_receive(:sym) do |arg|
+ # arg.should be_an_istance_of(Array)
+ # arg.length.should == 7
+ # end
+ #
+ # Note that this would fail if the number of arguments received was different from
+ # the number of block arguments (in this case 1).
+ #
+ # == Combining Expectation Details
+ #
+ # Combining the message name with specific arguments, receive counts and responses
+ # you can get quite a bit of detail in your expectations:
+ #
+ # my_mock.should_receive(:<<).with("illegal value").once.and_raise(ArgumentError)
+ module Mocks
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/argument_constraint_matchers.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/argument_constraint_matchers.rb
new file mode 100644
index 000000000..0e4777082
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/argument_constraint_matchers.rb
@@ -0,0 +1,27 @@
+module Spec
+ module Mocks
+ module ArgumentConstraintMatchers
+
+ # Shortcut for creating an instance of Spec::Mocks::DuckTypeArgConstraint
+ def duck_type(*args)
+ DuckTypeArgConstraint.new(*args)
+ end
+
+ def any_args
+ AnyArgsConstraint.new
+ end
+
+ def anything
+ AnyArgConstraint.new(nil)
+ end
+
+ def boolean
+ BooleanArgConstraint.new(nil)
+ end
+
+ def no_args
+ NoArgsConstraint.new
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/argument_expectation.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/argument_expectation.rb
new file mode 100644
index 000000000..34a1d4d03
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/argument_expectation.rb
@@ -0,0 +1,183 @@
+module Spec
+ module Mocks
+
+ class MatcherConstraint
+ def initialize(matcher)
+ @matcher = matcher
+ end
+
+ def matches?(value)
+ @matcher.matches?(value)
+ end
+ end
+
+ class LiteralArgConstraint
+ def initialize(literal)
+ @literal_value = literal
+ end
+
+ def matches?(value)
+ @literal_value == value
+ end
+ end
+
+ class RegexpArgConstraint
+ def initialize(regexp)
+ @regexp = regexp
+ end
+
+ def matches?(value)
+ return value =~ @regexp unless value.is_a?(Regexp)
+ value == @regexp
+ end
+ end
+
+ class AnyArgConstraint
+ def initialize(ignore)
+ end
+
+ def ==(other)
+ true
+ end
+
+ # TODO - need this?
+ def matches?(value)
+ true
+ end
+ end
+
+ class AnyArgsConstraint
+ def description
+ "any args"
+ end
+ end
+
+ class NoArgsConstraint
+ def description
+ "no args"
+ end
+
+ def ==(args)
+ args == []
+ end
+ end
+
+ class NumericArgConstraint
+ def initialize(ignore)
+ end
+
+ def matches?(value)
+ value.is_a?(Numeric)
+ end
+ end
+
+ class BooleanArgConstraint
+ def initialize(ignore)
+ end
+
+ def ==(value)
+ matches?(value)
+ end
+
+ def matches?(value)
+ return true if value.is_a?(TrueClass)
+ return true if value.is_a?(FalseClass)
+ false
+ end
+ end
+
+ class StringArgConstraint
+ def initialize(ignore)
+ end
+
+ def matches?(value)
+ value.is_a?(String)
+ end
+ end
+
+ class DuckTypeArgConstraint
+ def initialize(*methods_to_respond_to)
+ @methods_to_respond_to = methods_to_respond_to
+ end
+
+ def matches?(value)
+ @methods_to_respond_to.all? { |sym| value.respond_to?(sym) }
+ end
+
+ def description
+ "duck_type"
+ end
+ end
+
+ class ArgumentExpectation
+ attr_reader :args
+ @@constraint_classes = Hash.new { |hash, key| LiteralArgConstraint}
+ @@constraint_classes[:anything] = AnyArgConstraint
+ @@constraint_classes[:numeric] = NumericArgConstraint
+ @@constraint_classes[:boolean] = BooleanArgConstraint
+ @@constraint_classes[:string] = StringArgConstraint
+
+ def initialize(args)
+ @args = args
+ if [:any_args] == args
+ @expected_params = nil
+ warn_deprecated(:any_args.inspect, "any_args()")
+ elsif args.length == 1 && args[0].is_a?(AnyArgsConstraint) then @expected_params = nil
+ elsif [:no_args] == args
+ @expected_params = []
+ warn_deprecated(:no_args.inspect, "no_args()")
+ elsif args.length == 1 && args[0].is_a?(NoArgsConstraint) then @expected_params = []
+ else @expected_params = process_arg_constraints(args)
+ end
+ end
+
+ def process_arg_constraints(constraints)
+ constraints.collect do |constraint|
+ convert_constraint(constraint)
+ end
+ end
+
+ def warn_deprecated(deprecated_method, instead)
+ Kernel.warn "The #{deprecated_method} constraint is deprecated. Use #{instead} instead."
+ end
+
+ def convert_constraint(constraint)
+ if [:anything, :numeric, :boolean, :string].include?(constraint)
+ case constraint
+ when :anything
+ instead = "anything()"
+ when :boolean
+ instead = "boolean()"
+ when :numeric
+ instead = "an_instance_of(Numeric)"
+ when :string
+ instead = "an_instance_of(String)"
+ end
+ warn_deprecated(constraint.inspect, instead)
+ return @@constraint_classes[constraint].new(constraint)
+ end
+ return MatcherConstraint.new(constraint) if is_matcher?(constraint)
+ return RegexpArgConstraint.new(constraint) if constraint.is_a?(Regexp)
+ return LiteralArgConstraint.new(constraint)
+ end
+
+ def is_matcher?(obj)
+ return obj.respond_to?(:matches?) && obj.respond_to?(:description)
+ end
+
+ def check_args(args)
+ return true if @expected_params.nil?
+ return true if @expected_params == args
+ return constraints_match?(args)
+ end
+
+ def constraints_match?(args)
+ return false if args.length != @expected_params.length
+ @expected_params.each_index { |i| return false unless @expected_params[i].matches?(args[i]) }
+ return true
+ end
+
+ end
+
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/error_generator.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/error_generator.rb
new file mode 100644
index 000000000..01d8f720d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/error_generator.rb
@@ -0,0 +1,84 @@
+module Spec
+ module Mocks
+ class ErrorGenerator
+ attr_writer :opts
+
+ def initialize(target, name)
+ @target = target
+ @name = name
+ end
+
+ def opts
+ @opts ||= {}
+ end
+
+ def raise_unexpected_message_error(sym, *args)
+ __raise "#{intro} received unexpected message :#{sym}#{arg_message(*args)}"
+ end
+
+ def raise_unexpected_message_args_error(expectation, *args)
+ expected_args = format_args(*expectation.expected_args)
+ actual_args = args.empty? ? "(no args)" : format_args(*args)
+ __raise "#{intro} expected #{expectation.sym.inspect} with #{expected_args} but received it with #{actual_args}"
+ end
+
+ def raise_expectation_error(sym, expected_received_count, actual_received_count, *args)
+ __raise "#{intro} expected :#{sym}#{arg_message(*args)} #{count_message(expected_received_count)}, but received it #{count_message(actual_received_count)}"
+ end
+
+ def raise_out_of_order_error(sym)
+ __raise "#{intro} received :#{sym} out of order"
+ end
+
+ def raise_block_failed_error(sym, detail)
+ __raise "#{intro} received :#{sym} but passed block failed with: #{detail}"
+ end
+
+ def raise_missing_block_error(args_to_yield)
+ __raise "#{intro} asked to yield |#{arg_list(*args_to_yield)}| but no block was passed"
+ end
+
+ def raise_wrong_arity_error(args_to_yield, arity)
+ __raise "#{intro} yielded |#{arg_list(*args_to_yield)}| to block with arity of #{arity}"
+ end
+
+ private
+ def intro
+ @name ? "Mock '#{@name}'" : @target.inspect
+ end
+
+ def __raise(message)
+ message = opts[:message] unless opts[:message].nil?
+ Kernel::raise(Spec::Mocks::MockExpectationError, message)
+ end
+
+ def arg_message(*args)
+ " with " + format_args(*args)
+ end
+
+ def format_args(*args)
+ return "(no args)" if args.empty? || args == [:no_args]
+ return "(any args)" if args == [:any_args]
+ "(" + arg_list(*args) + ")"
+ end
+
+ def arg_list(*args)
+ args.collect do |arg|
+ arg.respond_to?(:description) ? arg.description : arg.inspect
+ end.join(", ")
+ end
+
+ def count_message(count)
+ return "at least #{pretty_print(count.abs)}" if count < 0
+ return pretty_print(count)
+ end
+
+ def pretty_print(count)
+ return "once" if count == 1
+ return "twice" if count == 2
+ return "#{count} times"
+ end
+
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/errors.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/errors.rb
new file mode 100644
index 000000000..68fdfe006
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/errors.rb
@@ -0,0 +1,10 @@
+module Spec
+ module Mocks
+ class MockExpectationError < StandardError
+ end
+
+ class AmbiguousReturnError < StandardError
+ end
+ end
+end
+
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/extensions/object.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/extensions/object.rb
new file mode 100644
index 000000000..4b7531066
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/extensions/object.rb
@@ -0,0 +1,3 @@
+class Object
+ include Spec::Mocks::Methods
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/message_expectation.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/message_expectation.rb
new file mode 100644
index 000000000..6bd2f1c32
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/message_expectation.rb
@@ -0,0 +1,267 @@
+module Spec
+ module Mocks
+
+ class BaseExpectation
+ attr_reader :sym
+
+ def initialize(error_generator, expectation_ordering, expected_from, sym, method_block, expected_received_count=1, opts={})
+ @error_generator = error_generator
+ @error_generator.opts = opts
+ @expected_from = expected_from
+ @sym = sym
+ @method_block = method_block
+ @return_block = nil
+ @actual_received_count = 0
+ @expected_received_count = expected_received_count
+ @args_expectation = ArgumentExpectation.new([AnyArgsConstraint.new])
+ @consecutive = false
+ @exception_to_raise = nil
+ @symbol_to_throw = nil
+ @order_group = expectation_ordering
+ @at_least = nil
+ @at_most = nil
+ @args_to_yield = []
+ end
+
+ def expected_args
+ @args_expectation.args
+ end
+
+ def and_return(*values, &return_block)
+ Kernel::raise AmbiguousReturnError unless @method_block.nil?
+ case values.size
+ when 0 then value = nil
+ when 1 then value = values[0]
+ else
+ value = values
+ @consecutive = true
+ @expected_received_count = values.size if !ignoring_args? &&
+ @expected_received_count < values.size
+ end
+ @return_block = block_given? ? return_block : lambda { value }
+ # Ruby 1.9 - see where this is used below
+ @ignore_args = !block_given?
+ end
+
+ # :call-seq:
+ # and_raise()
+ # and_raise(Exception) #any exception class
+ # and_raise(exception) #any exception object
+ #
+ # == Warning
+ #
+ # When you pass an exception class, the MessageExpectation will
+ # raise an instance of it, creating it with +new+. If the exception
+ # class initializer requires any parameters, you must pass in an
+ # instance and not the class.
+ def and_raise(exception=Exception)
+ @exception_to_raise = exception
+ end
+
+ def and_throw(symbol)
+ @symbol_to_throw = symbol
+ end
+
+ def and_yield(*args)
+ @args_to_yield << args
+ self
+ end
+
+ def matches(sym, args)
+ @sym == sym and @args_expectation.check_args(args)
+ end
+
+ def invoke(args, block)
+ @order_group.handle_order_constraint self
+
+ begin
+ Kernel::raise @exception_to_raise unless @exception_to_raise.nil?
+ Kernel::throw @symbol_to_throw unless @symbol_to_throw.nil?
+
+ if !@method_block.nil?
+ default_return_val = invoke_method_block(args)
+ elsif @args_to_yield.size > 0
+ default_return_val = invoke_with_yield(block)
+ else
+ default_return_val = nil
+ end
+
+ if @consecutive
+ return invoke_consecutive_return_block(args, block)
+ elsif @return_block
+ return invoke_return_block(args, block)
+ else
+ return default_return_val
+ end
+ ensure
+ @actual_received_count += 1
+ end
+ end
+
+ protected
+
+ def invoke_method_block(args)
+ begin
+ @method_block.call(*args)
+ rescue => detail
+ @error_generator.raise_block_failed_error @sym, detail.message
+ end
+ end
+
+ def invoke_with_yield(block)
+ if block.nil?
+ @error_generator.raise_missing_block_error @args_to_yield
+ end
+ @args_to_yield.each do |args_to_yield_this_time|
+ if block.arity > -1 && args_to_yield_this_time.length != block.arity
+ @error_generator.raise_wrong_arity_error args_to_yield_this_time, block.arity
+ end
+ block.call(*args_to_yield_this_time)
+ end
+ end
+
+ def invoke_consecutive_return_block(args, block)
+ args << block unless block.nil?
+ value = @return_block.call(*args)
+
+ index = [@actual_received_count, value.size-1].min
+ value[index]
+ end
+
+ def invoke_return_block(args, block)
+ args << block unless block.nil?
+ # Ruby 1.9 - when we set @return_block to return values
+ # regardless of arguments, any arguments will result in
+ # a "wrong number of arguments" error
+ if @ignore_args
+ @return_block.call()
+ else
+ @return_block.call(*args)
+ end
+ end
+ end
+
+ class MessageExpectation < BaseExpectation
+
+ def matches_name_but_not_args(sym, args)
+ @sym == sym and not @args_expectation.check_args(args)
+ end
+
+ def verify_messages_received
+ return if ignoring_args? || matches_exact_count? ||
+ matches_at_least_count? || matches_at_most_count?
+
+ generate_error
+ rescue Spec::Mocks::MockExpectationError => error
+ error.backtrace.insert(0, @expected_from)
+ Kernel::raise error
+ end
+
+ def ignoring_args?
+ @expected_received_count == :any
+ end
+
+ def matches_at_least_count?
+ @at_least && @actual_received_count >= @expected_received_count
+ end
+
+ def matches_at_most_count?
+ @at_most && @actual_received_count <= @expected_received_count
+ end
+
+ def matches_exact_count?
+ @expected_received_count == @actual_received_count
+ end
+
+ def generate_error
+ @error_generator.raise_expectation_error(@sym, @expected_received_count, @actual_received_count, *@args_expectation.args)
+ end
+
+ def with(*args, &block)
+ @method_block = block if block
+ @args_expectation = ArgumentExpectation.new(args)
+ self
+ end
+
+ def exactly(n)
+ set_expected_received_count :exactly, n
+ self
+ end
+
+ def at_least(n)
+ set_expected_received_count :at_least, n
+ self
+ end
+
+ def at_most(n)
+ set_expected_received_count :at_most, n
+ self
+ end
+
+ def times(&block)
+ @method_block = block if block
+ self
+ end
+
+ def any_number_of_times(&block)
+ @method_block = block if block
+ @expected_received_count = :any
+ self
+ end
+
+ def never
+ @expected_received_count = 0
+ self
+ end
+
+ def once(&block)
+ @method_block = block if block
+ @expected_received_count = 1
+ self
+ end
+
+ def twice(&block)
+ @method_block = block if block
+ @expected_received_count = 2
+ self
+ end
+
+ def ordered(&block)
+ @method_block = block if block
+ @order_group.register(self)
+ @ordered = true
+ self
+ end
+
+ def negative_expectation_for?(sym)
+ return false
+ end
+
+ protected
+ def set_expected_received_count(relativity, n)
+ @at_least = (relativity == :at_least)
+ @at_most = (relativity == :at_most)
+ @expected_received_count = case n
+ when Numeric
+ n
+ when :once
+ 1
+ when :twice
+ 2
+ end
+ end
+
+ end
+
+ class NegativeMessageExpectation < MessageExpectation
+ def initialize(message, expectation_ordering, expected_from, sym, method_block)
+ super(message, expectation_ordering, expected_from, sym, method_block, 0)
+ end
+
+ def negative_expectation_for?(sym)
+ return @sym == sym
+ end
+ end
+
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/methods.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/methods.rb
new file mode 100644
index 000000000..d9fa324d3
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/methods.rb
@@ -0,0 +1,39 @@
+module Spec
+ module Mocks
+ module Methods
+ def should_receive(sym, opts={}, &block)
+ __mock_proxy.add_message_expectation(opts[:expected_from] || caller(1)[0], sym.to_sym, opts, &block)
+ end
+
+ def should_not_receive(sym, &block)
+ __mock_proxy.add_negative_message_expectation(caller(1)[0], sym.to_sym, &block)
+ end
+
+ def stub!(sym, opts={})
+ __mock_proxy.add_stub(caller(1)[0], sym.to_sym, opts)
+ end
+
+ def received_message?(sym, *args, &block) #:nodoc:
+ __mock_proxy.received_message?(sym.to_sym, *args, &block)
+ end
+
+ def rspec_verify #:nodoc:
+ __mock_proxy.verify
+ end
+
+ def rspec_reset #:nodoc:
+ __mock_proxy.reset
+ end
+
+ private
+
+ def __mock_proxy
+ if Mock === self
+ @mock_proxy ||= Proxy.new(self, @name, @options)
+ else
+ @mock_proxy ||= Proxy.new(self, self.class.name)
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/mock.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/mock.rb
new file mode 100644
index 000000000..f029b1b8f
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/mock.rb
@@ -0,0 +1,50 @@
+module Spec
+ module Mocks
+ class Mock
+ include Methods
+
+ # Creates a new mock with a +name+ (that will be used in error messages only)
+ # == Options:
+ # * :null_object - if true, the mock object acts as a forgiving null object allowing any message to be sent to it.
+ def initialize(name, stubs_and_options={})
+ @name = name
+ @options = parse_options(stubs_and_options)
+ assign_stubs(stubs_and_options)
+ end
+
+ # This allows for comparing the mock to other objects that proxy
+ # such as ActiveRecords belongs_to proxy objects
+ # By making the other object run the comparison, we're sure the call gets delegated to the proxy target
+ # This is an unfortunate side effect from ActiveRecord, but this should be safe unless the RHS redefines == in a nonsensical manner
+ def ==(other)
+ other == __mock_proxy
+ end
+
+ def method_missing(sym, *args, &block)
+ __mock_proxy.instance_eval {@messages_received << [sym, args, block]}
+ begin
+ return self if __mock_proxy.null_object?
+ super(sym, *args, &block)
+ rescue NameError
+ __mock_proxy.raise_unexpected_message_error sym, *args
+ end
+ end
+
+ def inspect
+ "#<#{self.class}:#{sprintf '0x%x', self.object_id} @name=#{@name.inspect}>"
+ end
+
+ private
+
+ def parse_options(options)
+ options.has_key?(:null_object) ? {:null_object => options.delete(:null_object)} : {}
+ end
+
+ def assign_stubs(stubs)
+ stubs.each_pair do |message, response|
+ stub!(message).and_return(response)
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/order_group.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/order_group.rb
new file mode 100644
index 000000000..9983207eb
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/order_group.rb
@@ -0,0 +1,29 @@
+module Spec
+ module Mocks
+ class OrderGroup
+ def initialize error_generator
+ @error_generator = error_generator
+ @ordering = Array.new
+ end
+
+ def register(expectation)
+ @ordering << expectation
+ end
+
+ def ready_for?(expectation)
+ return @ordering.first == expectation
+ end
+
+ def consume
+ @ordering.shift
+ end
+
+ def handle_order_constraint expectation
+ return unless @ordering.include? expectation
+ return consume if ready_for?(expectation)
+ @error_generator.raise_out_of_order_error expectation.sym
+ end
+
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/proxy.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/proxy.rb
new file mode 100644
index 000000000..03db3b113
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/proxy.rb
@@ -0,0 +1,170 @@
+module Spec
+ module Mocks
+ class Proxy
+ DEFAULT_OPTIONS = {
+ :null_object => false,
+ }
+
+ def initialize(target, name, options={})
+ @target = target
+ @name = name
+ @error_generator = ErrorGenerator.new target, name
+ @expectation_ordering = OrderGroup.new @error_generator
+ @expectations = []
+ @messages_received = []
+ @stubs = []
+ @proxied_methods = []
+ @options = options ? DEFAULT_OPTIONS.dup.merge(options) : DEFAULT_OPTIONS
+ end
+
+ def null_object?
+ @options[:null_object]
+ end
+
+ def add_message_expectation(expected_from, sym, opts={}, &block)
+ __add sym
+ @expectations << MessageExpectation.new(@error_generator, @expectation_ordering, expected_from, sym, block_given? ? block : nil, 1, opts)
+ @expectations.last
+ end
+
+ def add_negative_message_expectation(expected_from, sym, &block)
+ __add sym
+ @expectations << NegativeMessageExpectation.new(@error_generator, @expectation_ordering, expected_from, sym, block_given? ? block : nil)
+ @expectations.last
+ end
+
+ def add_stub(expected_from, sym, opts={})
+ __add sym
+ @stubs.unshift MessageExpectation.new(@error_generator, @expectation_ordering, expected_from, sym, nil, :any, opts)
+ @stubs.first
+ end
+
+ def verify #:nodoc:
+ verify_expectations
+ ensure
+ reset
+ end
+
+ def reset
+ clear_expectations
+ clear_stubs
+ reset_proxied_methods
+ clear_proxied_methods
+ end
+
+ def received_message?(sym, *args, &block)
+ @messages_received.any? {|array| array == [sym, args, block]}
+ end
+
+ def has_negative_expectation?(sym)
+ @expectations.detect {|expectation| expectation.negative_expectation_for?(sym)}
+ end
+
+ def message_received(sym, *args, &block)
+ if expectation = find_matching_expectation(sym, *args)
+ expectation.invoke(args, block)
+ elsif stub = find_matching_method_stub(sym, *args)
+ stub.invoke([], block)
+ elsif expectation = find_almost_matching_expectation(sym, *args)
+ raise_unexpected_message_args_error(expectation, *args) unless has_negative_expectation?(sym) unless null_object?
+ else
+ @target.send :method_missing, sym, *args, &block
+ end
+ end
+
+ def raise_unexpected_message_args_error(expectation, *args)
+ @error_generator.raise_unexpected_message_args_error expectation, *args
+ end
+
+ def raise_unexpected_message_error(sym, *args)
+ @error_generator.raise_unexpected_message_error sym, *args
+ end
+
+ private
+
+ def __add(sym)
+ $rspec_mocks.add(@target) unless $rspec_mocks.nil?
+ define_expected_method(sym)
+ end
+
+ def define_expected_method(sym)
+ if target_responds_to?(sym) && !metaclass.method_defined?(munge(sym))
+ munged_sym = munge(sym)
+ metaclass.instance_eval do
+ alias_method munged_sym, sym if method_defined?(sym.to_s)
+ end
+ @proxied_methods << sym
+ end
+
+ metaclass_eval(<<-EOF, __FILE__, __LINE__)
+ def #{sym}(*args, &block)
+ __mock_proxy.message_received :#{sym}, *args, &block
+ end
+ EOF
+ end
+
+ def target_responds_to?(sym)
+ return @target.send(munge(:respond_to?),sym) if @already_proxied_respond_to
+ return @already_proxied_respond_to = true if sym == :respond_to?
+ return @target.respond_to?(sym)
+ end
+
+ def munge(sym)
+ "proxied_by_rspec__#{sym.to_s}".to_sym
+ end
+
+ def clear_expectations
+ @expectations.clear
+ end
+
+ def clear_stubs
+ @stubs.clear
+ end
+
+ def clear_proxied_methods
+ @proxied_methods.clear
+ end
+
+ def metaclass_eval(str, filename, lineno)
+ metaclass.class_eval(str, filename, lineno)
+ end
+
+ def metaclass
+ (class << @target; self; end)
+ end
+
+ def verify_expectations
+ @expectations.each do |expectation|
+ expectation.verify_messages_received
+ end
+ end
+
+ def reset_proxied_methods
+ @proxied_methods.each do |sym|
+ munged_sym = munge(sym)
+ metaclass.instance_eval do
+ if method_defined?(munged_sym.to_s)
+ alias_method sym, munged_sym
+ undef_method munged_sym
+ else
+ undef_method sym
+ end
+ end
+ end
+ end
+
+ def find_matching_expectation(sym, *args)
+ @expectations.find {|expectation| expectation.matches(sym, args)}
+ end
+
+ def find_almost_matching_expectation(sym, *args)
+ @expectations.find {|expectation| expectation.matches_name_but_not_args(sym, args)}
+ end
+
+ def find_matching_method_stub(sym, *args)
+ @stubs.find {|stub| stub.matches(sym, args)}
+ end
+
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/space.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/space.rb
new file mode 100644
index 000000000..3e13224c7
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/space.rb
@@ -0,0 +1,28 @@
+module Spec
+ module Mocks
+ class Space
+ def add(obj)
+ mocks << obj unless mocks.detect {|m| m.equal? obj}
+ end
+
+ def verify_all
+ mocks.each do |mock|
+ mock.rspec_verify
+ end
+ end
+
+ def reset_all
+ mocks.each do |mock|
+ mock.rspec_reset
+ end
+ mocks.clear
+ end
+
+ private
+
+ def mocks
+ @mocks ||= []
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/mocks/spec_methods.rb b/vendor/gems/rspec-1.1.2/lib/spec/mocks/spec_methods.rb
new file mode 100644
index 000000000..d92a4cedd
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/mocks/spec_methods.rb
@@ -0,0 +1,38 @@
+module Spec
+ module Mocks
+ module ExampleMethods
+ include Spec::Mocks::ArgumentConstraintMatchers
+
+ # Shortcut for creating an instance of Spec::Mocks::Mock.
+ #
+ # +name+ is used for failure reporting, so you should use the
+ # role that the mock is playing in the example.
+ #
+ # +stubs_and_options+ lets you assign options and stub values
+ # at the same time. The only option available is :null_object.
+ # Anything else is treated as a stub value.
+ #
+ # == Examples
+ #
+ # stub_thing = mock("thing", :a => "A")
+ # stub_thing.a == "A" => true
+ #
+ # stub_person = stub("thing", :name => "Joe", :email => "joe@domain.com")
+ # stub_person.name => "Joe"
+ # stub_person.email => "joe@domain.com"
+ def mock(name, stubs_and_options={})
+ Spec::Mocks::Mock.new(name, stubs_and_options)
+ end
+
+ alias :stub :mock
+
+ # Shortcut for creating a mock object that will return itself in response
+ # to any message it receives that it hasn't been explicitly instructed
+ # to respond to.
+ def stub_everything(name = 'stub')
+ mock(name, :null_object => true)
+ end
+
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/rake/spectask.rb b/vendor/gems/rspec-1.1.2/lib/spec/rake/spectask.rb
new file mode 100644
index 000000000..c59e226f5
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/rake/spectask.rb
@@ -0,0 +1,235 @@
+#!/usr/bin/env ruby
+
+# Define a task library for running RSpec contexts.
+
+require 'rake'
+require 'rake/tasklib'
+
+module Spec
+ module Rake
+
+ # A Rake task that runs a set of specs.
+ #
+ # Example:
+ #
+ # Spec::Rake::SpecTask.new do |t|
+ # t.warning = true
+ # t.rcov = true
+ # end
+ #
+ # This will create a task that can be run with:
+ #
+ # rake spec
+ #
+ # If rake is invoked with a "SPEC=filename" command line option,
+ # then the list of spec files will be overridden to include only the
+ # filename specified on the command line. This provides an easy way
+ # to run just one spec.
+ #
+ # If rake is invoked with a "SPEC_OPTS=options" command line option,
+ # then the given options will override the value of the +spec_opts+
+ # attribute.
+ #
+ # If rake is invoked with a "RCOV_OPTS=options" command line option,
+ # then the given options will override the value of the +rcov_opts+
+ # attribute.
+ #
+ # Examples:
+ #
+ # rake spec # run specs normally
+ # rake spec SPEC=just_one_file.rb # run just one spec file.
+ # rake spec SPEC_OPTS="--diff" # enable diffing
+ # rake spec RCOV_OPTS="--aggregate myfile.txt" # see rcov --help for details
+ #
+ # Each attribute of this task may be a proc. This allows for lazy evaluation,
+ # which is sometimes handy if you want to defer the evaluation of an attribute value
+ # until the task is run (as opposed to when it is defined).
+ #
+ # This task can also be used to run existing Test::Unit tests and get RSpec
+ # output, for example like this:
+ #
+ # require 'rubygems'
+ # require 'spec/rake/spectask'
+ # Spec::Rake::SpecTask.new do |t|
+ # t.ruby_opts = ['-rtest/unit']
+ # t.spec_files = FileList['test/**/*_test.rb']
+ # end
+ #
+ class SpecTask < ::Rake::TaskLib
+ class << self
+ def attr_accessor(*names)
+ super(*names)
+ names.each do |name|
+ module_eval "def #{name}() evaluate(@#{name}) end" # Allows use of procs
+ end
+ end
+ end
+
+ # Name of spec task. (default is :spec)
+ attr_accessor :name
+
+ # Array of directories to be added to $LOAD_PATH before running the
+ # specs. Defaults to ['before :each
+ # and after the last after :each
. The use of these is generally discouraged, because it
+ # introduces dependencies between the examples. Still, it might prove useful for very expensive operations
+ # if you know what you are doing.
+ #
+ # == Local helper methods
+ #
+ # You can include local helper methods by simply expressing them within a context:
+ #
+ # describe "..." do
+ #
+ # it "..." do
+ # helper_method
+ # end
+ #
+ # def helper_method
+ # ...
+ # end
+ #
+ # end
+ #
+ # == Included helper methods
+ #
+ # You can include helper methods in multiple contexts by expressing them within
+ # a module, and then including that module in your context:
+ #
+ # module AccountExampleHelperMethods
+ # def helper_method
+ # ...
+ # end
+ # end
+ #
+ # describe "A new account" do
+ # include AccountExampleHelperMethods
+ # before do
+ # @account = Account.new
+ # end
+ #
+ # it "should have a balance of $0" do
+ # helper_method
+ # @account.balance.should eql(Money.new(0, :dollars))
+ # end
+ # end
+ #
+ # == Shared Example Groups
+ #
+ # You can define a shared Example Group, that may be used on other groups
+ #
+ # share_examples_for "All Editions" do
+ # it "all editions behaviour" ...
+ # end
+ #
+ # describe SmallEdition do
+ # it_should_behave_like "All Editions"
+ #
+ # it "should do small edition stuff" do
+ # ...
+ # end
+ # end
+ #
+ # You can also assign the shared group to a module and include that
+ #
+ # share_as :AllEditions do
+ # it "should do all editions stuff" ...
+ # end
+ #
+ # describe SmallEdition do
+ # it_should_behave_like AllEditions
+ #
+ # it "should do small edition stuff" do
+ # ...
+ # end
+ # end
+ #
+ # And, for those of you who prefer to use something more like Ruby, you
+ # can just include the module directly
+ #
+ # describe SmallEdition do
+ # include AllEditions
+ #
+ # it "should do small edition stuff" do
+ # ...
+ # end
+ # end
+ module Runner
+ class << self
+ def configuration # :nodoc:
+ @configuration ||= Spec::Example::Configuration.new
+ end
+
+ # Use this to configure various configurable aspects of
+ # RSpec:
+ #
+ # Spec::Runner.configure do |configuration|
+ # # Configure RSpec here
+ # end
+ #
+ # The yielded configuration object is a
+ # Spec::Example::Configuration instance. See its RDoc
+ # for details about what you can do with it.
+ #
+ def configure
+ yield configuration
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/backtrace_tweaker.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/backtrace_tweaker.rb
new file mode 100644
index 000000000..5fd2fb99f
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/backtrace_tweaker.rb
@@ -0,0 +1,57 @@
+module Spec
+ module Runner
+ class BacktraceTweaker
+ def clean_up_double_slashes(line)
+ line.gsub!('//','/')
+ end
+ end
+
+ class NoisyBacktraceTweaker < BacktraceTweaker
+ def tweak_backtrace(error)
+ return if error.backtrace.nil?
+ error.backtrace.each do |line|
+ clean_up_double_slashes(line)
+ end
+ end
+ end
+
+ # Tweaks raised Exceptions to mask noisy (unneeded) parts of the backtrace
+ class QuietBacktraceTweaker < BacktraceTweaker
+ unless defined?(IGNORE_PATTERNS)
+ root_dir = File.expand_path(File.join(__FILE__, '..', '..', '..', '..'))
+ spec_files = Dir["#{root_dir}/lib/*"].map do |path|
+ subpath = path[root_dir.length..-1]
+ /#{subpath}/
+ end
+ IGNORE_PATTERNS = spec_files + [
+ /\/lib\/ruby\//,
+ /bin\/spec:/,
+ /bin\/rcov:/,
+ /lib\/rspec_on_rails/,
+ /vendor\/rails/,
+ # TextMate's Ruby and RSpec plugins
+ /Ruby\.tmbundle\/Support\/tmruby.rb:/,
+ /RSpec\.tmbundle\/Support\/lib/,
+ /temp_textmate\./,
+ /mock_frameworks\/rspec/,
+ /spec_server/
+ ]
+ end
+
+ def tweak_backtrace(error)
+ return if error.backtrace.nil?
+ error.backtrace.collect! do |line|
+ clean_up_double_slashes(line)
+ IGNORE_PATTERNS.each do |ignore|
+ if line =~ ignore
+ line = nil
+ break
+ end
+ end
+ line
+ end
+ error.backtrace.compact!
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/class_and_arguments_parser.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/class_and_arguments_parser.rb
new file mode 100644
index 000000000..65dc4519c
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/class_and_arguments_parser.rb
@@ -0,0 +1,16 @@
+module Spec
+ module Runner
+ class ClassAndArgumentsParser
+ class << self
+ def parse(s)
+ if s =~ /([a-zA-Z_]+(?:::[a-zA-Z_]+)*):?(.*)/
+ arg = $2 == "" ? nil : $2
+ [$1, arg]
+ else
+ raise "Couldn't parse #{s.inspect}"
+ end
+ end
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/command_line.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/command_line.rb
new file mode 100644
index 000000000..9849c4853
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/command_line.rb
@@ -0,0 +1,28 @@
+require 'spec/runner/option_parser'
+
+module Spec
+ module Runner
+ # Facade to run specs without having to fork a new ruby process (using `spec ...`)
+ class CommandLine
+ class << self
+ # Runs specs. +argv+ is the commandline args as per the spec commandline API, +err+
+ # and +out+ are the streams output will be written to.
+ def run(instance_rspec_options)
+ # NOTE - this call to init_rspec_options is not spec'd, but neither is any of this
+ # swapping of $rspec_options. That is all here to enable rspec to run against itself
+ # and maintain coverage in a single process. Therefore, DO NOT mess with this stuff
+ # unless you know what you are doing!
+ init_rspec_options(instance_rspec_options)
+ orig_rspec_options = rspec_options
+ begin
+ $rspec_options = instance_rspec_options
+ return $rspec_options.run_examples
+ ensure
+ ::Spec.run = true
+ $rspec_options = orig_rspec_options
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/drb_command_line.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/drb_command_line.rb
new file mode 100644
index 000000000..6c340cfea
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/drb_command_line.rb
@@ -0,0 +1,20 @@
+require "drb/drb"
+
+module Spec
+ module Runner
+ # Facade to run specs by connecting to a DRB server
+ class DrbCommandLine
+ # Runs specs on a DRB server. Note that this API is similar to that of
+ # CommandLine - making it possible for clients to use both interchangeably.
+ def self.run(options)
+ begin
+ DRb.start_service
+ spec_server = DRbObject.new_with_uri("druby://localhost:8989")
+ spec_server.run(options.argv, options.error_stream, options.output_stream)
+ rescue DRb::DRbConnError => e
+ options.error_stream.puts "No server is running"
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/example_group_runner.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/example_group_runner.rb
new file mode 100644
index 000000000..7275c6a88
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/example_group_runner.rb
@@ -0,0 +1,59 @@
+module Spec
+ module Runner
+ class ExampleGroupRunner
+ def initialize(options)
+ @options = options
+ end
+
+ def load_files(files)
+ # It's important that loading files (or choosing not to) stays the
+ # responsibility of the ExampleGroupRunner. Some implementations (like)
+ # the one using DRb may choose *not* to load files, but instead tell
+ # someone else to do it over the wire.
+ files.each do |file|
+ load file
+ end
+ end
+
+ def run
+ prepare
+ success = true
+ example_groups.each do |example_group|
+ success = success & example_group.run
+ end
+ return success
+ ensure
+ finish
+ end
+
+ protected
+ def prepare
+ reporter.start(number_of_examples)
+ example_groups.reverse! if reverse
+ end
+
+ def finish
+ reporter.end
+ reporter.dump
+ end
+
+ def reporter
+ @options.reporter
+ end
+
+ def reverse
+ @options.reverse
+ end
+
+ def example_groups
+ @options.example_groups
+ end
+
+ def number_of_examples
+ @options.number_of_examples
+ end
+ end
+ # TODO: BT - Deprecate BehaviourRunner?
+ BehaviourRunner = ExampleGroupRunner
+ end
+end
\ No newline at end of file
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/base_formatter.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/base_formatter.rb
new file mode 100644
index 000000000..c8647cf50
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/base_formatter.rb
@@ -0,0 +1,78 @@
+module Spec
+ module Runner
+ module Formatter
+ # Baseclass for formatters that implements all required methods as no-ops.
+ class BaseFormatter
+ attr_accessor :example_group, :options, :where
+ def initialize(options, where)
+ @options = options
+ @where = where
+ end
+
+ # This method is invoked before any examples are run, right after
+ # they have all been collected. This can be useful for special
+ # formatters that need to provide progress on feedback (graphical ones)
+ #
+ # This method will only be invoked once, and the next one to be invoked
+ # is #add_example_group
+ def start(example_count)
+ end
+
+ # This method is invoked at the beginning of the execution of each example_group.
+ # +name+ is the name of the example_group and +first+ is true if it is the
+ # first example_group - otherwise it's false.
+ #
+ # The next method to be invoked after this is #example_failed or #example_finished
+ def add_example_group(example_group)
+ @example_group = example_group
+ end
+
+ # This method is invoked when an +example+ starts.
+ def example_started(example)
+ end
+
+ # This method is invoked when an +example+ passes.
+ def example_passed(example)
+ end
+
+ # This method is invoked when an +example+ fails, i.e. an exception occurred
+ # inside it (such as a failed should or other exception). +counter+ is the
+ # sequence number of the failure (starting at 1) and +failure+ is the associated
+ # Failure object.
+ def example_failed(example, counter, failure)
+ end
+
+ # This method is invoked when an example is not yet implemented (i.e. has not
+ # been provided a block), or when an ExamplePendingError is raised.
+ # +message+ is the message from the ExamplePendingError, if it exists, or the
+ # default value of "Not Yet Implemented"
+ def example_pending(example_group_description, example, message)
+ end
+
+ # This method is invoked after all of the examples have executed. The next method
+ # to be invoked after this one is #dump_failure (once for each failed example),
+ def start_dump
+ end
+
+ # Dumps detailed information about an example failure.
+ # This method is invoked for each failed example after all examples have run. +counter+ is the sequence number
+ # of the associated example. +failure+ is a Failure object, which contains detailed
+ # information about the failure.
+ def dump_failure(counter, failure)
+ end
+
+ # This method is invoked after the dumping of examples and failures.
+ def dump_summary(duration, example_count, failure_count, pending_count)
+ end
+
+ # This gets invoked after the summary if option is set to do so.
+ def dump_pending
+ end
+
+ # This method is invoked at the very end. Allows the formatter to clean up, like closing open streams.
+ def close
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/base_text_formatter.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/base_text_formatter.rb
new file mode 100644
index 000000000..859b2641d
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/base_text_formatter.rb
@@ -0,0 +1,130 @@
+require 'spec/runner/formatter/base_formatter'
+
+module Spec
+ module Runner
+ module Formatter
+ # Baseclass for text-based formatters. Can in fact be used for
+ # non-text based ones too - just ignore the +output+ constructor
+ # argument.
+ class BaseTextFormatter < BaseFormatter
+ attr_reader :output, :pending_examples
+ # Creates a new instance that will write to +where+. If +where+ is a
+ # String, output will be written to the File with that name, otherwise
+ # +where+ is exected to be an IO (or an object that responds to #puts and #write).
+ def initialize(options, where)
+ super
+ if where.is_a?(String)
+ @output = File.open(where, 'w')
+ elsif where == STDOUT
+ @output = Kernel
+ def @output.flush
+ STDOUT.flush
+ end
+ else
+ @output = where
+ end
+ @pending_examples = []
+ end
+
+ def example_pending(example_group_description, example, message)
+ @pending_examples << ["#{example_group_description} #{example.description}", message]
+ end
+
+ def dump_failure(counter, failure)
+ @output.puts
+ @output.puts "#{counter.to_s})"
+ @output.puts colourise("#{failure.header}\n#{failure.exception.message}", failure)
+ @output.puts format_backtrace(failure.exception.backtrace)
+ @output.flush
+ end
+
+ def colourise(s, failure)
+ if(failure.expectation_not_met?)
+ red(s)
+ elsif(failure.pending_fixed?)
+ blue(s)
+ else
+ magenta(s)
+ end
+ end
+
+ def dump_summary(duration, example_count, failure_count, pending_count)
+ return if dry_run?
+ @output.puts
+ @output.puts "Finished in #{duration} seconds"
+ @output.puts
+
+ summary = "#{example_count} example#{'s' unless example_count == 1}, #{failure_count} failure#{'s' unless failure_count == 1}"
+ summary << ", #{pending_count} pending" if pending_count > 0
+
+ if failure_count == 0
+ if pending_count > 0
+ @output.puts yellow(summary)
+ else
+ @output.puts green(summary)
+ end
+ else
+ @output.puts red(summary)
+ end
+ @output.flush
+ end
+
+ def dump_pending
+ unless @pending_examples.empty?
+ @output.puts
+ @output.puts "Pending:"
+ @pending_examples.each do |pending_example|
+ @output.puts "#{pending_example[0]} (#{pending_example[1]})"
+ end
+ end
+ @output.flush
+ end
+
+ def close
+ if IO === @output
+ @output.close
+ end
+ end
+
+ def format_backtrace(backtrace)
+ return "" if backtrace.nil?
+ backtrace.map { |line| backtrace_line(line) }.join("\n")
+ end
+
+ protected
+
+ def colour?
+ @options.colour ? true : false
+ end
+
+ def dry_run?
+ @options.dry_run ? true : false
+ end
+
+ def backtrace_line(line)
+ line.sub(/\A([^:]+:\d+)$/, '\\1:')
+ end
+
+ def colour(text, colour_code)
+ return text unless colour? && output_to_tty?
+ "#{colour_code}#{text}\e[0m"
+ end
+
+ def output_to_tty?
+ begin
+ @output == Kernel || @output.tty?
+ rescue NoMethodError
+ false
+ end
+ end
+
+ def green(text); colour(text, "\e[32m"); end
+ def red(text); colour(text, "\e[31m"); end
+ def magenta(text); colour(text, "\e[35m"); end
+ def yellow(text); colour(text, "\e[33m"); end
+ def blue(text); colour(text, "\e[34m"); end
+
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/failing_example_groups_formatter.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/failing_example_groups_formatter.rb
new file mode 100644
index 000000000..5a4607983
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/failing_example_groups_formatter.rb
@@ -0,0 +1,31 @@
+require 'spec/runner/formatter/base_text_formatter'
+
+module Spec
+ module Runner
+ module Formatter
+ class FailingExampleGroupsFormatter < BaseTextFormatter
+ def add_example_group(example_group)
+ super
+ @example_group_description_parts = example_group.description_parts
+ end
+
+ def example_failed(example, counter, failure)
+ if @example_group_description_parts
+ description_parts = @example_group_description_parts.collect do |description|
+ description =~ /(.*) \(druby.*\)$/ ? $1 : description
+ end
+ @output.puts ::Spec::Example::ExampleGroupMethods.description_text(*description_parts)
+ @output.flush
+ @example_group_description_parts = nil
+ end
+ end
+
+ def dump_failure(counter, failure)
+ end
+
+ def dump_summary(duration, example_count, failure_count, pending_count)
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/failing_examples_formatter.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/failing_examples_formatter.rb
new file mode 100644
index 000000000..e3a271c8b
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/failing_examples_formatter.rb
@@ -0,0 +1,20 @@
+require 'spec/runner/formatter/base_text_formatter'
+
+module Spec
+ module Runner
+ module Formatter
+ class FailingExamplesFormatter < BaseTextFormatter
+ def example_failed(example, counter, failure)
+ @output.puts "#{example_group.description} #{example.description}"
+ @output.flush
+ end
+
+ def dump_failure(counter, failure)
+ end
+
+ def dump_summary(duration, example_count, failure_count, pending_count)
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/html_formatter.rb b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/html_formatter.rb
new file mode 100644
index 000000000..ad153c8dc
--- /dev/null
+++ b/vendor/gems/rspec-1.1.2/lib/spec/runner/formatter/html_formatter.rb
@@ -0,0 +1,333 @@
+require 'erb'
+require 'spec/runner/formatter/base_text_formatter'
+
+module Spec
+ module Runner
+ module Formatter
+ class HtmlFormatter < BaseTextFormatter
+ include ERB::Util # for the #h method
+
+ def initialize(options, output)
+ super
+ @current_example_group_number = 0
+ @current_example_number = 0
+ end
+
+ # The number of the currently running example_group
+ def current_example_group_number
+ @current_example_group_number
+ end
+
+ # The number of the currently running example (a global counter)
+ def current_example_number
+ @current_example_number
+ end
+
+ def start(example_count)
+ @example_count = example_count
+
+ @output.puts html_header
+ @output.puts report_header
+ @output.flush
+ end
+
+ def add_example_group(example_group)
+ super
+ @example_group_red = false
+ @example_group_red = false
+ @current_example_group_number += 1
+ unless current_example_group_number == 1
+ @output.puts " "
+ @output.puts ""
+ end
+ @output.puts "#{format_backtrace(failure.exception.backtrace)}
#{@snippet_extractor.snippet(failure.exception)}
"
+ end
+
+ def move_progress
+ @output.puts " "
+ @output.flush
+ end
+
+ def percent_done
+ result = 100.0
+ if @example_count != 0
+ result = ((current_example_number).to_f / @example_count.to_f * 1000).to_i / 10.0
+ end
+ result
+ end
+
+ def dump_failure(counter, failure)
+ end
+
+ def dump_summary(duration, example_count, failure_count, pending_count)
+ if dry_run?
+ totals = "This was a dry-run"
+ else
+ totals = "#{example_count} example#{'s' unless example_count == 1}, #{failure_count} failure#{'s' unless failure_count == 1}"
+ totals << ", #{pending_count} pending" if pending_count > 0
+ end
+ @output.puts ""
+ @output.puts ""
+ @output.puts ""
+ @output.puts ""
+ @output.puts "