Skip to content
Browse files

Merge commit 'dstrelau/1.9' into ruby19

  • Loading branch information...
2 parents 1806451 + 13ff067 commit 4c95b08450412064f7adb64e83861c7e768f23ce @qrush qrush committed Jun 16, 2009
View
2 lib/shoulda/private_helpers.rb
@@ -7,7 +7,7 @@ def get_options!(args, *wanted)
opts = (args.last.is_a?(Hash) ? args.pop : {})
wanted.each {|w| ret << opts.delete(w)}
raise ArgumentError, "Unsupported options given: #{opts.keys.join(', ')}" unless opts.keys.empty?
- return *ret
+ return wanted.size == 1 ? ret.first : ret
end
end
end
View
2 lib/shoulda/test_unit.rb
@@ -1,3 +1,5 @@
+require 'test/unit'
+
require 'shoulda/context'
require 'shoulda/proc_extensions'
require 'shoulda/assertions'
View
7 test/fail_macros.rb
@@ -13,7 +13,12 @@ module ClassMethods
# end
def should_fail(&block)
context "should fail when trying to run:" do
- Shoulda.expected_exceptions = [Test::Unit::AssertionFailedError]
+ if defined?(Test::Unit::AssertionFailedError)
+ failures = [Test::Unit::AssertionFailedError]
+ elsif defined?(MiniTest::Assertion)
+ failures = [MiniTest::Assertion]
+ end
+ Shoulda.expected_exceptions = failures
yield block
Shoulda.expected_exceptions = nil
end
View
6 test/other/private_helpers_test.rb
@@ -22,5 +22,11 @@ class PrivateHelpersTest < ActiveSupport::TestCase # :nodoc:
get_options!(args, :one)
end
end
+
+ should "return single wanted option" do
+ args = [:a, :b, {:class => Object}]
+ klass = get_options!(args,:class)
+ assert_equal Object, klass
+ end
end
end
View
11 test/rails_root/config/boot.rb
@@ -44,6 +44,7 @@ class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
+ Rails::GemDependency.add_frozen_gem_path
end
end
@@ -67,7 +68,7 @@ def load_rails_gem
class << self
def rubygems_version
- Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
+ Gem::RubyGemsVersion rescue nil
end
def gem_version
@@ -82,14 +83,14 @@ def gem_version
def load_rubygems
require 'rubygems'
-
- unless rubygems_version >= '0.9.4'
- $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
+ min_version = '1.3.1'
+ unless rubygems_version >= min_version
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
- $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end

0 comments on commit 4c95b08

Please sign in to comment.
Something went wrong with that request. Please try again.