Skip to content

Commit

Permalink
Use _() instead of value() for minitest expectations
Browse files Browse the repository at this point in the history
The former is just a shortened (and preferred) alias of the latter.
  • Loading branch information
pdobb committed Nov 22, 2024
1 parent 4650ee8 commit 3ccaae0
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 216 deletions.
82 changes: 41 additions & 41 deletions test/say/interpolation_template_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class Say::InterpolationTemplateTest < Minitest::Spec
context "GIVEN no args" do
it "has the expected default attributes" do
result = subject.new
value(result.inspect).must_equal("{}")

value(result.left_bookend).must_equal("")
value(result.left_fill).must_equal("")
value(result.left_spacer).must_equal("")
value(result.right_spacer).must_equal("")
value(result.right_fill).must_equal("")
value(result.right_bookend).must_equal("")
_(result.inspect).must_equal("{}")

_(result.left_bookend).must_equal("")
_(result.left_fill).must_equal("")
_(result.left_spacer).must_equal("")
_(result.right_spacer).must_equal("")
_(result.right_fill).must_equal("")
_(result.right_bookend).must_equal("")
end
end

Expand All @@ -31,15 +31,15 @@ class Say::InterpolationTemplateTest < Minitest::Spec
right_spacer: "_RS_",
right_fill: "RF",
right_bookend: "RBE")
value(result.inspect).must_equal(
_(result.inspect).must_equal(
"LBE['LF', ...]_LS_{}_RS_['RF', ...]RBE")

value(result.left_bookend).must_equal("LBE")
value(result.left_fill).must_equal("LF")
value(result.left_spacer).must_equal("_LS_")
value(result.right_spacer).must_equal("_RS_")
value(result.right_fill).must_equal("RF")
value(result.right_bookend).must_equal("RBE")
_(result.left_bookend).must_equal("LBE")
_(result.left_fill).must_equal("LF")
_(result.left_spacer).must_equal("_LS_")
_(result.right_spacer).must_equal("_RS_")
_(result.right_fill).must_equal("RF")
_(result.right_bookend).must_equal("RBE")
end
end
end
Expand All @@ -49,7 +49,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "returns the expected Hash" do
result = subject.new
value(result.to_h).must_equal({
_(result.to_h).must_equal({
left_bookend: "",
left_fill: "",
left_spacer: "",
Expand All @@ -66,7 +66,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec
context "GIVEN an empty interpolation template" do
it "returns the expected String" do
result = subject.new
value(result.inspect).must_equal("{}")
_(result.inspect).must_equal("{}")
end
end

Expand All @@ -82,7 +82,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec
}

it "returns the expected String" do
value(subject.inspect).must_equal("=['~', ...] {} ['~', ...]=")
_(subject.inspect).must_equal("=['~', ...] {} ['~', ...]=")
end
end
end
Expand All @@ -92,11 +92,11 @@ class Say::InterpolationTemplateTest < Minitest::Spec
subject { Say::InterpolationTemplate.new }

it "returns the expected String" do
value(subject.interpolate("TEST")).must_equal("TEST")
_(subject.interpolate("TEST")).must_equal("TEST")
end

it "returns an empty String, GIVEN nil" do
value(subject.interpolate(nil)).must_equal("")
_(subject.interpolate(nil)).must_equal("")
end
end

Expand All @@ -112,11 +112,11 @@ class Say::InterpolationTemplateTest < Minitest::Spec
}

it "returns the expected String" do
value(subject.interpolate("TEST")).must_equal("=~ TEST ~=")
_(subject.interpolate("TEST")).must_equal("=~ TEST ~=")
end

it "returns just the decoration string, GIVEN nil" do
value(subject.interpolate(nil)).must_equal("=~ ~=")
_(subject.interpolate(nil)).must_equal("=~ ~=")
end
end
end
Expand All @@ -126,11 +126,11 @@ class Say::InterpolationTemplateTest < Minitest::Spec
subject { Say::InterpolationTemplate.new }

it "returns the expected String" do
value(subject.wrap("TEST")).must_equal("TEST")
_(subject.wrap("TEST")).must_equal("TEST")
end

it "returns an empty String, GIVEN nil" do
value(subject.wrap(nil)).must_equal("")
_(subject.wrap(nil)).must_equal("")
end
end

Expand All @@ -146,11 +146,11 @@ class Say::InterpolationTemplateTest < Minitest::Spec
}

it "returns the expected String" do
value(subject.wrap("TEST")).must_equal("~ TEST ~")
_(subject.wrap("TEST")).must_equal("~ TEST ~")
end

it "returns just the decoration string, GIVEN nil" do
value(subject.wrap(nil)).must_equal("~ ~")
_(subject.wrap(nil)).must_equal("~ ~")
end
end
end
Expand All @@ -167,8 +167,8 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "collaborates with Say::LeftJustifier" do
result = subject.left_justify("TEST")
value(@left_justifier_new_call).wont_be_nil
value(result).must_equal("TEST")
_(@left_justifier_new_call).wont_be_nil
_(result).must_equal("TEST")
end
end

Expand All @@ -184,8 +184,8 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "collaborates with Say::LeftJustifier" do
result = subject.center_justify("TEST")
value(@center_justifier_new_call).wont_be_nil
value(result).must_equal("TEST")
_(@center_justifier_new_call).wont_be_nil
_(result).must_equal("TEST")
end
end

Expand All @@ -201,8 +201,8 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "collaborates with Say::LeftJustifier" do
result = subject.right_justify("TEST")
value(@right_justifier_new_call).wont_be_nil
value(result).must_equal("TEST")
_(@right_justifier_new_call).wont_be_nil
_(result).must_equal("TEST")
end
end

Expand All @@ -213,15 +213,15 @@ class Say::InterpolationTemplateTest < Minitest::Spec
}

it "returns false" do
value(subject.left_fill?).must_equal(false)
_(subject.left_fill?).must_equal(false)
end
end

context "GIVEN a left fill" do
subject { Say::InterpolationTemplate.new(left_fill: " ") }

it "returns true" do
value(subject.left_fill?).must_equal(true)
_(subject.left_fill?).must_equal(true)
end
end
end
Expand All @@ -233,15 +233,15 @@ class Say::InterpolationTemplateTest < Minitest::Spec
}

it "returns false" do
value(subject.right_fill?).must_equal(false)
_(subject.right_fill?).must_equal(false)
end
end

context "GIVEN a right fill" do
subject { Say::InterpolationTemplate.new(right_fill: " ") }

it "returns true" do
value(subject.right_fill?).must_equal(true)
_(subject.right_fill?).must_equal(true)
end
end
end
Expand All @@ -252,7 +252,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "returns the expected Say::InterpolationTemplate" do
result = subject.hr
value(result.to_h).must_equal({
_(result.to_h).must_equal({
left_bookend: "",
left_fill: "=",
left_spacer: "",
Expand All @@ -268,7 +268,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "returns the expected Say::InterpolationTemplate" do
result = subject.title
value(result.to_h).must_equal({
_(result.to_h).must_equal({
left_bookend: "",
left_fill: "=",
left_spacer: " ",
Expand All @@ -284,7 +284,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "returns the expected Say::InterpolationTemplate" do
result = subject.wtf
value(result.to_h).must_equal({
_(result.to_h).must_equal({
left_bookend: "",
left_fill: "?",
left_spacer: " ",
Expand All @@ -305,7 +305,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec

it "returns the given object" do
result = subject.call(interpolation_template1)
value(result.to_h.fetch(:left_bookend)).must_equal("TEST")
_(result.to_h.fetch(:left_bookend)).must_equal("TEST")
end
end

Expand All @@ -319,7 +319,7 @@ class Say::InterpolationTemplateTest < Minitest::Spec
subject.call(
interpolation_template_attributes1,
interpolation_template_class: Say::InterpolationTemplate)
value(result.to_h.fetch(:left_bookend)).must_equal("TEST")
_(result.to_h.fetch(:left_bookend)).must_equal("TEST")
end
end
end
Expand Down
24 changes: 12 additions & 12 deletions test/say/justification/center_justifier_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Say::CenterJustifierTest < Minitest::Spec
context "GIVEN no args" do
it "returns the expected String" do
# rubocop:disable Layout/LineLength
value(subject.call).must_equal(
_(subject.call).must_equal(
"======================================= =======================================")
# rubocop:enable Layout/LineLength
end
Expand All @@ -24,7 +24,7 @@ class Say::CenterJustifierTest < Minitest::Spec
context "GIVEN a short String" do
it "returns the expected String" do
# rubocop:disable Layout/LineLength
value(subject.call("TEST")).must_equal(
_(subject.call("TEST")).must_equal(
"===================================== TEST =====================================")
# rubocop:enable Layout/LineLength
end
Expand All @@ -33,7 +33,7 @@ class Say::CenterJustifierTest < Minitest::Spec
context "GIVEN an extra-long String" do
it "returns the expected String" do
# rubocop:disable Layout/LineLength
value(subject.call("T" * 90)).must_equal(
_(subject.call("T" * 90)).must_equal(
"= TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT =")
# rubocop:enable Layout/LineLength
end
Expand All @@ -49,13 +49,13 @@ class Say::CenterJustifierTest < Minitest::Spec

context "GIVEN a short String" do
it "returns the expected String" do
value(subject.call("TEST")).must_equal("======= TEST =======")
_(subject.call("TEST")).must_equal("======= TEST =======")
end
end

context "GIVEN an extra-long String" do
it "returns the expected String" do
value(subject.call("T" * 30)).must_equal(
_(subject.call("T" * 30)).must_equal(
"= TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT =")
end
end
Expand All @@ -69,7 +69,7 @@ class Say::CenterJustifierTest < Minitest::Spec
}

it "returns the expected String" do
value(subject.call("TEST")).must_equal("= TEST =")
_(subject.call("TEST")).must_equal("= TEST =")
end
end
end
Expand All @@ -84,7 +84,7 @@ class Say::CenterJustifierTest < Minitest::Spec
context "GIVEN no args" do
it "returns the expected String" do
# rubocop:disable Layout/LineLength
value(subject.call).must_equal(
_(subject.call).must_equal(
"--------------------------------------------------------------------------------")
# rubocop:enable Layout/LineLength
end
Expand All @@ -99,7 +99,7 @@ class Say::CenterJustifierTest < Minitest::Spec
context "GIVEN a short String" do
it "returns the expected String" do
# rubocop:disable Layout/LineLength
value(subject.call("TEST")).must_equal(
_(subject.call("TEST")).must_equal(
"======================================TEST======================================")
# rubocop:enable Layout/LineLength
end
Expand All @@ -108,7 +108,7 @@ class Say::CenterJustifierTest < Minitest::Spec
context "GIVEN an extra-long String" do
it "returns the expected String" do
# rubocop:disable Layout/LineLength
value(subject.call("T" * 30)).must_equal(
_(subject.call("T" * 30)).must_equal(
"=========================TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT=========================")
# rubocop:enable Layout/LineLength
end
Expand All @@ -124,13 +124,13 @@ class Say::CenterJustifierTest < Minitest::Spec

context "GIVEN a short String" do
it "returns the expected String" do
value(subject.call("TEST")).must_equal("========TEST========")
_(subject.call("TEST")).must_equal("========TEST========")
end
end

context "GIVEN an extra-long String" do
it "returns the expected String" do
value(subject.call("T" * 30)).must_equal(
_(subject.call("T" * 30)).must_equal(
"=TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT=")
end
end
Expand All @@ -145,7 +145,7 @@ class Say::CenterJustifierTest < Minitest::Spec
}

it "uses the result of the block as the text for the banner" do
value(subject.call("NOPE") { "TEST_BLOCK" }).must_equal(
_(subject.call("NOPE") { "TEST_BLOCK" }).must_equal(
"= TEST_BLOCK =")
end
end
Expand Down
Loading

0 comments on commit 3ccaae0

Please sign in to comment.