diff --git a/lib/shoulda/context.rb b/lib/shoulda/context.rb index d3ad107..03fbd67 100644 --- a/lib/shoulda/context.rb +++ b/lib/shoulda/context.rb @@ -2,7 +2,6 @@ require "shoulda/context/configuration" require "shoulda/context/context" require "shoulda/context/dsl" -require "shoulda/context/proc_extensions" require "shoulda/context/test_framework_detection" require "shoulda/context/version" require "shoulda/context/world" diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index f5e1888..120cd65 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -36,12 +36,7 @@ def initialize(name, parent, &blk) end def merge_block(&blk) - if self.respond_to?(:instance_exec) - self.instance_exec(&blk) - else - # deprecated in Rails 4.x - blk.bind(self).call - end + self.instance_exec(&blk) end def context(name, &blk) @@ -170,23 +165,13 @@ def run_parent_setup_blocks(binding) def run_current_setup_blocks(binding) setup_blocks.each do |setup_block| - if binding.respond_to?(:instance_exec) - binding.instance_exec(&setup_block) - else - # deprecated in Rails 4.x - setup_block.bind(binding).call - end + binding.instance_exec(&setup_block) end end def run_all_teardown_blocks(binding) teardown_blocks.reverse.each do |teardown_block| - if binding.respond_to?(:instance_exec) - binding.instance_exec(&teardown_block) - else - # deprecated in Rails 4.x - teardown_block.bind(binding).call - end + binding.instance_exec(&teardown_block) end self.parent.run_all_teardown_blocks(binding) if am_subcontext? end diff --git a/lib/shoulda/context/proc_extensions.rb b/lib/shoulda/context/proc_extensions.rb deleted file mode 100644 index 0d577df..0000000 --- a/lib/shoulda/context/proc_extensions.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Stolen straight from ActiveSupport - -class Proc #:nodoc: - def bind(object) - block, time = self, Time.now - (class << object; self end).class_eval do - method_name = "__bind_#{time.to_i}_#{time.usec}" - define_method(method_name, &block) - method = instance_method(method_name) - remove_method(method_name) - method - end.bind(object) - end -end