Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Proc#bind #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,6 @@ Rails/RefuteMethods:
Exclude:
- 'test/shoulda/helpers_test.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, flexible
Rails/TimeZone:
Exclude:
- 'lib/shoulda/context/proc_extensions.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
Expand Down Expand Up @@ -267,7 +259,6 @@ Style/MutableConstant:
# Cop supports --auto-correct.
Style/ParallelAssignment:
Exclude:
- 'lib/shoulda/context/proc_extensions.rb'
- 'test/shoulda/should_test.rb'

# Offense count: 1
Expand Down
1 change: 0 additions & 1 deletion lib/shoulda/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 3 additions & 18 deletions lib/shoulda/context/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions lib/shoulda/context/proc_extensions.rb

This file was deleted.

2 changes: 2 additions & 0 deletions shoulda-context.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Gem::Specification.new do |s|
s.description = "Context framework extracted from Shoulda"
s.license = "MIT"

s.required_ruby_version = ">= 2.0.0"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) }
Expand Down
Loading