Sha256: 4d902624759217ae7b9f7d1cdc4b7976b851808b1506c0885bf9508ba1cb2fc5
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'helper' describe Footrest::Client do it "sets the domain" do client = Footrest::Client.new(prefix: "http://domain.test") expect(client.config.prefix).to eq("http://domain.test") end it "sets the authtoken" do client = Footrest::Client.new(token: "test_token") expect(client.config.token).to eq("test_token") end context "Request" do let(:client) { Footrest::Client.new } it "gets" do stub_request(:get, "http://domain.test/page?p=1"). to_return(:status => 200, :body => "", :headers => {}) client.get('http://domain.test/page', :p => 1) end it "deletes" do stub_request(:get, "http://domain.test/page?auth=xyz"). to_return(:status => 200, :body => "", :headers => {}) client.get('http://domain.test/page', :auth => 'xyz') end it "posts" do stub_request(:post, "http://domain.test/new_page"). with(:body => {"password"=>"xyz", "username"=>"abc"}). to_return(:status => 200, :body => "", :headers => {}) client.post('http://domain.test/new_page', :username => 'abc', :password => 'xyz') end it "puts" do stub_request(:put, "http://domain.test/update_page"). with(:body => {"password"=>"zzz", "username"=>"aaa"}). to_return(:status => 200, :body => "", :headers => {}) client.put('http://domain.test/update_page', :username => 'aaa', :password => 'zzz') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
footrest-0.1.3 | spec/footrest/client_spec.rb |
footrest-0.1.2 | spec/footrest/client_spec.rb |