Convert Style/UnlessElse spec

This commit is contained in:
fn ⌃ ⌥ 2021-10-27 16:13:24 -07:00
parent 06c0887136
commit 265bc51481

View file

@ -5,23 +5,22 @@ module Ameba::Rule::Style
describe UnlessElse do describe UnlessElse do
it "passes if unless hasn't else" do it "passes if unless hasn't else" do
s = Source.new %( expect_no_issues subject, <<-CRYSTAL
unless something unless something
:ok :ok
end end
) CRYSTAL
subject.catch(s).should be_valid
end end
it "fails if unless has else" do it "fails if unless has else" do
s = Source.new %( expect_issue subject, <<-CRYSTAL
unless something unless something
# ^^^^^^^^^^^^^^ error: Favour if over unless with else
:one :one
else else
:two :two
end end
) CRYSTAL
subject.catch(s).should_not be_valid
end end
it "reports rule, pos and message" do it "reports rule, pos and message" do