shawty-client 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -3
- data/VERSION +1 -1
- data/lib/shawty_client.rb +1 -1
- data/shawty-client.gemspec +2 -2
- data/test/helper.rb +2 -0
- data/test/test_shawty_client.rb +31 -6
- metadata +2 -2
data/README.markdown
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
# Shawty Client
|
2
2
|
|
3
3
|
For use with [Shawty](http://github.com/JackDanger/shawty-server)
|
4
4
|
|
5
5
|
|
6
|
-
|
6
|
+
## HowTo
|
7
7
|
|
8
|
-
server = Shawty.new
|
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.
|
1
|
+
1.0.1
|
data/lib/shawty_client.rb
CHANGED
data/shawty-client.gemspec
CHANGED
@@ -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.
|
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-
|
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
data/test/test_shawty_client.rb
CHANGED
@@ -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 "
|
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
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
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.
|
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-
|
12
|
+
date: 2010-03-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|