Sha256: 8e2dc53d6d75877f1f9400a41496ba8bff279fcc5e1ae109e6ce8cada6e95cd5
Contents?: true
Size: 1.63 KB
Versions: 3
Compression:
Stored size: 1.63 KB
Contents
require 'rspec' require 'webmock/rspec' require File.expand_path('../../lib/gitlab', __FILE__) def load_fixture(name) File.new(File.dirname(__FILE__) + "/fixtures/#{name}.json") end RSpec.configure do |config| config.before(:all) do Gitlab.endpoint = 'https://api.example.com' Gitlab.private_token = 'secret' end end # GET def stub_get(path, fixture) stub_request(:get, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}). to_return(:body => load_fixture(fixture)) end def a_get(path) a_request(:get, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}) end # POST def stub_post(path, fixture) stub_request(:post, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}). to_return(:body => load_fixture(fixture)) end def a_post(path) a_request(:post, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}) end # PUT def stub_put(path, fixture) stub_request(:put, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}). to_return(:body => load_fixture(fixture)) end def a_put(path) a_request(:put, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}) end # DELETE def stub_delete(path, fixture) stub_request(:delete, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}). to_return(:body => load_fixture(fixture)) end def a_delete(path) a_request(:delete, "#{Gitlab.endpoint}#{path}"). with(:query => {:private_token => Gitlab.private_token}) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gitlab-2.2.0 | spec/spec_helper.rb |
gitlab-2.1.0 | spec/spec_helper.rb |
gitlab-2.0.0 | spec/spec_helper.rb |