Created
February 22, 2018 10:11
-
-
Save descovi/d38d23b29aa78845176c97fd3f596ecd to your computer and use it in GitHub Desktop.
Esempio di uso del metodo stub all'interno di un test di un helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test/helpers/title_helper_test.rb | |
require 'test_helper' | |
class TitleHelperTest < ActionView::TestCase | |
test "return title with controller name when title content is nil" do | |
stub :controller_name, 'businesses' do | |
result = set_title_tag title_content: nil, from_layout: 'Admin Area' | |
assert_equal 'Clienti - Admin Area - iPY', result | |
end | |
end | |
end | |
# N.B. | |
# Ricordati di inserire | |
# require 'minitest/mock' all'interno di test_helper.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment