ud 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d158caae202c27c348f980136587f9d4bc9f7c67
4
- data.tar.gz: 2c11464fc90a9ce73392702794edb8ad4c38312d
3
+ metadata.gz: ef94c79592b39fe5f56775e9d08eab3ea601db08
4
+ data.tar.gz: 3202e4b6ce4fe9bb52b2ef984c137f714d3091d4
5
5
  SHA512:
6
- metadata.gz: d2a50925ca0d07a417498deeda4d3056a1cb4e87f590707319331b9609f65c554c2c382b3ada0d30e8ff838ea02b55f5a1cc2a6fd606a629c30c6a6d921902e7
7
- data.tar.gz: bd80e02b6430787d47be2893649d17447e3edae1aa947d3f324c92cb0c0fa788b28e73aefc778a0bfacf49c6af6ccb8da0b4107781195d45f35a249360f4aaf0
6
+ metadata.gz: dd4694a3b5970d1073129ffa8078c5727e4246161bcbd2bde9c4b02b4a4fe09248d5d9ae8a5cf6fe31bca65f3b8f82676076bbeaea1d604e928a0f8011be62b0
7
+ data.tar.gz: bbeede97c81c1496c534fbf8c48771f0e2145ef11506d4cb8b0ff7a0dc9c76ef2d1b6c05fa08de5846ebe435666d4edca59e02fa69cb7cd6412173c576e50938
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/ud.rb CHANGED
@@ -13,7 +13,7 @@ module UD
13
13
 
14
14
  # @return [String] the current gem's version
15
15
  def version
16
- '0.2.4'
16
+ '0.2.5'
17
17
  end
18
18
 
19
19
  # Get the search URL to query for a given term.
@@ -27,7 +27,7 @@ module UD
27
27
  if api
28
28
  "http://api.urbandictionary.com/v0/define?#{param}"
29
29
  else
30
- "http://www.urbandictionary.com/define.php?term=#{param}"
30
+ "http://www.urbandictionary.com/define.php?#{param}"
31
31
  end
32
32
  end
33
33
 
@@ -5,7 +5,8 @@ require File.dirname(__FILE__) + '/fake_responses'
5
5
 
6
6
  class UD_Query_test < Test::Unit::TestCase
7
7
 
8
- ROOT_URL = 'http://api.urbandictionary.com/v0/define'
8
+ API_URL = 'http://api.urbandictionary.com/v0/define'
9
+ ROOT_URL = 'http://www.urbandictionary.com/define.php'
9
10
 
10
11
  def setup
11
12
  @foo, @bar = [
@@ -36,30 +37,24 @@ class UD_Query_test < Test::Unit::TestCase
36
37
  # == UD#search_url == #
37
38
 
38
39
  def test_search_url_empty_term
39
- assert_equal(
40
- "#{ROOT_URL}?term=",
41
- UD.search_url())
42
- assert_equal(
43
- "#{ROOT_URL}?term=",
44
- UD.search_url(''))
40
+ assert_equal("#{API_URL}?term=", UD.search_url())
41
+ assert_equal("#{API_URL}?term=", UD.search_url(''))
42
+ end
43
+
44
+ def test_search_url_empty_term_nonapi
45
+ assert_equal("#{ROOT_URL}?term=", UD.search_url('', false))
45
46
  end
46
47
 
47
48
  def test_search_url_spaces_in_term
48
- assert_equal(
49
- "#{ROOT_URL}?term=a+b",
50
- UD.search_url('a b'))
49
+ assert_equal("#{API_URL}?term=a+b", UD.search_url('a b'))
51
50
  end
52
51
 
53
52
  def test_search_url_encode_special_chars
54
- assert_equal(
55
- "#{ROOT_URL}?term=%3D",
56
- UD.search_url('='))
53
+ assert_equal("#{API_URL}?term=%3D", UD.search_url('='))
57
54
  end
58
55
 
59
56
  def test_search_url
60
- assert_equal(
61
- "#{ROOT_URL}?term=foo",
62
- UD.search_url('foo'))
57
+ assert_equal("#{API_URL}?term=foo", UD.search_url('foo'))
63
58
  end
64
59
 
65
60
  # == UD#query == #
@@ -69,29 +64,15 @@ class UD_Query_test < Test::Unit::TestCase
69
64
  end
70
65
 
71
66
  def test_query_two_results
72
-
73
- expected = [
74
- @foo, @bar
75
- ]
76
-
77
- assert_equal(expected, UD.query('two_results', :count => 2))
67
+ assert_equal([@foo, @bar], UD.query('two_results', :count => 2))
78
68
  end
79
69
 
80
70
  def test_query_count
81
- expected = [
82
- @foo
83
- ]
84
-
85
- assert_equal(expected, UD.query('two_results', :count => 1))
71
+ assert_equal([@foo], UD.query('two_results', :count => 1))
86
72
  end
87
73
 
88
74
  def test_query_ratio
89
- expected = [
90
- @foo
91
- ]
92
-
93
- assert_equal(expected, UD.query('two_results', :count => 10, :ratio => 1.5))
75
+ assert_equal([@foo], UD.query('two_results', :count => 10, :ratio => 1.5))
94
76
  end
95
-
96
77
  end
97
78
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Fontaine
metadata.gz.sig CHANGED
Binary file