rails_best_practices 0.3.20 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.21
|
@@ -54,7 +54,7 @@ describe RailsBestPractices::Checks::KeepFindersOnTheirOwnModelCheck do
|
|
54
54
|
errors.should be_empty
|
55
55
|
end
|
56
56
|
|
57
|
-
it "should not keep finders on
|
57
|
+
it "should not keep finders on their own model without finder" do
|
58
58
|
content = <<-EOF
|
59
59
|
class Post < ActiveRecord::Base
|
60
60
|
has_many :comments
|
@@ -68,4 +68,19 @@ describe RailsBestPractices::Checks::KeepFindersOnTheirOwnModelCheck do
|
|
68
68
|
errors = @runner.errors
|
69
69
|
errors.should be_empty
|
70
70
|
end
|
71
|
+
|
72
|
+
it "should not keep finders on their own model with ruby Array#find" do
|
73
|
+
content = <<-EOF
|
74
|
+
class Post < ActiveRecord::Base
|
75
|
+
has_many :comments
|
76
|
+
|
77
|
+
def active_comments
|
78
|
+
self.comments.find {|comment| comment.status == 'active'}
|
79
|
+
end
|
80
|
+
end
|
81
|
+
EOF
|
82
|
+
@runner.check('app/models/post.rb', content)
|
83
|
+
errors = @runner.errors
|
84
|
+
errors.should be_empty
|
85
|
+
end
|
71
86
|
end
|