-
-
Save seangaffney/163a8a4fed8134eed6a5 to your computer and use it in GitHub Desktop.
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
require 'spec/support/grep_matcher' | |
describe do | |
disallow_presence_of pattern: "send(.*#", | |
location: "app/", | |
description: "Do not use dynamic method invocations", | |
failure: "Please change dynamic method call to something more sane." | |
end |
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
# Soon to be open sourced as a gem | |
module Reverb | |
module RSpec | |
module GrepMatcher | |
module ClassMethods | |
def disallow_presence_of(description:nil, pattern:nil, location:nil, failure:nil) | |
it(description) do | |
results = `grep -rn '#{pattern}' #{location}` | |
results.should eq(""), failure | |
end | |
end | |
end | |
end | |
end | |
end | |
RSpec::Core::ExampleGroup.extend(Reverb::RSpec::GrepMatcher::ClassMethods) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment