Skip to content

Instantly share code, notes, and snippets.

@kamarcum
Forked from vinbarnes/app_helper.rb
Last active December 30, 2015 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamarcum/7794981 to your computer and use it in GitHub Desktop.
Save kamarcum/7794981 to your computer and use it in GitHub Desktop.
module ApplicationHelper
def weasel(opts={})
true
end
def wrapper(target=self)
target.weasel(1)
end
end
require "test_helper"
require "minitest/mock"
require "delegate"
class AppHelper
include ApplicationHelper
end
class ApplicationHelperTest < ActionView::TestCase
setup do
@helper = AppHelper.new
end
test "weasel" do
assert @helper.weasel
end
test "wrapper" do
mock = Minitest::Mock.new
mock.expect(:weasel, false, [1])
refute @helper.wrapper(mock)
mock.verify
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment