Permalink
Browse files

Reverting change to spec/spec_helper.rb. The change was originally ma…

…de so the tests could run on earlier version of rspec (<1.1.4)
  • Loading branch information...
1 parent 6704855 commit b8fb20e08848a6a5668c285aa032315ebfd4ff33 @snowblink snowblink committed Jul 3, 2008
Showing with 33 additions and 37 deletions.
  1. +33 −37 spec/spec_helper.rb
View
@@ -47,50 +47,46 @@ def next_instance
end
end
-module Spec
- module Example
- module ExampleGroupSubclassMethods
- def add_guard(klass, name, is_class = false)
- guarded = nil # define variable now for scoping
- target = (is_class ? klass.metaclass : klass)
- sep = (is_class ? "." : "#")
- target.class_eval do
- guarded = instance_method(name)
- define_method name do |*args|
- raise "Testing guards violated: Cannot call #{klass}#{sep}#{name}"
- end
- end
- @guards ||= []
- @guards << [klass, name, is_class, guarded]
+module Spec::Example::ExampleGroupSubclassMethods
+ def add_guard(klass, name, is_class = false)
+ guarded = nil # define variable now for scoping
+ target = (is_class ? klass.metaclass : klass)
+ sep = (is_class ? "." : "#")
+ target.class_eval do
+ guarded = instance_method(name)
+ define_method name do |*args|
+ raise "Testing guards violated: Cannot call #{klass}#{sep}#{name}"
end
+ end
+ @guards ||= []
+ @guards << [klass, name, is_class, guarded]
+ end
- def add_class_guard(klass, name)
- add_guard(klass, name, true)
- end
+ def add_class_guard(klass, name)
+ add_guard(klass, name, true)
+ end
- def unguard(klass, name, is_class = false)
- row = @guards.find { |(k,n,i)| k == klass and n == name and i == is_class }
- raise "#{klass}#{is_class ? "." : "#"}#{name} is not guarded" if row.nil?
- (is_class ? klass.metaclass : klass).class_eval do
- define_method name, row.last
- end
- @guards.delete row
- end
+ def unguard(klass, name, is_class = false)
+ row = @guards.find { |(k,n,i)| k == klass and n == name and i == is_class }
+ raise "#{klass}#{is_class ? "." : "#"}#{name} is not guarded" if row.nil?
+ (is_class ? klass.metaclass : klass).class_eval do
+ define_method name, row.last
+ end
+ @guards.delete row
+ end
- def class_unguard(klass, name)
- unguard(klass, name, true)
- end
+ def class_unguard(klass, name)
+ unguard(klass, name, true)
+ end
- def unguard_all
- @guards ||= []
- @guards.each do |klass, name, is_class, guarded|
- (is_class ? klass.metaclass : klass).class_eval do
- define_method name, guarded
- end
- end
- @guards.clear
+ def unguard_all
+ @guards ||= []
+ @guards.each do |klass, name, is_class, guarded|
+ (is_class ? klass.metaclass : klass).class_eval do
+ define_method name, guarded
end
end
+ @guards.clear
end
end

0 comments on commit b8fb20e

Please sign in to comment.