diff --git a/test/lolcommits/plugin/tranzlate_test.rb b/test/lolcommits/plugin/tranzlate_test.rb index 4b8c0e5..a31d17b 100644 --- a/test/lolcommits/plugin/tranzlate_test.rb +++ b/test/lolcommits/plugin/tranzlate_test.rb @@ -2,40 +2,34 @@ require 'test_helper' -describe Lolcommits::Plugin::Tranzlate do - +class TestLolcommitsPluginTranzlate < Minitest::Test include Lolcommits::TestHelpers::GitRepo include Lolcommits::TestHelpers::FakeIO - describe 'with a runner' do - def runner - @runner ||= Lolcommits::Runner.new - end + def test_enabled_returns_false_by_default + refute plugin.enabled? + end - def plugin - @plugin ||= Lolcommits::Plugin::Tranzlate.new(runner: runner) - end + def test_enabled_returns_true_when_configured + plugin.configuration = { enabled: true } + assert plugin.enabled? + end - describe '#enabled?' do - it 'returns false by default' do - _(plugin.enabled?).must_equal false - end + def test_run_pre_capture_tranzlates_commit_message + commit_repo_with_message("my awesome commit") + in_repo { plugin.run_pre_capture } - it 'returns true when configured' do - plugin.configuration = { enabled: true } - _(plugin.enabled?).must_equal true - end - end + assert_match /AWESUM COMMIT/, runner.message - describe '#run_pre_capture' do - before { commit_repo_with_message('my awesome commit') } + teardown_repo + end - it 'tranzlates the commit message' do - in_repo { plugin.run_pre_capture } - _(runner.message).must_match(/AWESUM COMMIT/) - end + private + def runner + @runner ||= Lolcommits::Runner.new + end - after { teardown_repo } + def plugin + @plugin ||= Lolcommits::Plugin::Tranzlate.new(runner: runner) end - end end