alexa 0.2.0 → 0.2.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/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source :rubygems
2
2
 
3
+ gem "minitest", :platform => :ruby_18
3
4
  gem "rake"
4
5
 
5
6
  gemspec
data/README.rdoc CHANGED
@@ -25,4 +25,4 @@ You can set configuration in block like this:
25
25
 
26
26
  == Copyright
27
27
 
28
- Copyright (c) 2010 Wojciech Wnętrzak. See LICENSE for details.
28
+ Copyright (c) 2011 Wojciech Wnętrzak. See LICENSE for details.
data/alexa.gemspec CHANGED
@@ -21,7 +21,5 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_dependency "xml-simple"
23
23
 
24
- s.add_development_dependency "test-unit"
25
- s.add_development_dependency "shoulda"
26
24
  s.add_development_dependency "mocha"
27
25
  end
data/lib/alexa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Alexa
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/test/config_test.rb CHANGED
@@ -1,14 +1,13 @@
1
- require 'helper'
1
+ require "helper"
2
2
 
3
- class ConfigTest < Test::Unit::TestCase
4
- def setup
5
- # Config is singleton
3
+ describe "Alexa::Config" do
4
+ before do
6
5
  Alexa.config.access_key_id = nil
7
6
  Alexa.config.secret_access_key = nil
8
7
  end
9
8
 
10
- should "raise argumment error if access key id is not present" do
11
- assert_raise ArgumentError do
9
+ it "should raise argumment error if access key id is not present" do
10
+ assert_raises ArgumentError do
12
11
  Alexa::UrlInfo.new(
13
12
  :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF",
14
13
  :host => "some.host"
@@ -16,8 +15,8 @@ class ConfigTest < Test::Unit::TestCase
16
15
  end
17
16
  end
18
17
 
19
- should "raise argumment error if secret access key is not present" do
20
- assert_raise ArgumentError do
18
+ it "should raise argumment error if secret access key is not present" do
19
+ assert_raises ArgumentError do
21
20
  Alexa::UrlInfo.new(
22
21
  :access_key_id => "12345678901234567890",
23
22
  :host => "some.host"
@@ -25,8 +24,8 @@ class ConfigTest < Test::Unit::TestCase
25
24
  end
26
25
  end
27
26
 
28
- should "raise argumment error if host is not present" do
29
- assert_raise ArgumentError do
27
+ it "should raise argumment error if host is not present" do
28
+ assert_raises ArgumentError do
30
29
  Alexa::UrlInfo.new(
31
30
  :access_key_id => "12345678901234567890",
32
31
  :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF"
data/test/helper.rb CHANGED
@@ -1,15 +1,11 @@
1
1
  Bundler.setup
2
- require "test/unit"
2
+
3
+ require "minitest/autorun"
3
4
  require "mocha"
4
- require "shoulda"
5
5
 
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
- $LOAD_PATH.unshift(File.dirname(__FILE__))
8
6
  require "alexa"
9
7
 
10
- class Test::Unit::TestCase
11
- def fixture_file(filename)
12
- file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
13
- File.read(file_path)
14
- end
8
+ def fixture_file(filename)
9
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
10
+ File.read(file_path)
15
11
  end
@@ -1,7 +1,7 @@
1
1
  require "helper"
2
2
 
3
- class UrlInfoTest < Test::Unit::TestCase
4
- def setup
3
+ describe "Alexa::UlrInfo" do
4
+ before do
5
5
  @alexa = Alexa::UrlInfo.new(
6
6
  :access_key_id => "12345678901234567890",
7
7
  :secret_access_key => "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDF",
@@ -9,12 +9,12 @@ class UrlInfoTest < Test::Unit::TestCase
9
9
  )
10
10
  end
11
11
 
12
- should "Generate signature" do
12
+ it "should Generate signature" do
13
13
  @alexa.stubs(:timestamp).returns("2009-07-03T07:22:24.000Z")
14
14
  assert_equal "I1mPdBy+flhhzqqUaamNq9gq190=", @alexa.send(:signature)
15
15
  end
16
16
 
17
- should "Generate url" do
17
+ it "should Generate url" do
18
18
  @alexa.stubs(:timestamp).returns("2009-07-03T07:22:24.000Z")
19
19
  @alexa.response_group = "Rank,ContactInfo,AdultContent,Speed,Language,Keywords,OwnedDomains,LinksInCount,SiteData,RelatedLinks"
20
20
  @alexa.host = "heroku.com"
@@ -23,166 +23,157 @@ class UrlInfoTest < Test::Unit::TestCase
23
23
  assert_equal "awis.amazonaws.com", @alexa.send(:url).host
24
24
  end
25
25
 
26
- context "should parse xml return by options LinksInCount,SiteData" do
27
- setup do
26
+ describe "parsing xml returned by options LinksInCount,SiteData" do
27
+ before do
28
28
  @alexa.response_group = "Rank,LinksInCount,SiteData"
29
29
  xml = fixture_file('polsl_small.xml')
30
30
  @alexa.parse_xml(xml)
31
31
  end
32
32
 
33
- should "return rank" do
33
+ it "should return rank" do
34
34
  assert_equal 86020, @alexa.rank
35
35
  end
36
36
 
37
- should "return data url" do
37
+ it "should return data url" do
38
38
  assert_equal "polsl.pl/", @alexa.data_url
39
39
  end
40
40
 
41
- should "return site title" do
41
+ it "should return site title" do
42
42
  assert_equal "Silesian University of Technology", @alexa.site_title
43
43
  end
44
44
 
45
- should "return site description" do
45
+ it "should return site description" do
46
46
  assert_equal "About the university, studies, faculties and departments, photo gallery.", @alexa.site_description
47
47
  end
48
48
 
49
- should "not crash" do
50
- assert_nothing_raised do
51
- @alexa.language_locale
52
- end
49
+ it "should not crash" do
53
50
  assert_nil @alexa.language_locale
54
51
  end
55
52
  end
56
53
 
57
- context "should parse xml with all options" do
58
- setup do
54
+ describe "parsing xml with all options" do
55
+ before do
59
56
  xml = fixture_file('polsl.xml')
60
57
  @alexa.parse_xml(xml)
61
58
  end
62
59
 
63
- should "return rank" do
60
+ it "should return rank" do
64
61
  assert_equal 86020, @alexa.rank
65
62
  end
66
63
 
67
- should "return data url" do
64
+ it "should return data url" do
68
65
  assert_equal "polsl.pl", @alexa.data_url
69
66
  end
70
67
 
71
- should "return site title" do
68
+ it "should return site title" do
72
69
  assert_equal "Silesian University of Technology", @alexa.site_title
73
70
  end
74
71
 
75
- should "return site description" do
72
+ it "should return site description" do
76
73
  assert_equal "About the university, studies, faculties and departments, photo gallery.", @alexa.site_description
77
74
  end
78
75
 
79
- should "return language locale" do
76
+ it "should return language locale" do
80
77
  assert_equal "pl-PL", @alexa.language_locale
81
78
  end
82
79
 
83
- should "return language encoding" do
80
+ it "should return language encoding" do
84
81
  assert_equal "iso-8859-2", @alexa.language_encoding
85
82
  end
86
83
 
87
- should "return links in count" do
84
+ it "should return links in count" do
88
85
  assert_equal 281, @alexa.links_in_count
89
86
  end
90
87
 
91
- should "return keywords" do
88
+ it "should return keywords" do
92
89
  assert_equal ["Polska", "Regionalne", "Gliwice"], @alexa.keywords
93
90
  end
94
91
 
95
- should "return related links" do
92
+ it "should return related links" do
96
93
  assert_equal 10, @alexa.related_links.size
97
94
  end
98
95
 
99
- should "return speed_median load time" do
96
+ it "should return speed_median load time" do
100
97
  assert_equal 266, @alexa.speed_median_load_time
101
98
  end
102
99
 
103
- should "return speed percentile" do
100
+ it "should return speed percentile" do
104
101
  assert_equal 98, @alexa.speed_percentile
105
102
  end
106
103
 
107
- should "return rank by country" do
104
+ it "should return rank by country" do
108
105
  assert_equal 3, @alexa.rank_by_country.size
109
106
  end
110
107
 
111
- should "return rank by city" do
108
+ it "should return rank by city" do
112
109
  assert_equal 68, @alexa.rank_by_city.size
113
110
  end
114
111
 
115
- should "return usage statistics" do
112
+ it "should return usage statistics" do
116
113
  assert_equal 4, @alexa.usage_statistics.size
117
114
  end
118
115
  end
119
116
 
120
- context "should not crash when parsing empty xml response" do
121
- setup do
117
+ describe "parsing empty xml response" do
118
+ before do
122
119
  xml = fixture_file('empty.xml')
123
120
  @alexa.parse_xml(xml)
124
121
  end
125
122
 
126
- should "return nil from rank" do
123
+ it "should return nil from rank" do
127
124
  assert_nil @alexa.rank
128
125
  end
129
126
 
130
- should "return nil from data_url" do
127
+ it "should return nil from data_url" do
131
128
  assert_equal "404", @alexa.data_url
132
129
  end
133
130
 
134
- should "return nil from site_title" do
131
+ it "should return nil from site_title" do
135
132
  assert_equal "404", @alexa.site_title
136
133
  end
137
134
 
138
- should "return nil from site_description" do
135
+ it "should return nil from site_description" do
139
136
  assert_nil @alexa.site_description
140
137
  end
141
138
 
142
- should "return nil from language_locale" do
139
+ it "should return nil from language_locale" do
143
140
  assert_nil @alexa.language_locale
144
141
  end
145
142
 
146
- should "return nil from language_encoding" do
143
+ it "should return nil from language_encoding" do
147
144
  assert_nil @alexa.language_encoding
148
145
  end
149
146
 
150
- should "return nil from links_in_count" do
147
+ it "should return nil from links_in_count" do
151
148
  assert_nil @alexa.links_in_count
152
149
  end
153
150
 
154
- should "return nil from keywords" do
151
+ it "should return nil from keywords" do
155
152
  assert_nil @alexa.keywords
156
153
  end
157
154
 
158
- should "return nil from related_links" do
155
+ it "should return nil from related_links" do
159
156
  assert_nil @alexa.related_links
160
157
  end
161
158
 
162
- should "return nil from speed_median_load_time" do
159
+ it "should return nil from speed_median_load_time" do
163
160
  assert_nil @alexa.speed_median_load_time
164
161
  end
165
162
 
166
- should "return nil from speed_percentile" do
163
+ it "should return nil from speed_percentile" do
167
164
  assert_nil @alexa.speed_percentile
168
165
  end
169
166
 
170
- should "return nil from rank_by_country" do
167
+ it "should return nil from rank_by_country" do
171
168
  assert_nil @alexa.rank_by_country
172
169
  end
173
170
 
174
- should "return nil from rank_by_city" do
171
+ it "should return nil from rank_by_city" do
175
172
  assert_nil @alexa.rank_by_city
176
173
  end
177
174
 
178
- should "return nil from usage_statistics" do
175
+ it "should return nil from usage_statistics" do
179
176
  assert_nil @alexa.usage_statistics
180
177
  end
181
178
  end
182
-
183
- should "not raise error when response is OK" do
184
- assert_nothing_raised do
185
- @alexa.send :handle_response, Net::HTTPOK.new("1.1", "200", "OK")
186
- end
187
- end
188
179
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: alexa
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Wojciech Wn\xC4\x99trzak"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-04 00:00:00 Z
13
+ date: 2011-05-05 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: xml-simple
@@ -24,7 +24,7 @@ dependencies:
24
24
  prerelease: false
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
27
- name: test-unit
27
+ name: mocha
28
28
  requirement: &id002 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
@@ -34,28 +34,6 @@ dependencies:
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: shoulda
39
- requirement: &id003 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
45
- type: :development
46
- prerelease: false
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: mocha
50
- requirement: &id004 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
56
- type: :development
57
- prerelease: false
58
- version_requirements: *id004
59
37
  description: Alexa Web Information Service library (AWIS)
60
38
  email:
61
39
  - w.wnetrzak@gmail.com
@@ -95,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
73
  requirements:
96
74
  - - ">="
97
75
  - !ruby/object:Gem::Version
98
- hash: -201747439707847299
76
+ hash: -3761737575741442318
99
77
  segments:
100
78
  - 0
101
79
  version: "0"
@@ -104,14 +82,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
82
  requirements:
105
83
  - - ">="
106
84
  - !ruby/object:Gem::Version
107
- hash: -201747439707847299
85
+ hash: -3761737575741442318
108
86
  segments:
109
87
  - 0
110
88
  version: "0"
111
89
  requirements: []
112
90
 
113
91
  rubyforge_project: alexa
114
- rubygems_version: 1.7.2
92
+ rubygems_version: 1.8.0
115
93
  signing_key:
116
94
  specification_version: 3
117
95
  summary: Alexa Web Information Service library