Normalize sources for tests

This commit is contained in:
Vitalii Elenhaupt 2018-09-07 15:07:03 +03:00
parent cb5f802012
commit d7b0e10d1e
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706
27 changed files with 89 additions and 65 deletions

View file

@ -42,7 +42,7 @@ module Ameba
subject.catch(s).should_not be_valid
issue = s.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:9"
issue.location.to_s.should eq "source.cr:1:1"
issue.message.should eq(
"Constant name should be screaming-cased: CONST, not Const"
)

View file

@ -112,12 +112,12 @@ module Ameba
it "reports rule, pos and message" do
s = Source.new %q(
1200000
1200000
), "source.cr"
subject.catch(s).should_not be_valid
issue = s.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:10"
issue.location.to_s.should eq "source.cr:1:1"
issue.message.should match /1_200_000/
end

View file

@ -46,7 +46,7 @@ module Ameba
subject.catch(s).should_not be_valid
issue = s.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:9"
issue.location.to_s.should eq "source.cr:1:1"
issue.message.should eq(
"Method name should be underscore-cased: bad_name, not bad_Name"
)

View file

@ -40,7 +40,7 @@ module Ameba::Rule::Style
issue = s.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:3:11"
issue.location.to_s.should eq "source.cr:2:3"
issue.message.should eq(
"Favour method name 'picture?' over 'has_picture?'")
end

View file

@ -206,7 +206,7 @@ module Ameba::Rule::Style
issue = s.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:9"
issue.location.to_s.should eq "source.cr:1:1"
issue.message.should eq "Redundant `begin` block detected"
end
end

View file

@ -51,7 +51,7 @@ module Ameba
subject.catch(s).should_not be_valid
issue = s.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:9"
issue.location.to_s.should eq "source.cr:1:1"
issue.message.should eq(
"Type name should be camelcased: MyClass, but it was My_class"
)

View file

@ -37,7 +37,7 @@ module Ameba::Rule::Style
issue = s.issues.first
issue.should_not be_nil
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:9"
issue.location.to_s.should eq "source.cr:1:1"
issue.message.should eq "Favour if over unless with else"
end
end

View file

@ -52,7 +52,7 @@ module Ameba
subject.catch(s).should_not be_valid
issue = s.issues.first
issue.rule.should_not be_nil
issue.location.to_s.should eq "source.cr:2:9"
issue.location.to_s.should eq "source.cr:1:1"
issue.message.should eq(
"Var name should be underscore-cased: bad_name, not badName"
)