Skip to content

Instantly share code, notes, and snippets.

@t-oginogin
Created May 28, 2014 02:48
Show Gist options
  • Select an option

  • Save t-oginogin/27fea8f942a3e25ee566 to your computer and use it in GitHub Desktop.

Select an option

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
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
:
MiniTest::Rails::Testing.default_tasks << 'lib'
:
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