Skip to content

Commit

Permalink
convert minitest bdd to regular minitest
Browse files Browse the repository at this point in the history
  • Loading branch information
matthutchinson committed Dec 28, 2024
1 parent 975b2cd commit f9b4be7
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions test/lolcommits/plugin/tranzlate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f9b4be7

Please sign in to comment.