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

Testing callbacks against the Capistrano config's list of callbacks #4

Merged
merged 1 commit into from
Jul 12, 2012
Merged
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
12 changes: 5 additions & 7 deletions lib/minitest/assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,13 @@ def refute_have_task(task_name, configuration, msg = nil)
private

def test_callback_on(positive, configuration, task_name, on, other_task_name, msg)
task = configuration.find_task(task_name)
callbacks = configuration.find_callback(on, task)

if callbacks
method = positive ? :refute_empty : :assert_empty
send method, callbacks.select { |c| c.source == other_task_name }, msg
if callbacks = configuration.callbacks[on]
callbacks.select!{|c| c.only.include?(task_name.to_s) && c.source == other_task_name}
else
flunk msg
callbacks = {}
end
method = positive ? :refute_empty : :assert_empty
send method, callbacks.select { |c| c.only.include?(task_name.to_s) && c.source == other_task_name }, msg
end
end
end