shawty-client 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -1,11 +1,11 @@
1
- = Shawty Client
1
+ # Shawty Client
2
2
 
3
3
  For use with [Shawty](http://github.com/JackDanger/shawty-server)
4
4
 
5
5
 
6
- == HowTo
6
+ ## HowTo
7
7
 
8
- server = Shawty.new("http://my.shawty.server.com:8888/")
8
+ server = Shawty.new "http://my.shawty.server.com:8888/"
9
9
  link = server.shrink "http://maps.google.com/maps/..."
10
10
  # => "http://my.shawty.server.com:8888/a7D"
11
11
  biggie = server.expand link
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
data/lib/shawty_client.rb CHANGED
@@ -22,7 +22,7 @@ class Shawty
22
22
  protected
23
23
 
24
24
  def start
25
- Net::HTTP.start(@server.host, @server.port) do |http|
25
+ Net::HTTP.start @server.host, @server.port do |http|
26
26
  yield http
27
27
  end
28
28
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shawty-client}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jack Danger Canty"]
12
- s.date = %q{2010-03-26}
12
+ s.date = %q{2010-03-27}
13
13
  s.description = %q{Connects any Ruby app to a Shawty-powered url-shortening server}
14
14
  s.email = %q{gitcommit@6brand.com}
15
15
  s.extra_rdoc_files = [
data/test/helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
+ gem 'test-unit'
2
3
  require 'test/unit'
4
+ require 'mocha'
3
5
  require 'shoulda'
4
6
 
5
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -2,16 +2,41 @@ require 'helper'
2
2
 
3
3
  class TestShawtyClient < Test::Unit::TestCase
4
4
 
5
- # Damn, not a whole lot to test really until I start writing mocks.
6
5
 
7
- context "sets server properly" do
6
+ context "client" do
8
7
  setup {
9
8
  @server = Shawty.new("http://get.shawty.com")
9
+ @url = "http://long.url/path"
10
+ @shawt = "http://get.shawty.com/1DgB6"
11
+
10
12
  }
11
- should "set server instance" do
12
- assert_equal URI.parse("http://get.shawty.com"),
13
- @server.instance_variable_get("@server")
13
+ context "shrinking a url" do
14
+ setup {
15
+ response = stub
16
+ response.expects(:read_body).returns(@shawt).once
17
+ http = stub
18
+ http.expects(:post).returns(response).once
19
+ Net::HTTP.expects(:start).yields(http).once
20
+
21
+ @server.shrink @url
22
+ }
23
+ should "run expectations" do
24
+ assert true
25
+ end
14
26
  end
15
- end
27
+ context "expanding a url" do
28
+ setup {
29
+ response = stub
30
+ response.expects(:[]).with('Location').returns(@url).once
31
+ http = stub
32
+ http.expects(:get).with(URI.parse(@shawt).path).returns(response).once
33
+ Net::HTTP.expects(:start).yields(http).once
16
34
 
35
+ @server.expand @shawt
36
+ }
37
+ should "run expectations" do
38
+ assert true
39
+ end
40
+ end
41
+ end
17
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shawty-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Danger Canty
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-26 00:00:00 -07:00
12
+ date: 2010-03-27 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency