Merge commit 'dstrelau/1.9' into ruby19
This commit is contained in:
commit
4c95b08450
|
@ -7,7 +7,7 @@ module Shoulda # :nodoc:
|
||||||
opts = (args.last.is_a?(Hash) ? args.pop : {})
|
opts = (args.last.is_a?(Hash) ? args.pop : {})
|
||||||
wanted.each {|w| ret << opts.delete(w)}
|
wanted.each {|w| ret << opts.delete(w)}
|
||||||
raise ArgumentError, "Unsupported options given: #{opts.keys.join(', ')}" unless opts.keys.empty?
|
raise ArgumentError, "Unsupported options given: #{opts.keys.join(', ')}" unless opts.keys.empty?
|
||||||
return *ret
|
return wanted.size == 1 ? ret.first : ret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'test/unit'
|
||||||
|
|
||||||
require 'shoulda/context'
|
require 'shoulda/context'
|
||||||
require 'shoulda/proc_extensions'
|
require 'shoulda/proc_extensions'
|
||||||
require 'shoulda/assertions'
|
require 'shoulda/assertions'
|
||||||
|
|
|
@ -13,7 +13,12 @@ module Shoulda
|
||||||
# end
|
# end
|
||||||
def should_fail(&block)
|
def should_fail(&block)
|
||||||
context "should fail when trying to run:" do
|
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
|
yield block
|
||||||
Shoulda.expected_exceptions = nil
|
Shoulda.expected_exceptions = nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,5 +22,11 @@ class PrivateHelpersTest < ActiveSupport::TestCase # :nodoc:
|
||||||
get_options!(args, :one)
|
get_options!(args, :one)
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,6 +44,7 @@ module Rails
|
||||||
def load_initializer
|
def load_initializer
|
||||||
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
||||||
Rails::Initializer.run(:install_gem_spec_stubs)
|
Rails::Initializer.run(:install_gem_spec_stubs)
|
||||||
|
Rails::GemDependency.add_frozen_gem_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ module Rails
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def rubygems_version
|
def rubygems_version
|
||||||
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
|
Gem::RubyGemsVersion rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def gem_version
|
def gem_version
|
||||||
|
@ -82,14 +83,14 @@ module Rails
|
||||||
|
|
||||||
def load_rubygems
|
def load_rubygems
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
min_version = '1.3.1'
|
||||||
unless rubygems_version >= '0.9.4'
|
unless rubygems_version >= min_version
|
||||||
$stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue LoadError
|
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
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue