Sha256: a51022a14bb34f351549152b370bd924857d8b178cc8582928f528e75e98b092

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

require 'test/unit'
require 'rubygems'

$LOAD_PATH << File.dirname(__FILE__) + '/../lib/'
require 'oauth'
require 'mocha'
require 'stringio'
require 'webmock'

class Test::Unit::TestCase
  include WebMock::API

  def assert_matching_headers(expected, actual)
    # transform into sorted arrays
    auth_intro, auth_params = actual.split(' ', 2)
    assert_equal auth_intro, 'OAuth'
    expected    = expected.split(/(,|\s)/).reject {|v| v == '' || v =~ /^[\,\s]+/}.sort
    auth_params = auth_params.split(/(,|\s)/).reject {|v| v == '' || v =~ /^[\,\s]+/}.sort
    assert_equal expected, auth_params
  end

  def stub_test_ie
    stub_request(:any, "http://term.ie/oauth/example/request_token.php").to_return(:body => "oauth_token=requestkey&oauth_token_secret=requestsecret")
    stub_request(:post, "http://term.ie/oauth/example/access_token.php").to_return(:body => "oauth_token=accesskey&oauth_token_secret=accesssecret")
    stub_request(:get, %r{http://term\.ie/oauth/example/echo_api\.php\?.+}).to_return(lambda {|request| {:body => request.uri.query}})
    stub_request(:post, "http://term.ie/oauth/example/echo_api.php").to_return(lambda {|request| {:body => request.body}})
  end
end

Version data entries

10 entries across 9 versions & 5 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/oauth-0.4.7/test/test_helper.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/oauth-0.4.7/test/test_helper.rb
oauth-ap-0.4.8 test/test_helper.rb
oauth-instructure-0.4.10 test/test_helper.rb
oauth_weshays-0.4.8.pre2 test/test_helper.rb
oauth_weshays-0.4.8.pre test/test_helper.rb
oauth-instructure-0.4.9 test/test_helper.rb
oauth-instructure-0.4.8 test/test_helper.rb
oauth-0.4.7 test/test_helper.rb
oauth-0.4.6 test/test_helper.rb