Module: Fraggle::Test
- Defined in:
- lib/fraggle/test.rb
Overview
I want this to be a great starting point for testing fraggle applications. It’s currently a work in progress. Think Rack::Test for fraggle.
Defined Under Namespace
Classes: Blk, TestClient
Constant Summary collapse
Instance Method Summary collapse
- #assert_recv(attrs) ⇒ Object
- #assert_sent(tag, attrs = {}) ⇒ Object
-
#reply(tag, attrs = {}) ⇒ Object
Replies with a valid response.
-
#reply!(tag, attrs = {}) ⇒ Object
Replies with a valid + done response.
Instance Method Details
#assert_recv(attrs) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fraggle/test.rb', line 44 def assert_recv(attrs) req = Fraggle::Response.new(attrs) msg = "This was not recieved:\n" msg << " #{req.inspect}\n" msg << "Received:\n " msg << blk.map {|r| r.inspect }.join("\n ") msg << "\n" assert_block(msg) { blk.include?(attrs) } end |
#assert_sent(tag, attrs = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fraggle/test.rb', line 31 def assert_sent(tag, attrs={}) req = Fraggle::Request.new(attrs) req.tag = tag msg = "This was not sent:\n" msg << " #{req.inspect}\n" msg << "Sent:\n " msg << c.map {|r| r.inspect }.join("\n ") msg << "\n" assert_block(msg) { c.include?(req) } end |