ruby-trello 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,30 +5,30 @@ module Trello
5
5
  describe Organization do
6
6
  include Helpers
7
7
 
8
- let(:organization) { client.find(:organization, "4ee7e59ae582acdec8000291") }
8
+ let(:organization) { client.find(:organization, '4ee7e59ae582acdec8000291') }
9
9
  let(:client) { Client.new }
10
10
 
11
11
  before(:each) do
12
- client.stub(:get).with("/organizations/4ee7e59ae582acdec8000291", {}).
12
+ client.stub(:get).with('/organizations/4ee7e59ae582acdec8000291', {}).
13
13
  and_return organization_payload
14
14
  end
15
15
 
16
- context "finding" do
16
+ context 'finding' do
17
17
  let(:client) { Trello.client }
18
18
 
19
- it "delegates to Trello.client#find" do
19
+ it 'delegates to Trello.client#find' do
20
20
  client.should_receive(:find).with(:organization, '4ee7e59ae582acdec8000291', {})
21
21
  Organization.find('4ee7e59ae582acdec8000291')
22
22
  end
23
23
 
24
- it "is equivalent to client#find" do
24
+ it 'is equivalent to client#find' do
25
25
  Organization.find('4ee7e59ae582acdec8000291').should eq(organization)
26
26
  end
27
27
  end
28
28
 
29
- context "actions" do
30
- it "retrieves actions" do
31
- client.stub(:get).with("/organizations/4ee7e59ae582acdec8000291/actions", { :filter => :all }).and_return actions_payload
29
+ context 'actions' do
30
+ it 'retrieves actions' do
31
+ client.stub(:get).with('/organizations/4ee7e59ae582acdec8000291/actions', { :filter => :all }).and_return actions_payload
32
32
  organization.actions.count.should be > 0
33
33
  end
34
34
  end
data/spec/spec_helper.rb CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  Bundler.setup
12
12
  rescue Bundler::GemNotFound => e
13
13
  STDERR.puts e.message
14
- STDERR.puts "Try running `bundle install`."
14
+ STDERR.puts 'Try running `bundle install`.'
15
15
  exit!
16
16
  end
17
17
 
@@ -21,8 +21,7 @@ require 'trello'
21
21
  require 'webmock/rspec'
22
22
  require 'stringio'
23
23
 
24
- $strio = StringIO.new
25
- Trello.logger = Logger.new($strio)
24
+ Trello.logger = Logger.new(StringIO.new)
26
25
 
27
26
  RSpec.configure do |c|
28
27
  c.filter_run_excluding :broken => true
@@ -35,14 +34,14 @@ end
35
34
  module Helpers
36
35
  def user_details
37
36
  {
38
- "id" => "abcdef123456789012345678",
39
- "fullName" => "Test User",
40
- "username" => "me",
41
- "intials" => "TU",
42
- "avatarHash" => "abcdef1234567890abcdef1234567890",
43
- "bio" => "a rather dumb user",
44
- "url" => "https://trello.com/me",
45
- "email" => "johnsmith@example.com"
37
+ 'id' => 'abcdef123456789012345678',
38
+ 'fullName' => 'Test User',
39
+ 'username' => 'me',
40
+ 'intials' => 'TU',
41
+ 'avatarHash' => 'abcdef1234567890abcdef1234567890',
42
+ 'bio' => 'a rather dumb user',
43
+ 'url' => 'https://trello.com/me',
44
+ 'email' => 'johnsmith@example.com'
46
45
  }
47
46
  end
48
47
 
@@ -52,12 +51,12 @@ module Helpers
52
51
 
53
52
  def boards_details
54
53
  [{
55
- "id" => "abcdef123456789123456789",
56
- "name" => "Test",
57
- "desc" => "This is a test board",
58
- "closed" => false,
59
- "idOrganization" => "abcdef123456789123456789",
60
- "url" => "https://trello.com/board/test/abcdef123456789123456789"
54
+ 'id' => 'abcdef123456789123456789',
55
+ 'name' => 'Test',
56
+ 'desc' => 'This is a test board',
57
+ 'closed' => false,
58
+ 'idOrganization' => 'abcdef123456789123456789',
59
+ 'url' => 'https://trello.com/board/test/abcdef123456789123456789'
61
60
  }]
62
61
  end
63
62
 
@@ -67,15 +66,15 @@ module Helpers
67
66
 
68
67
  def checklists_details
69
68
  [{
70
- "id" => "abcdef123456789123456789",
71
- "name" => "Test Checklist",
72
- "desc" => "A marvelous little checklist",
73
- "closed" => false,
74
- "url" => "https://trello.com/blah/blah",
75
- "idBoard" => "abcdef123456789123456789",
76
- "idList" => "abcdef123456789123456789",
77
- "idMembers" => ["abcdef123456789123456789"],
78
- "checkItems" => { "id" => "ghijk987654321" }
69
+ 'id' => 'abcdef123456789123456789',
70
+ 'name' => 'Test Checklist',
71
+ 'desc' => 'A marvelous little checklist',
72
+ 'closed' => false,
73
+ 'url' => 'https://trello.com/blah/blah',
74
+ 'idBoard' => 'abcdef123456789123456789',
75
+ 'idList' => 'abcdef123456789123456789',
76
+ 'idMembers' => ['abcdef123456789123456789'],
77
+ 'checkItems' => { 'id' => 'ghijk987654321' }
79
78
  }]
80
79
  end
81
80
 
@@ -85,11 +84,11 @@ module Helpers
85
84
 
86
85
  def lists_details
87
86
  [{
88
- "id" => "abcdef123456789123456789",
89
- "name" => "To Do",
90
- "closed" => false,
91
- "idBoard" => "abcdef123456789123456789",
92
- "cards" => cards_details
87
+ 'id' => 'abcdef123456789123456789',
88
+ 'name' => 'To Do',
89
+ 'closed' => false,
90
+ 'idBoard' => 'abcdef123456789123456789',
91
+ 'cards' => cards_details
93
92
  }]
94
93
  end
95
94
 
@@ -99,17 +98,17 @@ module Helpers
99
98
 
100
99
  def cards_details
101
100
  [{
102
- "id" => "abcdef123456789123456789",
103
- "idShort" => "1",
104
- "name" => "Do something awesome",
105
- "desc" => "Awesome things are awesome.",
106
- "closed" => false,
107
- "idList" => "abcdef123456789123456789",
108
- "idBoard" => "abcdef123456789123456789",
109
- "idMembers" => ["abcdef123456789123456789"],
110
- "url" => "https://trello.com/card/board/specify-the-type-and-scope-of-the-jit-in-a-lightweight-spec/abcdef123456789123456789/abcdef123456789123456789",
111
- "pos" => 12,
112
- "dateLastActivity" => "2012-12-07T18:40:24.314Z"
101
+ 'id' => 'abcdef123456789123456789',
102
+ 'idShort' => '1',
103
+ 'name' => 'Do something awesome',
104
+ 'desc' => 'Awesome things are awesome.',
105
+ 'closed' => false,
106
+ 'idList' => 'abcdef123456789123456789',
107
+ 'idBoard' => 'abcdef123456789123456789',
108
+ 'idMembers' => ['abcdef123456789123456789'],
109
+ 'url' => 'https://trello.com/card/board/specify-the-type-and-scope-of-the-jit-in-a-lightweight-spec/abcdef123456789123456789/abcdef123456789123456789',
110
+ 'pos' => 12,
111
+ 'dateLastActivity' => '2012-12-07T18:40:24.314Z'
113
112
  }]
114
113
  end
115
114
 
@@ -120,22 +119,22 @@ module Helpers
120
119
 
121
120
  def attachments_details
122
121
  [{
123
- "id" => "abcdef123456789123456789",
124
- "name" => "attachment1.png",
125
- "url" => "http://trello-assets.domain.tld/attachment1.png",
126
- "bytes" => 98765,
127
- "idMember" => "abcdef123456789123456781",
128
- "isUpload" => false,
129
- "date" => "2013-02-28T17:12:28.497Z",
122
+ 'id' => 'abcdef123456789123456789',
123
+ 'name' => 'attachment1.png',
124
+ 'url' => 'http://trello-assets.domain.tld/attachment1.png',
125
+ 'bytes' => 98765,
126
+ 'idMember' => 'abcdef123456789123456781',
127
+ 'isUpload' => false,
128
+ 'date' => '2013-02-28T17:12:28.497Z',
130
129
  },
131
130
  {
132
- "id" => "abcdef123456789123456781",
133
- "name" => "attachment2.png",
134
- "url" => "http://trello-assets.domain.tld/attachment2.png",
135
- "bytes" => 89123,
136
- "idMember" => "abcdef123456789123456782",
137
- "isUpload" => true,
138
- "date" => "2013-03-01T14:01:25.212Z",
131
+ 'id' => 'abcdef123456789123456781',
132
+ 'name' => 'attachment2.png',
133
+ 'url' => 'http://trello-assets.domain.tld/attachment2.png',
134
+ 'bytes' => 89123,
135
+ 'idMember' => 'abcdef123456789123456782',
136
+ 'isUpload' => true,
137
+ 'date' => '2013-03-01T14:01:25.212Z',
139
138
  }]
140
139
  end
141
140
 
@@ -149,11 +148,11 @@ module Helpers
149
148
 
150
149
  def orgs_details
151
150
  [{
152
- "id" => "abcdef123456789123456789",
153
- "name" => "test",
154
- "displayName" => "Test Organization",
155
- "desc" => "This is a test organization",
156
- "url" => "https://trello.com/test"
151
+ 'id' => 'abcdef123456789123456789',
152
+ 'name' => 'test',
153
+ 'displayName' => 'Test Organization',
154
+ 'desc' => 'This is a test organization',
155
+ 'url' => 'https://trello.com/test'
157
156
  }]
158
157
  end
159
158
 
@@ -163,24 +162,24 @@ module Helpers
163
162
 
164
163
  def actions_details
165
164
  [{
166
- "id" => "4ee2482134a81a757a08af47",
167
- "idMemberCreator" => "abcdef123456789123456789",
168
- "data"=> {
169
- "card" => {
170
- "id" => "4ee2482134a81a757a08af45",
171
- "name" => "Bytecode outputter"
165
+ 'id' => '4ee2482134a81a757a08af47',
166
+ 'idMemberCreator' => 'abcdef123456789123456789',
167
+ 'data'=> {
168
+ 'card' => {
169
+ 'id' => '4ee2482134a81a757a08af45',
170
+ 'name' => 'Bytecode outputter'
172
171
  },
173
- "board" => {
174
- "id" => "4ec54f2f73820a0dea0d1f0e",
175
- "name" => "Caribou VM"
172
+ 'board' => {
173
+ 'id' => '4ec54f2f73820a0dea0d1f0e',
174
+ 'name' => 'Caribou VM'
176
175
  },
177
- "list" => {
178
- "id" => "4ee238b034a81a757a05cda0",
179
- "name" => "Assembler"
176
+ 'list' => {
177
+ 'id' => '4ee238b034a81a757a05cda0',
178
+ 'name' => 'Assembler'
180
179
  }
181
180
  },
182
- "date" => "2012-02-10T11:32:17Z",
183
- "type" => "createCard"
181
+ 'date' => '2012-02-10T11:32:17Z',
182
+ 'type' => 'createCard'
184
183
  }]
185
184
  end
186
185
 
@@ -190,22 +189,22 @@ module Helpers
190
189
 
191
190
  def notification_details
192
191
  {
193
- "id" => "4f30d084d5b0f7ab453bee51",
194
- "unread" => false,
195
- "type" => "commentCard",
196
- "date" => "2012-02-07T07:19:32.393Z",
197
- "data" => {
198
- "board" => {
199
- "id" => "abcdef123456789123456789",
200
- "name" => "Test"
192
+ 'id' => '4f30d084d5b0f7ab453bee51',
193
+ 'unread' => false,
194
+ 'type' => 'commentCard',
195
+ 'date' => '2012-02-07T07:19:32.393Z',
196
+ 'data' => {
197
+ 'board' => {
198
+ 'id' => 'abcdef123456789123456789',
199
+ 'name' => 'Test'
201
200
  },
202
- "card"=>{
203
- "id" => "abcdef123456789123456789",
204
- "name" => "Do something awesome"
201
+ 'card'=>{
202
+ 'id' => 'abcdef123456789123456789',
203
+ 'name' => 'Do something awesome'
205
204
  },
206
- "text" => "test"
205
+ 'text' => 'test'
207
206
  },
208
- "idMemberCreator" => "abcdef123456789012345678"
207
+ 'idMemberCreator' => 'abcdef123456789012345678'
209
208
  }
210
209
  end
211
210
 
@@ -215,21 +214,21 @@ module Helpers
215
214
 
216
215
  def organization_details
217
216
  {
218
- "id" => "4ee7e59ae582acdec8000291",
219
- "name" => "publicorg",
220
- "desc" => "This is a test organization",
221
- "members" => [{
222
- "id" => "4ee7df3ce582acdec80000b2",
223
- "username" => "alicetester",
224
- "fullName" => "Alice Tester"
217
+ 'id' => '4ee7e59ae582acdec8000291',
218
+ 'name' => 'publicorg',
219
+ 'desc' => 'This is a test organization',
220
+ 'members' => [{
221
+ 'id' => '4ee7df3ce582acdec80000b2',
222
+ 'username' => 'alicetester',
223
+ 'fullName' => 'Alice Tester'
225
224
  }, {
226
- "id" => "4ee7df74e582acdec80000b6",
227
- "username" => "davidtester",
228
- "fullName" => "David Tester"
225
+ 'id' => '4ee7df74e582acdec80000b6',
226
+ 'username' => 'davidtester',
227
+ 'fullName' => 'David Tester'
229
228
  }, {
230
- "id" => "4ee7e2e1e582acdec8000112",
231
- "username" => "edtester",
232
- "fullName" => "Ed Tester"
229
+ 'id' => '4ee7e2e1e582acdec8000112',
230
+ 'username' => 'edtester',
231
+ 'fullName' => 'Ed Tester'
233
232
  }]
234
233
  }
235
234
  end
@@ -240,27 +239,27 @@ module Helpers
240
239
 
241
240
  def token_details
242
241
  {
243
- "id" => "4f2c10c7b3eb95a45b294cd5",
244
- "idMember" => "abcdef123456789123456789",
245
- "dateCreated" => "2012-02-03T16:52:23.661Z",
246
- "permissions" => [
242
+ 'id' => '4f2c10c7b3eb95a45b294cd5',
243
+ 'idMember' => 'abcdef123456789123456789',
244
+ 'dateCreated' => '2012-02-03T16:52:23.661Z',
245
+ 'permissions' => [
247
246
  {
248
- "idModel" => "me",
249
- "modelType" => "Member",
250
- "read" => true,
251
- "write" => true
247
+ 'idModel' => 'me',
248
+ 'modelType' => 'Member',
249
+ 'read' => true,
250
+ 'write' => true
252
251
  },
253
252
  {
254
- "idModel" => "*",
255
- "modelType" => "Board",
256
- "read" => true,
257
- "write" => true
253
+ 'idModel' => '*',
254
+ 'modelType' => 'Board',
255
+ 'read' => true,
256
+ 'write' => true
258
257
  },
259
258
  {
260
- "idModel" => "*",
261
- "modelType" => "Organization",
262
- "read" => true,
263
- "write" => true
259
+ 'idModel' => '*',
260
+ 'modelType' => 'Organization',
261
+ 'read' => true,
262
+ 'write' => true
264
263
  }
265
264
  ]
266
265
  }
@@ -272,8 +271,8 @@ module Helpers
272
271
 
273
272
  def label_details
274
273
  [
275
- {"color" => "yellow", "name" => "iOS"},
276
- {"color" => "purple", "name" => "Issue or bug"}
274
+ {'color' => 'yellow', 'name' => 'iOS'},
275
+ {'color' => 'purple', 'name' => 'Issue or bug'}
277
276
  ]
278
277
  end
279
278
 
@@ -283,12 +282,12 @@ module Helpers
283
282
 
284
283
  def label_name_details
285
284
  [
286
- {"yellow" => "bug"},
287
- {"red" => "urgent"},
288
- {"green" => "deploy"},
289
- {"blue" => "on hold"},
290
- {"orange" => "new feature"},
291
- {"purple" => "experimental"}
285
+ {'yellow' => 'bug'},
286
+ {'red' => 'urgent'},
287
+ {'green' => 'deploy'},
288
+ {'blue' => 'on hold'},
289
+ {'orange' => 'new feature'},
290
+ {'purple' => 'experimental'}
292
291
  ]
293
292
  end
294
293
 
@@ -299,11 +298,11 @@ module Helpers
299
298
  def webhooks_details
300
299
  [
301
300
  {
302
- "id" => "webhookid",
303
- "description" => "Test webhook",
304
- "idModel" => "1234",
305
- "callbackURL" => "http://example.org/webhook",
306
- "active" => true
301
+ 'id' => 'webhookid',
302
+ 'description' => 'Test webhook',
303
+ 'idModel' => '1234',
304
+ 'callbackURL' => 'http://example.org/webhook',
305
+ 'active' => true
307
306
  }
308
307
  ]
309
308
  end
data/spec/string_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
- require "spec_helper"
2
- require "trello/string"
1
+ require 'spec_helper'
2
+ require 'trello/string'
3
3
 
4
- describe String, "#json_into" do
4
+ describe String, '#json_into' do
5
5
  include Helpers
6
6
 
7
7
  def example_class
@@ -15,11 +15,11 @@ describe String, "#json_into" do
15
15
  end
16
16
  end
17
17
 
18
- it "converts json into an instance of a class" do
19
- "{}".json_into(example_class).should be_an_instance_of example_class
18
+ it 'converts json into an instance of a class' do
19
+ '{}'.json_into(example_class).should be_an_instance_of example_class
20
20
  end
21
21
 
22
- it "supplies the parsed json to the class's ctor as a hash" do
22
+ it 'supplies the parsed json to the class ctor as a hash' do
23
23
  example_class.should_receive(:new).once.with({
24
24
  "name" => "Jazz Kang",
25
25
  "description" => "Plonker"
@@ -30,7 +30,7 @@ describe String, "#json_into" do
30
30
  json_text.json_into example_class
31
31
  end
32
32
 
33
- it "can also handle arrays of instances of a class" do
33
+ it 'can also handle arrays of instances of a class' do
34
34
  json_text = <<-JSON
35
35
  [
36
36
  {"name" : "Jazz Kang", "description": "Plonker"},