Module: Cordon
- Defined in:
- lib/cordon.rb,
lib/cordon/blacklist.rb,
lib/cordon/sanitaire.rb,
lib/cordon/violation.rb,
lib/cordon/whitelist.rb
Defined Under Namespace
Modules: Blacklist, Sanitaire, Whitelist Classes: Violation
Class Method Summary collapse
-
.blacklist(subject, methods) ⇒ Object
Declare specific methods as off-limits.
-
.embargo(framework) ⇒ Object
Shorthand for blacklisting the undesirable methods in specific frameworks.
- .wrap_assertions_with(custom_method_name) ⇒ Object
Class Method Details
.blacklist(subject, methods) ⇒ Object
Declare specific methods as off-limits
30 31 32 33 34 |
# File 'lib/cordon.rb', line 30 def self.blacklist(subject, methods) methods.each do |method| Blacklist.blacklist_method(subject, method.to_sym) end end |
.embargo(framework) ⇒ Object
Shorthand for blacklisting the undesirable methods in specific frameworks
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cordon.rb', line 37 def self.(framework) case framework when :rspec blacklist Kernel, [:should, :should_not] when :minitest_spec must_and_wont = MiniTest::Expectations.instance_methods.map(&:to_s).select {|e| e =~ /^(must|wont)_/} blacklist MiniTest::Expectations, must_and_wont else raise "I don't know how to embargo #{framework}!" end end |
.wrap_assertions_with(custom_method_name) ⇒ Object
49 50 51 |
# File 'lib/cordon.rb', line 49 def self.wrap_assertions_with(custom_method_name) Sanitaire.wrap_assertions_with(custom_method_name) end |