Skip to content

Commit

Permalink
remove errors_filter_block
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Oct 9, 2012
1 parent 31336c9 commit a12cae7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
4 changes: 1 addition & 3 deletions lib/rails_best_practices/analyzer.rb
Expand Up @@ -17,7 +17,7 @@ module RailsBestPractices
#
# After analyzing, output the violations.
class Analyzer
attr_accessor :runner, :errors_filter_block
attr_accessor :runner

DEFAULT_CONFIG = File.join(File.dirname(__FILE__), "..", "..", "rails_best_practices.yml")

Expand Down Expand Up @@ -56,8 +56,6 @@ def analyze

analyze_source_codes
analyze_vcs

errors_filter_block.call(errors) if errors_filter_block
end

# Output the analyze result.
Expand Down
18 changes: 0 additions & 18 deletions spec/rails_best_practices/analyzer_spec.rb
Expand Up @@ -43,23 +43,5 @@ module RailsBestPractices
result.should == ["app/models/user.rb:10 - law of demeter".red, "app/models/post.rb:100 - use query attribute".red, "\nPlease go to http://rails-bestpractices.com to see more useful Rails Best Practices.".green, "\nFound 2 warnings.".red].join("\n") + "\n"
end
end

describe "errors_filter_block" do
it "should call errors_filter_block after analyze" do
analyzer = Analyzer.new("path", "silent" => true)
analyzer.errors_filter_block = lambda { |errors| errors.each { |error| error.highlight = true } }
analyzer.stub(:expand_dirs_to_files).and_return([])
analyzer.stub(:file_sort).and_return([])
analyzer.stub(:file_ignore).and_return([])
analyzer.stub(:process)
runner = stub
runner.stub(:color=)
errors = [Core::Error.new, Core::Error.new]
Core::Runner.stub(:new).and_return(runner)
runner.stub(:errors).and_return(errors)
analyzer.analyze
analyzer.send(:errors).should be_all(&:highlight)
end
end
end
end

0 comments on commit a12cae7

Please sign in to comment.