-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test MultilineOperationIndentation configuration
- Loading branch information
Greg Lazarev
committed
May 8, 2015
1 parent
7db78d9
commit 7c20c7a
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -397,6 +397,46 @@ def initialize(name: , age: ) | |
end | ||
end | ||
end | ||
|
||
context "when continued lines are not aligned with operand" do | ||
it "returns violations" do | ||
code = <<-CODE.strip_heredoc | ||
def foo | ||
user = User.where(email: "[email protected]"). | ||
assign_attributes(name: "User") | ||
user.save! | ||
end | ||
CODE | ||
|
||
violations = violations_in(code) | ||
|
||
expect(violations).to eq [ | ||
"Align the operands of an expression in an assignment " + | ||
"spanning multiple lines." | ||
] | ||
end | ||
end | ||
|
||
context "when continued lines are aligned with operand" do | ||
context "with thoughtbot repo" do | ||
it "returns violations" do | ||
code = <<-CODE.strip_heredoc | ||
def foo | ||
user = User.where(email: "[email protected]"). | ||
assign_attributes(name: "User") | ||
user.save! | ||
end | ||
CODE | ||
|
||
violations = violations_in(code, repository_owner_name: "thoughtbot") | ||
|
||
expect(violations).to eq [ | ||
"Use 2 (not 7) spaces for indenting an expression " + | ||
"in an assignment spanning multiple lines." | ||
] | ||
end | ||
end | ||
end | ||
end | ||
|
||
context "with custom configuration" do | ||
|