Sha256: ed6671854999c920f610643e9a71a9813e3d606811c96abd467655e73c0e7d47
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' describe '.map_options' do it 'should map the query options' do client = MockGerry.new options = client.map_options(['q=createAccount', 'q=createGroup']) expect(options).to eq('q=createAccount&q=createGroup') end end describe '.get' do it 'should request projects as anoymous' do stub = stub_get('/projects/', 'projects.json') client = MockGerry.new client.projects expect(stub).to have_been_requested end it 'should request projects as user' do username = 'gerry' password = 'whoop' body = get_fixture('projects.json') stub = stub_request(:get, "http://localhost/a/projects/"). with(:headers => {'Accept'=>'application/json'}). to_return(:status => 200, :body => body, :headers => {}) client = Gerry.new(MockGerry::URL, 'gerry', 'whoop') projects = client.projects # twice because the first is the auth challenge and then the actual request expect(stub).to have_been_requested.twice expect(projects['awesome']['description']).to eq('Awesome project') expect(projects['clean']['description']).to eq('Clean code!') end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
gerry-0.1.2 | spec/request_spec.rb |
gerry-0.1.1 | spec/request_spec.rb |
gerry-0.1.0 | spec/request_spec.rb |
gerry-0.0.4 | spec/request_spec.rb |
gerry-0.0.3 | spec/request_spec.rb |