spec/support/webmock.rb in blockchain-node-0.0.3 vs spec/support/webmock.rb in blockchain-node-0.0.4

- old
+ new

@@ -15,13 +15,23 @@ stub_request(:post, "#{BlockchainNode::Request::DEFAULT_BASE_URL}/oauth/token"). with(body: OAUTH_REQUEST ). to_return(status: 200, body: OAUTH_RESPONSE.to_json) end +def stub_get_node + stub_request(:get, "#{BlockchainNode::Request::DEFAULT_BASE_URL}/api/nodes/#{NODE_ID}"). + to_return(status: 200, body: "{\"id\":\"#{NODE_ID}\",\"blockchain\":\"bitcoin\",\"network\":\"testnet\",\"status\":\"RUNNING\",\"height\":1454086}" ) +end + +def stub_get_nodes + stub_request(:get, "#{BlockchainNode::Request::DEFAULT_BASE_URL}/api/nodes"). + to_return(status: 200, body: "{\"nodes\":[{\"id\":\"#{NODE_ID}\",\"blockchain\":\"bitcoin\",\"network\":\"testnet\",\"status\":\"RUNNING\",\"height\":1454086}]}" ) +end + def stub_basic_method stub_request(:post, "#{BlockchainNode::Request::DEFAULT_BASE_URL}/api/nodes/#{NODE_ID}"). with(body: api_method_body('eth_blockNumber')). - to_return(status: 200, body: '0x123A ') + to_return(status: 200, body: '0x123A') end def api_method_body(method, *params) {