Holoserve Connector - Connector library for Holoserve.¶ ↑
This library provides a client to the control interface of Holoserve and RSpec matchers to integrate Holoserve in a test suite. See holoserve for details about the concept of Holoserve.
Example¶ ↑
require 'holoserve/connector' require 'transport' holoserve = Holoserve::Connector.new :host => "localhost" holoserve.state.set :name => "one" Transport::HTTP.request :post, "/test" # handled in test layout one Transport::HTTP.request :delete, "/test" # unhandled holoserve.history.pair_ids # => [ "test_requested" ] holoserve.bucket.requsts # => [ { "method" => "DELETE", :path => "/test", :headers => { ... } } ]
RSpec inetgration example¶ ↑
require 'rspec/holoserve' RSpec::Holoserve.run_server = true describe "RSpec matchers" do before :all do @client = Holoserve::Connector.new @client.pairs.upload File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "pairs", "test.yaml")) @client.situation.name = "one" end it "should test if holoserve received a specified request" do Transport::HTTP.request :post, "http://localhost:4250/test", :expected_status_code => 201 @client.should have_received("test_request") end end