Sha256: 93a46a0b62bf1e12385db1df7ad3548aed55442f3738bfccba2163cca5cc778a

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

class TrimTest < Test::Unit::TestCase
  context "A tr.im instance" do
    setup do
      FakeWeb.register_uri(:get, "http://api.tr.im/api/trim_simple?url=http%3A%2F%2Fgoogle.com", :body => File.join(File.dirname(__FILE__), 'fixtures', 'trim-trim-simple.txt'))
      FakeWeb.register_uri(:get, "http://api.tr.im/api/trim_url.xml?url=http%3A%2F%2Fgoogle.com&custom=thisismygoogletesting", :body => File.join(File.dirname(__FILE__), 'fixtures', 'trim-trim-url.xml'))
      # FakeWeb.register_uri(:get, "http://api.bit.ly/stats?hash=15DlK&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&version=2.0.1&login=bitlyapidemo", :body => File.join(File.dirname(__FILE__), 'fixtures', 'bitly-stats-cnn.json'))
      @trim = Shorty::Trim.new
    end
    
    should "exist" do
      assert @trim
    end
    
    should "return a shortened url using trim_simple" do
      assert_equal 'http://tr.im/w5Pm', @trim.shorten('http://google.com')
    end
    
    should "return a shortened url using trim_url" do
      assert_equal 'http://tr.im/thisismygoogletesting', @trim.trim_url(:url => 'http://google.com', :custom => 'thisismygoogletesting')
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
drcapulet-shorty-0.1.0 test/trim_test.rb
drcapulet-shorty-0.1.1 test/trim_test.rb
shorty-0.1.2 test/trim_test.rb
shorty-0.1.1 test/trim_test.rb