localwiki_client 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.travis.yml +2 -1
  4. data/History.txt +11 -0
  5. data/README.md +33 -0
  6. data/Rakefile +19 -2
  7. data/integration/helper.rb +9 -0
  8. data/{spec/integration → integration}/live_saltlake_wiki_spec.rb +2 -2
  9. data/integration/live_test_wiki_spec.rb +47 -0
  10. data/lib/localwiki/client.rb +131 -38
  11. data/lib/localwiki/version.rb +1 -1
  12. data/localwiki_client.gemspec +6 -2
  13. data/spec/basic_crud_spec.rb +67 -0
  14. data/spec/basic_spec.rb +34 -0
  15. data/spec/fetch_version_spec.rb +43 -0
  16. data/spec/fixtures/cassettes/basic.yml +91 -0
  17. data/spec/fixtures/cassettes/basic_crud.yml +90 -0
  18. data/spec/fixtures/cassettes/basic_crud_delete_fail.yml +42 -0
  19. data/spec/fixtures/cassettes/basic_crud_delete_success.yml +42 -0
  20. data/spec/fixtures/cassettes/basic_crud_read_fail.yml +52 -0
  21. data/spec/fixtures/cassettes/basic_crud_read_success.yml +40 -0
  22. data/spec/fixtures/cassettes/basic_crud_update_success.yml +42 -0
  23. data/spec/fixtures/cassettes/basic_fetch_version_success.yml +130 -0
  24. data/spec/fixtures/cassettes/basic_page_by_name_spaces.yml +41 -0
  25. data/spec/fixtures/cassettes/basic_unique_authors_success.yml +130 -0
  26. data/spec/fixtures/cassettes/fetch.yml +46 -0
  27. data/spec/fixtures/cassettes/localwiki_client.yml +366 -0
  28. data/spec/fixtures/cassettes/slug.yml +46 -0
  29. data/spec/helper.rb +15 -3
  30. data/spec/localwiki_client_spec.rb +31 -25
  31. data/spec/slug_spec.rb +26 -0
  32. metadata +100 -61
  33. data/localwiki_client-0.0.4.gem +0 -0
  34. data/spec/data/page_fetch.json +0 -9
  35. data/spec/data/site_fetch.json +0 -10
  36. data/spec/data/site_list.json +0 -18
  37. data/spec/data/user_list.json +0 -49
  38. data/spec/page_spec.rb +0 -41
  39. data/spec/site_spec.rb +0 -48
  40. data/spec/user_spec.rb +0 -41
data/spec/slug_spec.rb ADDED
@@ -0,0 +1,26 @@
1
+ require File.expand_path("../helper", __FILE__)
2
+
3
+ describe 'LocalwikiClient' do
4
+
5
+ before(:all) do
6
+ VCR.insert_cassette 'slug', :record => :new_episodes
7
+ @wiki = Localwiki::Client.new 'ec2-54-234-151-52.compute-1.amazonaws.com',
8
+ ENV['localwiki_client_user'],
9
+ ENV['localwiki_client_apikey']
10
+ end
11
+
12
+ after(:all) do
13
+ VCR.eject_cassette
14
+ end
15
+
16
+ context '#slugify' do
17
+
18
+ it 'handles spaces' do
19
+ @wiki.send(:slugify, 'Hello World').should eq 'Hello_World'
20
+ end
21
+
22
+ end
23
+ end
24
+
25
+
26
+
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localwiki_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brandon Faloona
@@ -10,153 +9,183 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-02-14 00:00:00.000000000 Z
12
+ date: 2013-03-16 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: faraday
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - '>='
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0'
31
28
  - !ruby/object:Gem::Dependency
32
- name: json
29
+ name: json_pure
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ! '>='
32
+ - - '>='
37
33
  - !ruby/object:Gem::Version
38
34
  version: '0'
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ! '>='
39
+ - - '>='
45
40
  - !ruby/object:Gem::Version
46
41
  version: '0'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rake
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ! '>='
46
+ - - '>='
53
47
  - !ruby/object:Gem::Version
54
48
  version: '0'
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - '>='
61
54
  - !ruby/object:Gem::Version
62
55
  version: '0'
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: rspec
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
- - - ! '>='
60
+ - - '>='
69
61
  - !ruby/object:Gem::Version
70
62
  version: 2.9.0
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
- - - ! '>='
67
+ - - '>='
77
68
  - !ruby/object:Gem::Version
78
69
  version: 2.9.0
79
70
  - !ruby/object:Gem::Dependency
80
- name: rspec-mocks
71
+ name: vcr
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
- - - ! '>='
74
+ - - '>='
85
75
  - !ruby/object:Gem::Version
86
- version: 2.9.0
76
+ version: '0'
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
- - - ! '>='
81
+ - - '>='
93
82
  - !ruby/object:Gem::Version
94
- version: 2.9.0
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: webmock
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: 1.8.0
91
+ - - <
92
+ - !ruby/object:Gem::Version
93
+ version: '1.10'
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: 1.8.0
101
+ - - <
102
+ - !ruby/object:Gem::Version
103
+ version: '1.10'
104
+ - !ruby/object:Gem::Dependency
105
+ name: yard
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ - !ruby/object:Gem::Dependency
119
+ name: kramdown
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
95
132
  - !ruby/object:Gem::Dependency
96
133
  name: rb-fsevent
97
134
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
135
  requirements:
100
- - - ! '>='
136
+ - - '>='
101
137
  - !ruby/object:Gem::Version
102
138
  version: '0'
103
139
  type: :development
104
140
  prerelease: false
105
141
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
142
  requirements:
108
- - - ! '>='
143
+ - - '>='
109
144
  - !ruby/object:Gem::Version
110
145
  version: '0'
111
146
  - !ruby/object:Gem::Dependency
112
147
  name: flog
113
148
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
149
  requirements:
116
- - - ! '>='
150
+ - - '>='
117
151
  - !ruby/object:Gem::Version
118
152
  version: '0'
119
153
  type: :development
120
154
  prerelease: false
121
155
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
156
  requirements:
124
- - - ! '>='
157
+ - - '>='
125
158
  - !ruby/object:Gem::Version
126
159
  version: '0'
127
160
  - !ruby/object:Gem::Dependency
128
161
  name: guard
129
162
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
163
  requirements:
132
- - - ! '>='
164
+ - - '>='
133
165
  - !ruby/object:Gem::Version
134
166
  version: '0'
135
167
  type: :development
136
168
  prerelease: false
137
169
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
170
  requirements:
140
- - - ! '>='
171
+ - - '>='
141
172
  - !ruby/object:Gem::Version
142
173
  version: '0'
143
174
  - !ruby/object:Gem::Dependency
144
175
  name: guard-rspec
145
176
  requirement: !ruby/object:Gem::Requirement
146
- none: false
147
177
  requirements:
148
- - - ! '>='
178
+ - - '>='
149
179
  - !ruby/object:Gem::Version
150
180
  version: '0'
151
181
  type: :development
152
182
  prerelease: false
153
183
  version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
184
  requirements:
156
- - - ! '>='
185
+ - - '>='
157
186
  - !ruby/object:Gem::Version
158
187
  version: '0'
159
- description: ! ' A thin client that wraps the Localwiki API. '
188
+ description: ' A thin client that wraps the Localwiki API. '
160
189
  email: brandon@faloona.net
161
190
  executables: []
162
191
  extensions: []
@@ -170,46 +199,56 @@ files:
170
199
  - History.txt
171
200
  - README.md
172
201
  - Rakefile
202
+ - integration/helper.rb
203
+ - integration/live_saltlake_wiki_spec.rb
204
+ - integration/live_test_wiki_spec.rb
173
205
  - lib/localwiki/client.rb
174
206
  - lib/localwiki/version.rb
175
207
  - lib/localwiki_client.rb
176
- - localwiki_client-0.0.4.gem
177
208
  - localwiki_client.gemspec
178
- - spec/data/page_fetch.json
179
- - spec/data/site_fetch.json
180
- - spec/data/site_list.json
181
- - spec/data/user_list.json
209
+ - spec/basic_crud_spec.rb
210
+ - spec/basic_spec.rb
211
+ - spec/fetch_version_spec.rb
212
+ - spec/fixtures/cassettes/basic.yml
213
+ - spec/fixtures/cassettes/basic_crud.yml
214
+ - spec/fixtures/cassettes/basic_crud_delete_fail.yml
215
+ - spec/fixtures/cassettes/basic_crud_delete_success.yml
216
+ - spec/fixtures/cassettes/basic_crud_read_fail.yml
217
+ - spec/fixtures/cassettes/basic_crud_read_success.yml
218
+ - spec/fixtures/cassettes/basic_crud_update_success.yml
219
+ - spec/fixtures/cassettes/basic_fetch_version_success.yml
220
+ - spec/fixtures/cassettes/basic_page_by_name_spaces.yml
221
+ - spec/fixtures/cassettes/basic_unique_authors_success.yml
222
+ - spec/fixtures/cassettes/fetch.yml
223
+ - spec/fixtures/cassettes/localwiki_client.yml
224
+ - spec/fixtures/cassettes/slug.yml
182
225
  - spec/helper.rb
183
- - spec/integration/live_saltlake_wiki_spec.rb
184
226
  - spec/localwiki_client_spec.rb
185
- - spec/page_spec.rb
186
- - spec/site_spec.rb
187
- - spec/user_spec.rb
227
+ - spec/slug_spec.rb
188
228
  homepage: http://github.com/bfaloona/localwiki_client
189
229
  licenses:
190
230
  - MIT
191
- post_install_message: ! "\n Thank you for installing localwiki_client 0.1.0\n "
231
+ metadata: {}
232
+ post_install_message: "\n Thank you for installing localwiki_client 0.2.0\n "
192
233
  rdoc_options:
193
234
  - --charset=UTF-8
194
235
  require_paths:
195
236
  - lib
196
237
  required_ruby_version: !ruby/object:Gem::Requirement
197
- none: false
198
238
  requirements:
199
- - - ! '>='
239
+ - - '>='
200
240
  - !ruby/object:Gem::Version
201
241
  version: 1.9.2
202
242
  required_rubygems_version: !ruby/object:Gem::Requirement
203
- none: false
204
243
  requirements:
205
- - - ! '>='
244
+ - - '>='
206
245
  - !ruby/object:Gem::Version
207
246
  version: '0'
208
247
  requirements: []
209
248
  rubyforge_project:
210
- rubygems_version: 1.8.24
249
+ rubygems_version: 2.0.0
211
250
  signing_key:
212
- specification_version: 3
213
- summary: localwiki_client-0.1.0
251
+ specification_version: 4
252
+ summary: localwiki_client-0.2.0
214
253
  test_files: []
215
254
  has_rdoc:
Binary file
@@ -1,9 +0,0 @@
1
- {
2
- "content": "<p>\n\t </p>\n<table class=\"details\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Location</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<p>\n\t\t\t\t\t2918 Southwest Avalon Way</p>\n\t\t\t\t<p>\n\t\t\t\t\tSeattle, WA 98126</p>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Hours</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t7am - 10pm Everyday</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Phone</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t(206) 935-7250</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Website</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t<a href=\"http://www.lunaparkcafe.com/\">lunaparkcafe.com</a></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Established</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\tMarch 18th, 1989</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Price range</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t$10</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Payment Methods</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\tCash, credit cards</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color: rgb(232, 236, 239);\">\n\t\t\t\t<strong>Wheelchair accessibility</strong></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\tNo stairs.</td>\n\t\t</tr>\n\t</tbody>\n</table>\n<p>\n\tFantastic diner filled with historic references to the Luna Park amusement park.</p>\n<p>\n\t<span class=\"image_frame image_frame_border\"><img src=\"_files/luna_park_cafe_front.jpg\" style=\"width: 300px; height: 225px;\"></span><span class=\"image_frame image_frame_border\"><img src=\"_files/luna_park_cafe_batmobile_ride.jpg\" style=\"width: 300px; height: 225px;\"></span></p>\n<h3>\n\tRelated Links</h3>\n<ul>\n\t<li>\n\t\t<a href=\"Restaurants\">Restaurants</a></li>\n</ul>\n<p>\n\t </p>\n",
3
- "id": 572,
4
- "map": "/api/map/Luna_Park_Cafe",
5
- "name": "Luna Park Cafe",
6
- "page_tags": "/api/page_tags/Luna_Park_Cafe",
7
- "resource_uri": "/api/page/Luna_Park_Cafe",
8
- "slug": "luna park cafe"
9
- }
@@ -1,10 +0,0 @@
1
- {
2
- "domain": "mockwiki.foo",
3
- "id": 1,
4
- "language_code": "en-us",
5
- "license": "<p>Except where otherwise noted, this content is licensed under a <a rel=\" license\" href=\"http://creativecommons.org/licenses/by/3.0/\">Creative Commons Attribution License</a>. See <a href=\"/Copyrights\">Copyrights.</p>",
6
- "name": "Salt Lake Wiki",
7
- "resource_uri": "/api/site/1",
8
- "signup_tos": "I agree to release my contributions under the <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\" target=\"_blank\">Creative Commons-By license</a>, unless noted otherwise. See <a href=\"/Copyrights\" target=\"_blank\">Copyrights</a>.",
9
- "time_zone": "America/Chicago"
10
- }
@@ -1,18 +0,0 @@
1
- {"meta": {
2
- "limit": 20,
3
- "next": null,
4
- "offset": 0,
5
- "previous": null,
6
- "total_count": 1
7
- }, "objects": [
8
- {
9
- "domain": "seattlewiki.net",
10
- "id": 1,
11
- "language_code": "en-us",
12
- "license": "<p>Except where otherwise noted, this content is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\">Creative Commons Attribution License</a>. See <a href=\"/Copyrights\">Copyrights.</p>",
13
- "name": "SeattleWiki",
14
- "resource_uri": "/api/site/1",
15
- "signup_tos": "I agree to release my contributions under the <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/3.0/\" target=\"_blank\">Creative Commons-By license</a>, unless noted otherwise. See <a href=\"/Copyrights\" target=\"_blank\">Copyrights</a>.",
16
- "time_zone": "America/Chicago"
17
- }
18
- ]}
@@ -1,49 +0,0 @@
1
- {
2
- "meta": {
3
- "limit": 0,
4
- "offset": 0,
5
- "total_count": 6
6
- }, "objects": [
7
- {
8
- "date_joined": "2012-10-05T21:12:34.103559",
9
- "first_name": "",
10
- "last_name": "",
11
- "resource_uri": "",
12
- "username": "AnonymousUser"
13
- },
14
- {
15
- "date_joined": "2012-11-02T15:24:44.621040",
16
- "first_name": "Lou",
17
- "last_name": "Davis",
18
- "resource_uri": "/api/user/3",
19
- "username": "loudavis"
20
- },
21
- {
22
- "date_joined": "2012-10-17T14:01:40.778496",
23
- "first_name": "Tod",
24
- "last_name": "Davis",
25
- "resource_uri": "/api/user/2",
26
- "username": "toddavis"
27
- },
28
- {
29
- "date_joined": "2012-11-20T21:47:33.152069",
30
- "first_name": "Jessie",
31
- "last_name": "Me",
32
- "resource_uri": "/api/user/4",
33
- "username": "jessieme"
34
- },
35
- {
36
- "date_joined": "2012-10-05T21:12:33",
37
- "first_name": "Andrew",
38
- "last_name": "Drew",
39
- "resource_uri": "/api/user/1",
40
- "username": "andrewdrew"
41
- },
42
- {
43
- "date_joined": "2012-12-08T15:33:29.251275",
44
- "first_name": "Ryan",
45
- "last_name": "Buyin",
46
- "resource_uri": "/api/user/5",
47
- "username": "ryanbuyin"
48
- }
49
- ]}
data/spec/page_spec.rb DELETED
@@ -1,41 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
- require 'localwiki_client'
3
- require 'rspec/mocks'
4
- require 'helper'
5
-
6
- describe Localwiki::Client do
7
-
8
- context 'page' do
9
-
10
- before(:all) do
11
- @site_fetch_json = load_json 'site_fetch.json'
12
- end
13
-
14
- subject { Localwiki::Client.new 'mockwiki.foo' }
15
-
16
- context "#page_by_name('Luna Park Cafe')" do
17
- it 'has content matching "amusement park"' do
18
- response = double('response')
19
- response.stub(:body) { @site_fetch_json }
20
- conn = double('conn')
21
- Faraday.should_receive(:new
22
- ).with(
23
- { url: 'mockwiki.foo' }
24
- ).and_return(conn)
25
- conn.should_receive(:get
26
- ).with(
27
- 'http://mockwiki.foo/api/site/1',
28
- {format: 'json'}
29
- ).and_return(response)
30
- response1 = double('response1')
31
- response1.stub(:body) { load_json 'page_fetch.json' }
32
- conn.should_receive(:get
33
- ).with(
34
- 'http://mockwiki.foo/api/page/Luna_Park_Cafe', {format: 'json'}
35
- ).and_return(response1)
36
- subject.page_by_name('Luna Park Cafe')['content'].should match(/amusement park/)
37
- end
38
- end
39
-
40
- end
41
- end
data/spec/site_spec.rb DELETED
@@ -1,48 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
- require 'localwiki_client'
3
- require 'rspec/mocks'
4
- require 'helper'
5
-
6
- describe Localwiki::Client do
7
-
8
- context 'site' do
9
-
10
- before(:all) do
11
- @site_fetch_json = load_json 'site_fetch.json'
12
- end
13
-
14
- before(:each) do
15
- response = double('response')
16
- response.stub(:body) { @site_fetch_json }
17
- conn = double('conn')
18
- Faraday.should_receive(:new
19
- ).with(
20
- { url: 'mockwiki.foo' }
21
- ).and_return(conn)
22
- # Faraday::Connection.any_instance
23
- conn.should_receive(:get
24
- ).with(
25
- 'http://mockwiki.foo/api/site/1',
26
- {format: 'json'}
27
- ).and_return(response)
28
- end
29
-
30
- subject { Localwiki::Client.new 'mockwiki.foo' }
31
-
32
- context 'attributes' do
33
-
34
- context '#site_name' do
35
- it { subject.site_name.should eq 'Salt Lake Wiki' }
36
- end
37
-
38
- context '#time_zone' do
39
- it { subject.time_zone.should eq 'America/Chicago' }
40
- end
41
-
42
- context '#language_code' do
43
- it { subject.language_code.should eq 'en-us'}
44
- end
45
-
46
- end
47
- end
48
- end
data/spec/user_spec.rb DELETED
@@ -1,41 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
- require 'localwiki_client'
3
- require 'rspec/mocks'
4
- require 'helper'
5
-
6
- describe Localwiki::Client do
7
-
8
- context 'user' do
9
-
10
- before(:all) do
11
- @site_fetch_json = load_json 'site_fetch.json'
12
- end
13
-
14
- subject { Localwiki::Client.new 'mockwiki.foo' }
15
-
16
- context '#total_resources("user")' do
17
- it 'should eq 6' do
18
- response = double('response')
19
- response.stub(:body) { @site_fetch_json }
20
- conn = double('conn')
21
- Faraday.should_receive(:new
22
- ).with(
23
- { url: 'mockwiki.foo' }
24
- ).and_return(conn)
25
- conn.should_receive(:get
26
- ).with(
27
- 'http://mockwiki.foo/api/site/1',
28
- {format: 'json'}
29
- ).and_return(response)
30
- response1 = double('response1')
31
- response1.stub(:body) { load_json 'user_list.json' }
32
- conn.should_receive(:get
33
- ).with(
34
- 'http://mockwiki.foo/api/user', {format: 'json', limit: '1'}
35
- ).and_return(response1)
36
- subject.count('user').should eq 6
37
- end
38
- end
39
-
40
- end
41
- end