Permalink
Browse files

Ruby 1.9 compatibility

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 95c851c commit fb1d24a60fbbc294d4c554d3da2062dc84d863cb Iain Hecker committed with josevalim May 24, 2009
View
@@ -1,3 +1,4 @@
+# encoding: utf-8
current_dir = File.dirname(__FILE__)
require File.join(current_dir, "remarkable/lib/remarkable/version.rb")
View
@@ -1,3 +1,4 @@
+# encoding: utf-8
current_dir = File.dirname(__FILE__)
require File.join(current_dir, "remarkable/lib/remarkable/version.rb")
View
@@ -1,3 +1,4 @@
+# encoding: utf-8
PROJECT_SUMMARY = "Remarkable: a framework for rspec matchers, with support to macros and I18n."
PROJECT_DESCRIPTION = PROJECT_SUMMARY
@@ -1,11 +1,14 @@
module Remarkable
+
module Pending
# We cannot put the alias method in the module because it's a Ruby 1.8 bug
# http://coderrr.wordpress.com/2008/03/28/alias_methodmodule-bug-in-ruby-18/
#
def self.extended(base) #:nodoc:
class << base
+ alias_method :example_without_pending, :example
+ alias_method :example, :example_with_pending
alias :it :example
alias :specify :example
end
@@ -41,7 +44,7 @@ def pending(*args, &block)
@_pending_group_execute = nil
end
- def example(description=nil, options={}, backtrace=nil, &implementation) #:nodoc:
+ def example_with_pending(description=nil, options={}, backtrace=nil, &implementation) #:nodoc:
if block_given? && @_pending_group
pending_caller = caller.detect{ |c| c !~ /method_missing'/ }
pending_description = @_pending_group_description
@@ -52,11 +55,12 @@ def example(description=nil, options={}, backtrace=nil, &implementation) #:nodoc
proc{ pending(pending_description) }
end
- super(description, options, backtrace || pending_caller, &pending_block)
+ example_without_pending(description, options, backtrace || pending_caller, &pending_block)
else
- super(description, options, backtrace || caller(0)[1], &implementation)
+ example_without_pending(description, options, backtrace || caller(0)[1], &implementation)
end
end
end
+
end
@@ -1,3 +1,4 @@
+# encoding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Remarkable::DSL::Optionals do
@@ -1,3 +1,4 @@
+# encoding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Remarkable::Messages do
@@ -1,7 +1,6 @@
$TESTING=true
require 'rubygems'
-require 'ruby-debug'
dir = File.dirname(__FILE__)
require File.join(dir, '..', 'lib', 'remarkable')
@@ -1,3 +1,4 @@
+# encoding: utf-8
PROJECT_SUMMARY = "Remarkable ActiveRecord: collection of matchers and macros with I18n for ActiveRecord"
PROJECT_DESCRIPTION = PROJECT_SUMMARY
@@ -1,5 +1,5 @@
+# encoding: utf-8
require 'rubygems'
-require 'ruby-debug'
RAILS_VERSION = ENV['RAILS_VERSION'] || '2.3.2'
@@ -161,9 +161,9 @@ def define_and_validate(options)
it { should_not define_and_validate(:within => 2..6).within(3..6).with_kind_of(Variant) }
it { should_not define_and_validate(:within => 3..7).within(3..6).with_kind_of(Variant) }
- it "should raise association type mismatch if with_kind_of is not supplied" do
+ it "should raise association type mismatch if with_kind_of does not match" do
lambda {
- should_not define_and_validate(:within => 3..6).within(3..6)
+ should_not define_and_validate(:within => 3..6).within(3..6).with_kind_of(Product)
}.should raise_error(ActiveRecord::AssociationTypeMismatch)
end
end
@@ -1,3 +1,4 @@
+# encoding: utf-8
PROJECT_SUMMARY = "Remarkable Rails: collection of matchers and macros with I18n for Rails"
PROJECT_DESCRIPTION = PROJECT_SUMMARY
@@ -1,5 +1,4 @@
require 'rubygems'
-require 'ruby-debug'
RAILS_ENV = 'test'
RAILS_VERSION = ENV['RAILS_VERSION'] || '2.3.2'

0 comments on commit fb1d24a

Please sign in to comment.