mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Convert Style/UnlessElse
spec
This commit is contained in:
parent
06c0887136
commit
265bc51481
1 changed files with 5 additions and 6 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue