Class: Checkend::Testing::FakeClient
- Inherits:
-
Object
- Object
- Checkend::Testing::FakeClient
- Defined in:
- lib/checkend/testing.rb
Overview
Fake client that captures notices instead of sending them
Instance Attribute Summary collapse
-
#notices ⇒ Object
readonly
Returns the value of attribute notices.
Instance Method Summary collapse
-
#clear! ⇒ void
Clear all captured notices.
-
#initialize ⇒ FakeClient
constructor
A new instance of FakeClient.
-
#send_notice(notice) ⇒ Hash
Capture a notice instead of sending it.
Constructor Details
#initialize ⇒ FakeClient
Returns a new instance of FakeClient.
135 136 137 138 |
# File 'lib/checkend/testing.rb', line 135 def initialize @notices = [] @mutex = Mutex.new end |
Instance Attribute Details
#notices ⇒ Object (readonly)
Returns the value of attribute notices.
133 134 135 |
# File 'lib/checkend/testing.rb', line 133 def notices @notices end |
Instance Method Details
#clear! ⇒ void
This method returns an undefined value.
Clear all captured notices
159 160 161 162 163 |
# File 'lib/checkend/testing.rb', line 159 def clear! @mutex.synchronize do @notices.clear end end |
#send_notice(notice) ⇒ Hash
Capture a notice instead of sending it
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/checkend/testing.rb', line 144 def send_notice(notice) @mutex.synchronize do @notices << notice end # Return a fake successful response { 'id' => @notices.size, 'problem_id' => @notices.size } end |