diff --git a/.gitignore b/.gitignore
index 253b985..1477e15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
test/system/build
-test/system/generated
\ No newline at end of file
+test/system/generated
+*.sublime-project
+Gemfile.lock
\ No newline at end of file
diff --git a/test/spec/cmock_file_writer_spec.rb b/test/spec/cmock_file_writer_spec.rb
index 241a2c7..fb327f4 100644
--- a/test/spec/cmock_file_writer_spec.rb
+++ b/test/spec/cmock_file_writer_spec.rb
@@ -5,6 +5,7 @@ require 'cmock_file_writer'
describe CMockFileWriter do
before do
@cmConfig = Object.new
+
#create instance of class under test
@subject = CMockFileWriter.new(@cmConfig)
end
@@ -17,9 +18,28 @@ describe CMockFileWriter do
end
describe 'create_file' do
- it "complain if a block was not specified when calling create" do
+
+ it "should complain if a block was not specified when calling create" do
expect {@subject.create_file("text.txt")}.should raise_error
# should.be_false
end
+
+ it "should perform block on new file" do
+ # mock(@cmConfig).enforce_strict_ordering {false}
+ mock(@cmConfig).mock_path {"testPath"}
+ mock(@cmConfig).mock_path {"testPath"}
+
+ FakeFile = Object.new
+ mock(File).open("testPath/test.txt.new", "w").yields(FakeFile, "test.txt")
+ mock(FakeFile).write("hello world"){nil}
+
+ mock(File).exist?("testPath/test.txt") {true}
+ mock(FileUtils).rm("testPath/test.txt")
+ mock(FileUtils).cp("testPath/test.txt.new", "testPath/test.txt")
+ mock(FileUtils).rm("testPath/test.txt.new")
+ # Call function under test
+ @subject.create_file("test.txt") {|f| f.write("hello world")}
+ end
+
end
end
diff --git a/test/spec/cmock_generator_plugin_array_spec.rb b/test/spec/cmock_generator_plugin_array_spec.rb
new file mode 100644
index 0000000..c706acd
--- /dev/null
+++ b/test/spec/cmock_generator_plugin_array_spec.rb
@@ -0,0 +1,52 @@
+here = File.expand_path(File.dirname(__FILE__))
+require "#{here}/spec_helper" #add this to execute tests from the spec directory
+require 'cmock_generator_plugin_array'
+
+describe :CMockGeneratorPluginArray do
+ before do
+ @cmConfig = Object.new
+ @cmUtils = Object.new
+ mock(@cmConfig).when_ptr {:compare_data}
+ mock(@cmConfig).enforce_strict_ordering {false}
+ mock(@cmUtils).helpers { {} }
+ #create instance of class under test
+ @subject = CMockGeneratorPluginArray.new(@cmConfig, @cmUtils)
+ end
+
+ it "should not respond to include_files" do
+ # @subject.should_not respond_to(:include_files)
+ end
+
+ # it "should not add to typedef structure for functions of " +
+ # "style 'int* func(void)'" do
+ # function = {:name => "Oak", :args => [], :return => :int_ptr}
+ # returned = @subject.instance_typedefs(function)
+ # returned.should == ""
+ # end
+
+ # it "should add to typedef structure mock needs of functions of style "+
+ # "'void func(int chicken, int* pork)'" do
+ # arg1 = { :name => "chicken", :type => "int", :ptr? => false}
+ # arg2 = { :name => "pork", :type => "int*", :ptr? => true}
+ # function = {:name => "Cedar",
+ # :args => [arg1, arg2],
+ # :return => :void}
+ # expected = " int Expected_pork_Depth;\n"
+ # returned = @subject.instance_typedefs(function)
+ # returned.should == expected
+ # end
+
+ # it "should not add an additional mock interface for functions not containing pointers" do
+ # function = {:name => "Maple", :args_string => "int blah", :return => :string,
+ # :contains_ptr? => false}
+ # returned = @subject.mock_function_declarations(function)
+ # returned.should_be nil
+ # end
+
+ # describe 'create_file' do
+ # it "complain if a block was not specified when calling create" do
+ # expect {@subject.create_file("text.txt")}.should raise_error
+ # # should.be_false
+ # end
+ # end
+end
diff --git a/vendor/c_exception b/vendor/c_exception
index b54605d..0571b99 160000
--- a/vendor/c_exception
+++ b/vendor/c_exception
@@ -1 +1 @@
-Subproject commit b54605d9f98289132c3ed6279f2d2f4815a53017
+Subproject commit 0571b990b67b750bb597dd71d510ef3e5289f619
diff --git a/vendor/hardmock/.gitignore b/vendor/hardmock/.gitignore
new file mode 100644
index 0000000..905a8ef
--- /dev/null
+++ b/vendor/hardmock/.gitignore
@@ -0,0 +1,2 @@
+tags
+/pkg/*
diff --git a/vendor/hardmock/CHANGES b/vendor/hardmock/CHANGES
index 4b5184c..5dc7c5f 100644
--- a/vendor/hardmock/CHANGES
+++ b/vendor/hardmock/CHANGES
@@ -1,3 +1,8 @@
+Hardmock 1.3.8
+
+* Ruby 1.9 compatibility: patched stubbing module and tests to get Hardmock working in Ruby 1.9.2 and MiniTest
+* FINAL VERSION OF HARDMOCK -- see Readme
+
Hardmock 1.3.7
* BUG FIX: expects! could not setup expectations for more than one concrete method on an object, since the method aliasing and rewriting was only taking place when the background mock instance was first created. This logic has been updated and now you can do all the things you'd expect.
diff --git a/vendor/hardmock/README b/vendor/hardmock/README.rdoc
similarity index 67%
rename from vendor/hardmock/README
rename to vendor/hardmock/README.rdoc
index 4650a2a..ec0a740 100644
--- a/vendor/hardmock/README
+++ b/vendor/hardmock/README.rdoc
@@ -2,7 +2,16 @@
Strict, ordered mock objects using very lightweight syntax in your tests.
-== How
+== DISCONTINUED
+
+After release 1.3.8, Hardmock will not be actively maintained.
+(1.3.8 is a Ruby 1.9/MiniTest compatibility update, see below).
+
+Atomic Object still believes in (and heavily utilizes) mock objects and interaction-based unit testing, however, we ourselves have begun leveraging other popular mocking tools such as RSpec, RR, Mocha, etc.
+
+For those of you with time invested in older projects using Hardmock, but who need to migrate their older projects to Ruby 1.9, try updating to Hardmock 1.3.8.
+
+== How to use Hardmock
The basic procedure for using Hardmock in your tests is:
@@ -40,11 +49,10 @@ Expects @garage.open_door, @car.start(:choke) and @car.dri
== Download and Install
-* Homepage: http://hardmock.rubyforge.org
-* GEM or TGZ or ZIP: http://rubyforge.org/frs/?group_id=2742
-* Rails plugin: script/plugin install
-* SVN access: svn co svn://rubyforge.org/var/svn/hardmock/trunk
-* Developer SVN access: svn co svn://developername@rubyforge.org/var/svn/hardmock/trunk
+* Install: gem install hardmock
+* Homepage: http://atomicobject.github.com/hardmock
+* Rubygems.org: http://rubygems.org/gems/hardmock
+* API documentation: http://rubydoc.info/gems/hardmock/frames
== Setup for Test::Unit
@@ -65,6 +73,12 @@ Get this into your spec helper or environment or Rakefile or wherever you prefer
This puts the implicit conveniences into your spec context, like "create_mocks" etc, and also provides for automatic
"verify_mocks" after each Example is run.
+== Ruby 1.9 Compatibility
+
+As of build 1.3.8, Hardmock works in Ruby 1.9.2. Older versions of Hardmock had non-1.9 compatible code; furthermore, 1.9 ships with MiniTest, which is similar to TestUnit but has different implementation internals, which we monkey-patch.
+
== Author
+
* David Crosby crosby at http://atomicobject.com
-* (c) 2006,2007 Atomic Object LLC
+* (c) 2006-2011 Atomic Object LLC
+
diff --git a/vendor/hardmock/Rakefile b/vendor/hardmock/Rakefile
index aff126c..1777b41 100644
--- a/vendor/hardmock/Rakefile
+++ b/vendor/hardmock/Rakefile
@@ -1,7 +1,7 @@
require 'rake'
require 'rubygems'
-HARDMOCK_VERSION = "1.3.7"
+HARDMOCK_VERSION = "1.3.8"
Dir["rake_tasks/*.rake"].each { |f| load f }
diff --git a/vendor/hardmock/TODO b/vendor/hardmock/TODO
new file mode 100644
index 0000000..308d857
--- /dev/null
+++ b/vendor/hardmock/TODO
@@ -0,0 +1,24 @@
+Wed Jan 5 01:50:24 EST 2011
+crosby
+
+Hardmock is being "finalized"... Atomic probably won't be maintaining or building on this library beyond v1.3.8
+
+Thu Dec 6 13:09:48 EST 2007
+crosby
+
+Sample from Crowley regarding "should" in rspec:
+
+i like:
+ @physical_layout_resource_type_panel_decorator.add_resource(@view_mock, @resource_type_panel_mock, @resource_mock, @resource_type_mock).should eql(the_hard_mock)
+
+ i had to:
+ component = @physical_layout_resource_type_panel_decorator.add_resource @view_mock, @resource_type_panel_mock, @resource_mock, @resource_type_mock
+ (component == @component_mock).should be_true
+
+Sun Dec 10 09:15:26 EST 2006
+crosby
+
+TODO: MAYBE
+* Remove method_cleanout on mocks?; prefer instead to use explicit method overriding like this: @my_mock.expects('to_s').returns('bogus output')
+* Mock actual methods on actual objects or classes or modules?
+* Achieve clarity on "yields"
diff --git a/vendor/hardmock/init.rb b/vendor/hardmock/init.rb
new file mode 100644
index 0000000..5fb5408
--- /dev/null
+++ b/vendor/hardmock/init.rb
@@ -0,0 +1,6 @@
+# This file allows Hardmock to be used as a rails plugin
+
+if RAILS_ENV == 'test'
+ require 'hardmock'
+ require 'assert_error'
+end
diff --git a/vendor/hardmock/lib/hardmock/mock_control.rb b/vendor/hardmock/lib/hardmock/mock_control.rb
index 302ebce..cd661ef 100644
--- a/vendor/hardmock/lib/hardmock/mock_control.rb
+++ b/vendor/hardmock/lib/hardmock/mock_control.rb
@@ -38,7 +38,6 @@ module Hardmock
end
def verify
-# puts "MockControl #{self.object_id.to_s(16)} verify: happy? #{happy?}"
@disappointed = !happy?
raise VerifyError.new("Unmet expectations", @expectations) unless happy?
end
diff --git a/vendor/hardmock/lib/hardmock/stubbing.rb b/vendor/hardmock/lib/hardmock/stubbing.rb
index 0f8a293..a03a00b 100644
--- a/vendor/hardmock/lib/hardmock/stubbing.rb
+++ b/vendor/hardmock/lib/hardmock/stubbing.rb
@@ -86,9 +86,8 @@ module Hardmock
stubbed_method = Hardmock::StubbedMethod.new(self, method_name)
-
unless _is_mock? or already_stubbed
- if methods.include?(method_name.to_s)
+ if methods.map do |m| m.to_s end.include?(method_name)
hm_meta_eval do
alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym
end
@@ -116,7 +115,7 @@ module Hardmock
Hardmock::ReplacedMethod.new(self, method_name)
# Preserver original implementation of the method by aliasing it away
- if methods.include?(method_name)
+ if methods.map do |m| m.to_s end.include?(method_name.to_s)
hm_meta_eval do
alias_method "_hardmock_original_#{method_name}".to_sym, method_name.to_sym
end
@@ -194,7 +193,7 @@ module Hardmock
all_replaced_methods.each do |replaced|
unless replaced.target._is_mock?
backed_up = "_hardmock_original_#{replaced.method_name}"
- if replaced.target.methods.include?(backed_up)
+ if replaced.target.methods.map do |m| m.to_s end.include?(backed_up)
replaced.target.hm_meta_eval do
alias_method replaced.method_name.to_sym, backed_up.to_sym
end
diff --git a/vendor/hardmock/lib/test_unit_before_after.rb b/vendor/hardmock/lib/test_unit_before_after.rb
index 0499e39..1698fe7 100644
--- a/vendor/hardmock/lib/test_unit_before_after.rb
+++ b/vendor/hardmock/lib/test_unit_before_after.rb
@@ -79,34 +79,80 @@ module Test #:nodoc:#
end
end
- # OVERRIDE: This is a reimplementation of the default "run", updated to
- # execute actions after teardown.
- def run(result)
- yield(STARTED, name)
- @_result = result
- begin
- execute_pre_setup_actions(self)
- setup
- __send__(@method_name)
- rescue Test::Unit::AssertionFailedError => e
- add_failure(e.message, auxiliary_backtrace_filter(e.backtrace))
- rescue Exception
- raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat
- add_error($!)
- ensure
+ if RUBY_VERSION =~ /^1\.8/
+ # OVERRIDE FOR RUBY 1.8.x: This is a reimplementation of the default "run", updated to
+ # execute actions after teardown.
+ # Only the lines marked with ** are different from the 1.8
+ # implementation of TestCase#run.
+ def run(result)
+ yield(STARTED, name)
+ @_result = result
begin
- teardown
+ execute_pre_setup_actions(self) # ** Added to support TestCaseBeforeAfter
+ setup
+ __send__(@method_name)
rescue Test::Unit::AssertionFailedError => e
add_failure(e.message, auxiliary_backtrace_filter(e.backtrace))
rescue Exception
raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat
add_error($!)
ensure
- execute_post_teardown_actions(self)
+ begin
+ teardown
+ rescue Test::Unit::AssertionFailedError => e
+ add_failure(e.message, auxiliary_backtrace_filter(e.backtrace))
+ rescue Exception
+ raise if should_passthru_exception($!) # See implementation; this is for pre-1.8.6 compat
+ add_error($!)
+ ensure
+ execute_post_teardown_actions(self) # ** Added to support TestCaseBeforeAfter
+ end
end
+ result.add_run
+ yield(FINISHED, name)
+ end
+
+ elsif RUBY_VERSION =~ /^1\.9/
+
+ # OVERRIDE FOR RUBY 1.9.x: This is a reimplementation of the default "run", updated to
+ # support execution of actions before setup after teardown.
+ # Only the lines marked with ** are different from the MiniTest implementation of TestCase#run.
+ # (Ruby 1.9 ships with MiniTest which is similar to TestUnit in structure but
+ # with a different implementation of TestCase#run)
+ def run runner
+ trap 'INFO' do
+ warn '%s#%s %.2fs' % [self.class, self.__name__,
+ (Time.now - runner.start_time)]
+ runner.status $stderr
+ end if SUPPORTS_INFO_SIGNAL
+
+ result = '.'
+ begin
+ @passed = nil
+ execute_pre_setup_actions(self, runner) # ** Added to support TestCaseBeforeAfter
+ self.setup
+ self.__send__ self.__name__
+ @passed = true
+ rescue *PASSTHROUGH_EXCEPTIONS
+ raise
+ rescue Exception => e
+ @passed = false
+ result = runner.puke(self.class, self.__name__, e)
+ ensure
+ begin
+ self.teardown
+ rescue *PASSTHROUGH_EXCEPTIONS
+ raise
+ rescue Exception => e
+ result = runner.puke(self.class, self.__name__, e)
+ ensure
+ result2 = execute_post_teardown_actions(self, runner) # ** Added to support TestCaseBeforeAfter
+ #result ||= result2
+ end
+ trap 'INFO', 'DEFAULT' if SUPPORTS_INFO_SIGNAL
+ end
+ result
end
- result.add_run
- yield(FINISHED, name)
end
private
@@ -114,31 +160,42 @@ module Test #:nodoc:#
# Run through the after_teardown actions, treating failures and errors
# in the same way that "run" does: they are reported, and the remaining
# actions are executed.
- def execute_post_teardown_actions(test_instance)
- self.class.post_teardown_actions.each do |action|
- begin
- action.call test_instance
- rescue Test::Unit::AssertionFailedError => e
- add_failure(e.message, auxiliary_backtrace_filter(e.backtrace))
- rescue Exception
- raise if should_passthru_exception($!)
- add_error($!)
+ if RUBY_VERSION =~ /^1\.8/
+ def execute_post_teardown_actions(test_instance)
+ self.class.post_teardown_actions.each do |action|
+ begin
+ action.call test_instance
+ rescue Test::Unit::AssertionFailedError => e
+ add_failure(e.message, auxiliary_backtrace_filter(e.backtrace))
+ rescue Exception
+ raise if should_passthru_exception($!)
+ add_error($!)
+ end
end
end
end
+
+ if RUBY_VERSION =~ /^1\.9/
+ def execute_post_teardown_actions(test_instance, runner)
+ result = nil
+ self.class.post_teardown_actions.each do |action|
+ begin
+ action.call test_instance
+ rescue *PASSTHROUGH_EXCEPTIONS
+ raise
+ rescue Exception => e
+ result = runner.puke(self.class, self.__name__, e)
+ end
+ end
+ result
+ end
+ end
# Run through the before_setup actions.
# Failures or errors cause execution to stop.
- def execute_pre_setup_actions(test_instance)
+ def execute_pre_setup_actions(test_instance,runner=nil)
self.class.pre_setup_actions.each do |action|
-# begin
- action.call test_instance
-# rescue Test::Unit::AssertionFailedError => e
-# add_failure(e.message, auxiliary_backtrace_filter(e.backtrace))
-# rescue Exception
-# raise if should_passthru_exception($!)
-# add_error($!)
-# end
+ action.call test_instance
end
end
diff --git a/vendor/hardmock/rake_tasks/ci.rake b/vendor/hardmock/rake_tasks/ci.rake
new file mode 100644
index 0000000..2e99127
--- /dev/null
+++ b/vendor/hardmock/rake_tasks/ci.rake
@@ -0,0 +1,5 @@
+
+namespace :ci do
+ desc "Continuous integration target"
+ task :continuous => [ 'rcov:coverage' ]
+end
diff --git a/vendor/hardmock/rake_tasks/gem.rake b/vendor/hardmock/rake_tasks/gem.rake
new file mode 100644
index 0000000..d27d505
--- /dev/null
+++ b/vendor/hardmock/rake_tasks/gem.rake
@@ -0,0 +1,39 @@
+require 'rake/gempackagetask'
+require File.expand_path(File.dirname(__FILE__) + "/rdoc_options.rb")
+
+namespace :gem do
+
+ gem_spec = Gem::Specification.new do | s |
+ s.name = "hardmock"
+ s.version = HARDMOCK_VERSION
+ s.author = "David Crosby"
+ s.email = "crosby@atomicobject.com"
+ s.platform = Gem::Platform::RUBY
+ s.summary = "A strict, ordered, expectation-oriented mock object library. DISCONTINUED AS OF JAN 2011, see Readme"
+ s.rubyforge_project = 'hardmock'
+ s.homepage = "http://atomicobject.github.com/hardmock"
+ s.autorequire = 'hardmock'
+
+ s.files = FileList[
+ '{lib,test}/**/*.rb',
+ 'Rakefile',
+ 'config/environment.rb',
+ "rake_tasks/rdoc_options.rb",
+ "rake_tasks/rdoc.rake",
+ "rake_tasks/test.rake",
+ ]
+
+ s.require_path = "lib"
+ s.test_files = Dir.glob("test/**/*test.rb")
+
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README.rdoc","CHANGES","LICENSE"]
+ add_rdoc_options(s.rdoc_options)
+ end
+
+ Rake::GemPackageTask.new(gem_spec) do |pkg|
+ pkg.need_zip = true
+ pkg.need_tar = true
+ end
+
+end
diff --git a/vendor/hardmock/rake_tasks/rcov.rake b/vendor/hardmock/rake_tasks/rcov.rake
new file mode 100644
index 0000000..5e47136
--- /dev/null
+++ b/vendor/hardmock/rake_tasks/rcov.rake
@@ -0,0 +1,23 @@
+
+
+namespace :rcov do
+
+ begin
+
+ require 'rcov/rcovtask'
+ desc "Generate code coverage HTML report in pkg/coverage"
+ Rcov::RcovTask.new(:coverage) do |t|
+ t.test_files = FileList['test/unit/**/*.rb'] + FileList['test/functional/**/*.rb']
+ t.verbose = true
+ t.output_dir = "coverage"
+ end
+
+ rescue LoadError
+
+ task :coverage => [ "test:all" ] do
+ puts "(rcov:coverage is disabled because rcov not installed)"
+ end
+
+ end
+
+end
diff --git a/vendor/hardmock/rake_tasks/rdoc.rake b/vendor/hardmock/rake_tasks/rdoc.rake
index 6a6d79f..a26e372 100644
--- a/vendor/hardmock/rake_tasks/rdoc.rake
+++ b/vendor/hardmock/rake_tasks/rdoc.rake
@@ -8,7 +8,7 @@ namespace :doc do
rdoc.rdoc_dir = 'doc'
rdoc.title = "Hardmock: Strict expectation-based mock object library "
add_rdoc_options(rdoc.options)
- rdoc.rdoc_files.include('lib/**/*.rb', 'README','CHANGES','LICENSE')
+ rdoc.rdoc_files.include('lib/**/*.rb', 'README.rdoc','CHANGES','LICENSE')
}
task :show => [ 'doc:rerdoc' ] do
diff --git a/vendor/hardmock/rake_tasks/rdoc_options.rb b/vendor/hardmock/rake_tasks/rdoc_options.rb
index 85bf4ce..f2b6dbf 100644
--- a/vendor/hardmock/rake_tasks/rdoc_options.rb
+++ b/vendor/hardmock/rake_tasks/rdoc_options.rb
@@ -1,4 +1,4 @@
def add_rdoc_options(options)
- options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'Hardmock'
+ options << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc' << '--title' << 'Hardmock'
end
diff --git a/vendor/hardmock/test/functional/assert_error_test.rb b/vendor/hardmock/test/functional/assert_error_test.rb
index e4b35cf..79fc51d 100644
--- a/vendor/hardmock/test/functional/assert_error_test.rb
+++ b/vendor/hardmock/test/functional/assert_error_test.rb
@@ -2,6 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
require 'assert_error'
class AssertErrorTest < Test::Unit::TestCase
+ TEST_FAILURE = nil
+ if RUBY_VERSION =~ /^1\.8/
+ TEST_FAILURE = Test::Unit::AssertionFailedError
+ elsif RUBY_VERSION =~ /^1\.9/
+ TEST_FAILURE = MiniTest::Assertion
+ end
it "specfies an error type and message that should be raised" do
assert_error RuntimeError, "Too funky" do
@@ -10,7 +16,7 @@ class AssertErrorTest < Test::Unit::TestCase
end
it "flunks if the error message is wrong" do
- err = assert_raise Test::Unit::AssertionFailedError do
+ err = assert_raise TEST_FAILURE do
assert_error RuntimeError, "not good" do
raise RuntimeError.new("Too funky")
end
@@ -20,7 +26,7 @@ class AssertErrorTest < Test::Unit::TestCase
end
it "flunks if the error type is wrong" do
- err = assert_raise Test::Unit::AssertionFailedError do
+ err = assert_raise TEST_FAILURE do
assert_error StandardError, "Too funky" do
raise RuntimeError.new("Too funky")
end
@@ -36,7 +42,8 @@ class AssertErrorTest < Test::Unit::TestCase
end
it "flunks if the error message doesn't match all the Regexps" do
- err = assert_raise Test::Unit::AssertionFailedError do
+ #err = assert_raise Test::Unit::AssertionFailedError do
+ err = assert_raise TEST_FAILURE do
assert_error StandardError, /way/i, /too/i, /funky/i do
raise StandardError.new("Too funky")
end
diff --git a/vendor/hardmock/test/unit/expectation_test.rb b/vendor/hardmock/test/unit/expectation_test.rb
index 54bd204..e816bed 100644
--- a/vendor/hardmock/test/unit/expectation_test.rb
+++ b/vendor/hardmock/test/unit/expectation_test.rb
@@ -251,8 +251,12 @@ class ExpectationTest < Test::Unit::TestCase
err = assert_raise ExpectationError do
se.apply_method_call(@mock,'each_bean',[:side_slot],a_block)
end
+
+ expected_arity = "-1"
+ expected_arity = "0" if RUBY_VERSION =~ /^1\.9/
+
assert_match(/wont_fit/i, err.message)
- assert_match(/arity -1/i, err.message)
+ assert_match(/arity #{expected_arity}/i, err.message)
assert_equal [], things, "Wrong things"
end
diff --git a/vendor/hardmock/test/unit/method_cleanout_test.rb b/vendor/hardmock/test/unit/method_cleanout_test.rb
index 7aa6293..6902f62 100644
--- a/vendor/hardmock/test/unit/method_cleanout_test.rb
+++ b/vendor/hardmock/test/unit/method_cleanout_test.rb
@@ -11,12 +11,14 @@ class MethodCleanoutTest < Test::Unit::TestCase
@victim = Victim.new
end
- def test_should_remove_most_methods_from_a_class
- expect_removed = Victim::OriginalMethods.reject { |m|
- Hardmock::MethodCleanout::SACRED_METHODS.include?(m)
- }
- expect_removed.each do |m|
- assert !@victim.respond_to?(m), "should not have method #{m}"
+ if RUBY_VERSION =~ /^1\.8/
+ def test_should_remove_most_methods_from_a_class
+ expect_removed = Victim::OriginalMethods.reject { |m|
+ Hardmock::MethodCleanout::SACRED_METHODS.include?(m)
+ }
+ expect_removed.each do |m|
+ assert !@victim.respond_to?(m), "should not have method #{m}"
+ end
end
end
diff --git a/vendor/hardmock/test/unit/test_unit_before_after_test.rb b/vendor/hardmock/test/unit/test_unit_before_after_test.rb
index 172f527..fdddd0c 100644
--- a/vendor/hardmock/test/unit/test_unit_before_after_test.rb
+++ b/vendor/hardmock/test/unit/test_unit_before_after_test.rb
@@ -6,6 +6,8 @@ class TestUnitBeforeAfter < Test::Unit::TestCase
# after_teardown
#
+ USING_RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
+
it "adds TestCase.after_teardown hook for appending post-teardown actions" do
write_and_run_test :use_after_teardown => true
@@ -21,16 +23,28 @@ class TestUnitBeforeAfter < Test::Unit::TestCase
should "execute all after_teardowns, even if the main teardown flunks" do
write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true
- see_in_order "Loaded suite",
- "THE SETUP",
- "A TEST",
- "F",
- "1st after_teardown",
- "2nd after_teardown",
- "Finished in",
- "1) Failure:",
- "test_something(MyExampleTest) [_test_file_temp.rb:20]:",
- "FLUNK IN TEARDOWN"
+ if USING_RUBY_1_9
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A TEST",
+ "1st after_teardown",
+ "2nd after_teardown",
+ "Finished in",
+ "1) Failure:",
+ "test_something(MyExampleTest) [_test_file_temp.rb:20]:",
+ "FLUNK IN TEARDOWN"
+ else
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A TEST",
+ "F",
+ "1st after_teardown",
+ "2nd after_teardown",
+ "Finished in",
+ "1) Failure:",
+ "test_something(MyExampleTest) [_test_file_temp.rb:20]:",
+ "FLUNK IN TEARDOWN"
+ end
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
end
@@ -54,7 +68,6 @@ class TestUnitBeforeAfter < Test::Unit::TestCase
"A TEST",
"THE TEARDOWN",
"1st after_teardown",
- "F",
"2nd after_teardown",
"Finished in",
"1) Failure:",
@@ -68,16 +81,28 @@ class TestUnitBeforeAfter < Test::Unit::TestCase
should "execute all after_teardowns, even if some of them explode" do
write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true
- see_in_order "Loaded suite",
- "THE SETUP",
- "A TEST",
- "THE TEARDOWN",
- "1st after_teardown",
- "E",
- "2nd after_teardown",
- "Finished in",
- "RuntimeError: Error in first after_teardown",
- "RuntimeError: Error in second after_teardown"
+ if USING_RUBY_1_9
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A TEST",
+ "THE TEARDOWN",
+ "1st after_teardown",
+ "2nd after_teardown",
+ "Finished in",
+ "RuntimeError: Error in first after_teardown",
+ "RuntimeError: Error in second after_teardown"
+ else
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A TEST",
+ "THE TEARDOWN",
+ "1st after_teardown",
+ "E",
+ "2nd after_teardown",
+ "Finished in",
+ "RuntimeError: Error in first after_teardown",
+ "RuntimeError: Error in second after_teardown"
+ end
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2
end
@@ -104,32 +129,56 @@ class TestUnitBeforeAfter < Test::Unit::TestCase
it "provides a cleaned-up backtrace" do
write_and_run_test :with_failure => true
- see_in_order "Loaded suite",
- "THE SETUP",
- "A FAILING TEST",
- "F", "THE TEARDOWN",
- "Finished in",
- "1) Failure:",
- "test_something(MyExampleTest) [_test_file_temp.rb:17]:",
- "Instrumented failure.",
- " is not true."
+ if USING_RUBY_1_9
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A FAILING TEST",
+ "THE TEARDOWN",
+ "F\n",
+ "Finished in",
+ "1) Failure:",
+ "test_something(MyExampleTest) [_test_file_temp.rb:17]:",
+ "Instrumented failure"
+ else
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A FAILING TEST",
+ "F",
+ "THE TEARDOWN",
+ "Finished in",
+ "1) Failure:",
+ "test_something(MyExampleTest) [_test_file_temp.rb:17]:",
+ "Instrumented failure.",
+ " is not true."
+ end
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
end
it "provides a cleaned-up backtrace, but not TOO cleaned up" do
write_and_run_test :with_failure => true, :use_helpers => true
- see_in_order "Loaded suite",
- "THE SETUP",
- "A FAILING TEST",
- "F", "THE TEARDOWN",
- "Finished in",
- "1) Failure:",
- "test_something(MyExampleTest)\n",
- "[_test_file_temp.rb:25:in `tripwire'",
- "_test_file_temp.rb:21:in `my_helper'",
- "_test_file_temp.rb:17:in `test_something']:",
- "Instrumented failure.",
- " is not true."
+ if USING_RUBY_1_9
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A FAILING TEST",
+ "F", "THE TEARDOWN",
+ "Finished in",
+ "1) Failure:",
+ "test_something(MyExampleTest)",
+ "Instrumented failure"
+ else
+ see_in_order "Loaded suite",
+ "THE SETUP",
+ "A FAILING TEST",
+ "F", "THE TEARDOWN",
+ "Finished in",
+ "1) Failure:",
+ "test_something(MyExampleTest)\n",
+ "[_test_file_temp.rb:25:in `tripwire'",
+ "_test_file_temp.rb:21:in `my_helper'",
+ "_test_file_temp.rb:17:in `test_something']:",
+ "Instrumented failure.",
+ " is not true."
+ end
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
end
@@ -165,10 +214,10 @@ class TestUnitBeforeAfter < Test::Unit::TestCase
see_in_order "Loaded suite",
"3rd before_setup",
"2nd before_setup",
- "FTHE TEARDOWN",
+ "THE TEARDOWN",
"1) Failure:",
"test_something(MyExampleTest) [_test_file_temp.rb:10]:",
- "Flunk in 2nd before_setup."
+ "Flunk in 2nd before_setup"
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
end
@@ -177,12 +226,12 @@ class TestUnitBeforeAfter < Test::Unit::TestCase
see_in_order "Loaded suite",
"3rd before_setup",
"2nd before_setup",
- "ETHE TEARDOWN",
+ "THE TEARDOWN",
"Finished in",
"test_something(MyExampleTest):",
"RuntimeError: Error in 2nd before_setup",
"_test_file_temp.rb:10",
- "/hardmock/lib/test_unit_before_after.rb:", ":in `call'"
+ "/hardmock/lib/test_unit_before_after.rb:"
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1
end
diff --git a/vendor/unity b/vendor/unity
index b7d9d00..d0d5ec5 160000
--- a/vendor/unity
+++ b/vendor/unity
@@ -1 +1 @@
-Subproject commit b7d9d007ce8265b8f0fdffae412e276bc377e331
+Subproject commit d0d5ec5d7569defaafd6c1bdb728d4c33783b69a