Class: BotAway::TestCase::Matchers::ObfuscationMatcher
- Inherits:
-
Object
- Object
- BotAway::TestCase::Matchers::ObfuscationMatcher
- Defined in:
- lib/bot-away/test_case/matchers/obfuscation_matcher.rb
Instance Attribute Summary collapse
-
#obfuscated_id ⇒ Object
readonly
Returns the value of attribute obfuscated_id.
-
#obfuscated_name ⇒ Object
readonly
Returns the value of attribute obfuscated_name.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(obfuscated_name, obfuscated_id) ⇒ ObfuscationMatcher
constructor
A new instance of ObfuscationMatcher.
- #match(key, value) ⇒ Object
- #matches?(target) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(obfuscated_name, obfuscated_id) ⇒ ObfuscationMatcher
4 5 6 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 4 def initialize(, ) , = , end |
Instance Attribute Details
#obfuscated_id ⇒ Object (readonly)
Returns the value of attribute obfuscated_id.
2 3 4 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 2 def end |
#obfuscated_name ⇒ Object (readonly)
Returns the value of attribute obfuscated_name.
2 3 4 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 2 def end |
Instance Method Details
#description ⇒ Object
19 20 21 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 19 def description "be obfuscated as '#{obfuscated_name}' with id '#{obfuscated_id}'" end |
#failure_message ⇒ Object
23 24 25 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 23 def "expected #{@target.inspect}\n to match #{@rx.inspect}" end |
#match(key, value) ⇒ Object
14 15 16 17 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 14 def match(key, value) @rx = /#{key}=['"]#{Regexp::escape value}["']/ @target[@rx] end |
#matches?(target) ⇒ Boolean
8 9 10 11 12 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 8 def matches?(target) target = target.call if target.kind_of?(Proc) @target = target match(:id, ) && match(:name, ) end |
#negative_failure_message ⇒ Object
27 28 29 |
# File 'lib/bot-away/test_case/matchers/obfuscation_matcher.rb', line 27 def "expected #{@target.inspect}\n to not match #{@rx.inspect}" end |