Created
May 28, 2014 02:48
-
-
Save t-oginogin/27fea8f942a3e25ee566 to your computer and use it in GitHub Desktop.
Rails MiniTestでlibとhelperテストのメモ ref: http://qiita.com/t_oginogin/items/7654190749dc6fcce732
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
| require "test_helper" | |
| describe ApplicationHelper do | |
| before do | |
| class TestHelper < ActionView::Base | |
| include ApplicationHelper | |
| end | |
| @helper = TestHelper.new | |
| end | |
| describe "sampleを実行" do | |
| it "Sampleが返却される" do | |
| assert_equal 'Sample', @helper.sample | |
| end | |
| end | |
| end |
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
| : | |
| MiniTest::Rails::Testing.default_tasks << 'lib' | |
| : |
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
| require "test_helper" | |
| describe SampleLib do | |
| before do | |
| class TestSampleLib | |
| include SampleLib | |
| end | |
| @loader = TestSampleLib.new | |
| end | |
| describe "sampleを実行" do | |
| it "Sampleが返却される" do | |
| assert_equal 'Sample' @loader.sample | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment