ruby-trello 0.4.4.3 → 0.5.0

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.
@@ -0,0 +1,68 @@
1
+ module Trello
2
+ class Configuration
3
+ CONFIGURABLE_ATTRIBUTES = [
4
+ :developer_public_key,
5
+ :member_token,
6
+ :consumer_key,
7
+ :consumer_secret,
8
+ :oauth_token,
9
+ :oauth_token_secret,
10
+ :callback,
11
+ :return_url
12
+ ]
13
+
14
+ attr_accessor *CONFIGURABLE_ATTRIBUTES
15
+
16
+ def self.configurable_attributes
17
+ CONFIGURABLE_ATTRIBUTES
18
+ end
19
+
20
+ def initialize(attrs = {})
21
+ self.attributes = attrs
22
+ end
23
+
24
+ def attributes=(attrs = {})
25
+ attrs.each { |key, value| instance_variable_set("@#{key}", value) }
26
+ end
27
+
28
+ def credentials
29
+ case
30
+ when oauth?
31
+ oauth_credentials
32
+ when basic?
33
+ basic_credentials
34
+ else
35
+ {}
36
+ end
37
+ end
38
+
39
+ def oauth?
40
+ consumer_key && consumer_secret
41
+ end
42
+
43
+ def basic?
44
+ developer_public_key && member_token
45
+ end
46
+
47
+ private
48
+
49
+ def oauth_credentials
50
+ {
51
+ :consumer_key => consumer_key,
52
+ :consumer_secret => consumer_secret,
53
+ :oauth_token => oauth_token,
54
+ :oauth_token_secret => oauth_token_secret,
55
+ :return_url => return_url,
56
+ :callback => callback,
57
+ }.delete_if { |key, value| value.nil? }
58
+ end
59
+
60
+ def basic_credentials
61
+ {
62
+ :developer_public_key => developer_public_key,
63
+ :member_token => member_token
64
+ }
65
+ end
66
+
67
+ end
68
+ end
@@ -2,7 +2,7 @@ module Trello
2
2
  module HasActions
3
3
  # Returns a list of the actions associated with this object.
4
4
  def actions(options = {})
5
- actions = Client.get("#{request_prefix}/actions", { :filter => :all }.merge(options)).json_into(Action)
5
+ actions = client.get("#{request_prefix}/actions", { :filter => :all }.merge(options)).json_into(Action)
6
6
  MultiAssociation.new(self, actions).proxy
7
7
  end
8
8
  end
data/lib/trello/list.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Trello
2
2
  # A List is a container which holds cards. Lists are items on a board.
3
3
  class List < BasicData
4
- register_attributes :id, :name, :closed, :board_id, :readonly => [ :id, :board_id ]
4
+ register_attributes :id, :name, :closed, :board_id, :pos, :readonly => [ :id, :board_id ]
5
5
  validates_presence_of :id, :name, :board_id
6
6
  validates_length_of :name, :in => 1..16384
7
7
 
@@ -10,12 +10,13 @@ module Trello
10
10
  class << self
11
11
  # Finds a specific list, given an id.
12
12
  def find(id)
13
- super(:lists, id)
13
+ client.find(:list, id)
14
14
  end
15
15
 
16
16
  def create(options)
17
- new('name' => options[:name],
18
- 'idBoard' => options[:board_id]).save
17
+ client.create(:list,
18
+ 'name' => options[:name],
19
+ 'idBoard' => options[:board_id])
19
20
  end
20
21
  end
21
22
 
@@ -28,13 +29,14 @@ module Trello
28
29
  attributes[:name] = fields['name']
29
30
  attributes[:closed] = fields['closed']
30
31
  attributes[:board_id] = fields['idBoard']
32
+ attributes[:pos] = fields['pos']
31
33
  self
32
34
  end
33
35
 
34
36
  def save
35
37
  return update! if id
36
38
 
37
- Client.post("/lists", {
39
+ client.post("/lists", {
38
40
  :name => name,
39
41
  :closed => closed || false,
40
42
  :idBoard => board_id
@@ -42,7 +44,7 @@ module Trello
42
44
  end
43
45
 
44
46
  def update!
45
- Client.put("/lists/#{id}", {
47
+ client.put("/lists/#{id}", {
46
48
  :name => name,
47
49
  :closed => closed
48
50
  })
@@ -63,7 +65,7 @@ module Trello
63
65
  end
64
66
 
65
67
  # Return the board the list is connected to.
66
- one :board, :using => :board_id
68
+ one :board, :path => :boards, :using => :board_id
67
69
 
68
70
  # Returns all the cards on this list.
69
71
  #
data/lib/trello/member.rb CHANGED
@@ -13,7 +13,7 @@ module Trello
13
13
  #
14
14
  # The argument may be specified as either an _id_ or a _username_.
15
15
  def find(id_or_username)
16
- super(:members, id_or_username)
16
+ client.find(:member, id_or_username)
17
17
  end
18
18
  end
19
19
 
@@ -32,7 +32,7 @@ module Trello
32
32
  end
33
33
 
34
34
  # Retrieve a URL to the avatar.
35
- #
35
+ #
36
36
  # Valid values for options are:
37
37
  # :large (170x170)
38
38
  # :small (30x30)
@@ -79,7 +79,7 @@ module Trello
79
79
  end
80
80
 
81
81
  def update!
82
- Client.put(request_prefix, {
82
+ client.put(request_prefix, {
83
83
  :fullName => full_name,
84
84
  :bio => bio
85
85
  }).json_into(self)
@@ -1,10 +1,12 @@
1
1
  module Trello
2
2
  class MultiAssociation < Association
3
- delegate :count, :to => :target
3
+ extend Forwardable
4
+
5
+ def_delegator :target, :count
4
6
 
5
7
  def initialize(owner, target = [])
6
8
  super
7
9
  @proxy = AssociationProxy.new(self)
8
10
  end
9
11
  end
10
- end
12
+ end
@@ -7,7 +7,7 @@ module Trello
7
7
  class << self
8
8
  # Locate a notification by its id
9
9
  def find(id)
10
- super(:notifications, id)
10
+ client.find(:notification, id)
11
11
  end
12
12
  end
13
13
 
@@ -23,26 +23,26 @@ module Trello
23
23
 
24
24
  alias :unread? :unread
25
25
 
26
- one :member_creator, :via => Member, :using => :member_creator_id
26
+ one :member_creator, :path => :members, :via => Member, :using => :member_creator_id
27
27
 
28
28
  def board
29
- Client.get("/notifications/#{id}/board").json_into(Board)
29
+ client.get("/notifications/#{id}/board").json_into(Board)
30
30
  end
31
31
 
32
32
  def list
33
- Client.get("/notifications/#{id}/list").json_into(List)
33
+ client.get("/notifications/#{id}/list").json_into(List)
34
34
  end
35
35
 
36
36
  def card
37
- Client.get("/notifications/#{id}/card").json_into(Card)
37
+ client.get("/notifications/#{id}/card").json_into(Card)
38
38
  end
39
39
 
40
40
  def member
41
- Client.get("/notifications/#{id}/member").json_into(Member)
41
+ client.get("/notifications/#{id}/member").json_into(Member)
42
42
  end
43
43
 
44
44
  def organization
45
- Client.get("/notifications/#{id}/organization").json_into(Organization)
45
+ client.get("/notifications/#{id}/organization").json_into(Organization)
46
46
  end
47
47
  end
48
- end
48
+ end
@@ -10,7 +10,7 @@ module Trello
10
10
  class << self
11
11
  # Find an organization by its id.
12
12
  def find(id)
13
- super(:organizations, id)
13
+ client.find(:organization, id)
14
14
  end
15
15
  end
16
16
 
@@ -29,13 +29,13 @@ module Trello
29
29
 
30
30
  # Returns a list of boards under this organization.
31
31
  def boards
32
- boards = Client.get("/organizations/#{id}/boards/all").json_into(Board)
32
+ boards = client.get("/organizations/#{id}/boards/all").json_into(Board)
33
33
  MultiAssociation.new(self, boards).proxy
34
34
  end
35
35
 
36
36
  # Returns an array of members associated with the organization.
37
37
  def members
38
- members = Client.get("/organizations/#{id}/members/all").json_into(Member)
38
+ members = client.get("/organizations/#{id}/members/all").json_into(Member)
39
39
  MultiAssociation.new(self, members).proxy
40
40
  end
41
41
 
data/lib/trello/token.rb CHANGED
@@ -2,11 +2,11 @@ module Trello
2
2
  class Token < BasicData
3
3
  register_attributes :id, :member_id, :created_at, :permissions,
4
4
  :readonly => [ :id, :member_id, :created_at, :permissions ]
5
-
5
+
6
6
  class << self
7
7
  # Finds a token
8
8
  def find(token)
9
- super(:tokens, token)
9
+ client.find(:token, token)
10
10
  end
11
11
  end
12
12
 
@@ -19,6 +19,6 @@ module Trello
19
19
  end
20
20
 
21
21
  # Returns a reference to the user who authorized the token.
22
- one :member, :using => :member_id
22
+ one :member, :path => :members, :using => :member_id
23
23
  end
24
- end
24
+ end
data/spec/action_spec.rb CHANGED
@@ -4,67 +4,79 @@ module Trello
4
4
  describe Action do
5
5
  include Helpers
6
6
 
7
+ let(:action) { client.find(:action, '4ee2482134a81a757a08af47') }
8
+ let(:client) { Client.new }
9
+
7
10
  before(:each) do
8
- Client.stub(:get).with("/actions/4ee2482134a81a757a08af47").
11
+ client.stub(:get).with("/actions/4ee2482134a81a757a08af47").
9
12
  and_return JSON.generate(actions_details.first)
13
+ end
14
+
15
+ context "finding" do
16
+ let(:client) { Trello.client }
17
+
18
+ it "delegates to Trello.client#find" do
19
+ client.should_receive(:find).with(:action, '4ee2482134a81a757a08af47')
20
+ Action.find('4ee2482134a81a757a08af47')
21
+ end
10
22
 
11
- @action = Action.find('4ee2482134a81a757a08af47')
23
+ it "is equivalent to client#find" do
24
+ Action.find('4ee2482134a81a757a08af47').should eq(action)
25
+ end
12
26
  end
13
27
 
14
28
  context "fields" do
15
- before(:all) do
16
- @detail = actions_details.first
17
- end
29
+ let(:detail) { actions_details.first }
18
30
 
19
31
  it "gets its id" do
20
- @action.id.should == @detail['id']
32
+ action.id.should == detail['id']
21
33
  end
22
34
 
23
35
  it "gets its type" do
24
- @action.type.should == @detail['type']
36
+ action.type.should == detail['type']
25
37
  end
26
38
 
27
39
  it "has the same data" do
28
- @action.data.should == @detail['data']
40
+ action.data.should == detail['data']
29
41
  end
30
42
 
31
43
  it "gets the date" do
32
- @action.date.utc.iso8601.should == @detail['date']
44
+ action.date.utc.iso8601.should == detail['date']
33
45
  end
34
46
  end
35
47
 
36
48
  context "boards" do
37
49
  it "has a board" do
38
- Client.stub(:get).with("/actions/4ee2482134a81a757a08af47/board").
50
+ client.stub(:get).with("/actions/4ee2482134a81a757a08af47/board").
39
51
  and_return JSON.generate(boards_details.first)
40
52
 
41
- @action.board.should_not be_nil
53
+ action.board.should_not be_nil
42
54
  end
43
55
  end
44
56
 
45
57
  context "card" do
46
58
  it "has a card" do
47
- Client.stub(:get).with("/actions/4ee2482134a81a757a08af47/card").
59
+ client.stub(:get).with("/actions/4ee2482134a81a757a08af47/card").
48
60
  and_return JSON.generate(cards_details.first)
49
-
50
- @action.card.should_not be_nil
61
+
62
+ action.card.should_not be_nil
51
63
  end
52
64
  end
53
65
 
54
66
  context "list" do
55
67
  it "has a list of lists" do
56
- Client.stub(:get).with("/actions/4ee2482134a81a757a08af47/list").
68
+ client.stub(:get).with("/actions/4ee2482134a81a757a08af47/list").
57
69
  and_return JSON.generate(lists_details.first)
58
70
 
59
- @action.list.should_not be_nil
71
+ action.list.should_not be_nil
60
72
  end
61
73
  end
62
74
 
63
75
  context "member creator" do
64
76
  it "knows its member creator" do
65
- Client.stub(:get).with("/members/abcdef123456789123456789").and_return user_payload
77
+ client.stub(:get).with("/members/abcdef123456789123456789").and_return user_payload
66
78
 
67
- @action.member_creator.should_not be_nil
79
+ action.member_creator.should_not be_nil
68
80
  end
69
81
  end
70
82
  end
@@ -1,5 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
+ include Trello
3
4
  include Trello::Authorization
4
5
 
5
6
  describe BasicAuthPolicy do
data/spec/board_spec.rb CHANGED
@@ -4,232 +4,253 @@ module Trello
4
4
  describe Board do
5
5
  include Helpers
6
6
 
7
+ let(:board) { client.find(:board, 'abcdef123456789123456789') }
8
+ let(:client) { Client.new }
9
+
7
10
  before(:each) do
8
- Client.stub(:get).with("/boards/abcdef123456789123456789").
11
+ client.stub(:get).with("/boards/abcdef123456789123456789").
9
12
  and_return JSON.generate(boards_details.first)
13
+ end
14
+
15
+ context "finding" do
16
+ let(:client) { Trello.client }
10
17
 
11
- @board = Board.find('abcdef123456789123456789')
18
+ it "delegates to client#find" do
19
+ client.should_receive(:find).with(:board, 'abcdef123456789123456789')
20
+ Board.find('abcdef123456789123456789')
21
+ end
22
+
23
+ it "is equivalent to client#find" do
24
+ Board.find('abcdef123456789123456789').should eq(board)
25
+ end
12
26
  end
13
27
 
14
- it "gets all boards" do
15
- Member.stub_chain(:find, :username).and_return "testuser"
16
- Client.stub(:get).with("/members/testuser/boards").and_return boards_payload
28
+ context "self.all" do
29
+ let(:client) { Trello.client }
17
30
 
18
- expected = Board.new(boards_details.first)
19
- Board.all.first.should eq(expected)
31
+ it "gets all boards" do
32
+ Member.stub_chain(:find, :username).and_return "testuser"
33
+ client.stub(:get).with("/members/testuser/boards").and_return boards_payload
34
+
35
+ expected = Board.new(boards_details.first)
36
+ Board.all.first.should eq(expected)
37
+ end
20
38
  end
21
39
 
22
40
  context "fields" do
23
41
  it "gets an id" do
24
- @board.id.should_not be_nil
42
+ board.id.should_not be_nil
25
43
  end
26
44
 
27
45
  it "gets a name" do
28
- @board.name.should_not be_nil
46
+ board.name.should_not be_nil
29
47
  end
30
48
 
31
49
  it "gets the description" do
32
- @board.description.should_not be_nil
50
+ board.description.should_not be_nil
33
51
  end
34
52
 
35
53
  it "knows if it is closed or open" do
36
- @board.closed?.should_not be_nil
54
+ board.closed?.should_not be_nil
37
55
  end
38
56
 
39
57
  it "gets its url" do
40
- @board.url.should_not be_nil
58
+ board.url.should_not be_nil
41
59
  end
42
60
  end
43
61
 
44
62
  context "actions" do
45
63
  it "has a list of actions" do
46
- Client.stub(:get).with("/boards/abcdef123456789123456789/actions", {:filter => :all}).
64
+ client.stub(:get).with("/boards/abcdef123456789123456789/actions", {:filter => :all}).
47
65
  and_return actions_payload
48
66
 
49
- @board.actions.count.should be > 0
67
+ board.actions.count.should be > 0
50
68
  end
51
69
  end
52
70
 
53
71
  context "cards" do
54
72
  it "gets its list of cards" do
55
- Client.stub(:get).with("/boards/abcdef123456789123456789/cards", { :filter => :open }).
73
+ client.stub(:get).with("/boards/abcdef123456789123456789/cards", { :filter => :open }).
56
74
  and_return cards_payload
57
75
 
58
- @board.cards.count.should be > 0
76
+ board.cards.count.should be > 0
59
77
  end
60
78
  end
61
79
 
62
80
  context "find_card" do
63
81
  it "gets a card" do
64
- Client.stub(:get).with("/boards/abcdef123456789123456789/cards/1").
82
+ client.stub(:get).with("/boards/abcdef123456789123456789/cards/1").
65
83
  and_return card_payload
66
- @board.find_card(1).should be_a(Card)
84
+ board.find_card(1).should be_a(Card)
67
85
  end
68
86
  end
69
87
 
70
88
  context "lists" do
71
89
  it "has a list of lists" do
72
- Client.stub(:get).with("/boards/abcdef123456789123456789/lists", hash_including(:filter => :open)).
90
+ client.stub(:get).with("/boards/abcdef123456789123456789/lists", hash_including(:filter => :open)).
73
91
  and_return lists_payload
74
92
 
75
- @board.has_lists?.should be true
93
+ board.has_lists?.should be true
76
94
  end
77
95
  end
78
96
 
79
97
  context "members" do
80
98
  it "has a list of members" do
81
- Client.stub(:get).with("/boards/abcdef123456789123456789/members", hash_including(:filter => :all)).
99
+ client.stub(:get).with("/boards/abcdef123456789123456789/members", hash_including(:filter => :all)).
82
100
  and_return JSON.generate([user_details])
83
101
 
84
- @board.members.count.should be > 0
102
+ board.members.count.should be > 0
85
103
  end
86
104
  end
87
105
 
88
106
  context "organization" do
89
107
  it "belongs to an organization" do
90
- Client.stub(:get).with("/organizations/abcdef123456789123456789").
108
+ client.stub(:get).with("/organizations/abcdef123456789123456789").
91
109
  and_return JSON.generate(orgs_details.first)
92
110
 
93
- @board.organization.should_not be_nil
111
+ board.organization.should_not be_nil
94
112
  end
95
113
  end
96
114
 
97
115
  it "is not closed" do
98
- @board.closed?.should_not be_true
116
+ board.closed?.should_not be_true
99
117
  end
100
- end
101
-
102
- describe "#update_fields" do
103
- it "does not set any fields when the fields argument is empty" do
104
- expected = {
105
- 'id' => "id",
106
- 'name' => "name",
107
- 'desc' => "desc",
108
- 'closed' => false,
109
- 'url' => "url",
110
- 'idOrganization' => "org_id"
111
- }
112
-
113
- board = Board.new(expected)
114
118
 
115
- board.update_fields({})
116
-
117
- expected.each_pair do |key, value|
118
- if board.respond_to?(key)
119
- board.send(key).should == value
119
+ describe "#update_fields" do
120
+ it "does not set any fields when the fields argument is empty" do
121
+ expected = {
122
+ 'id' => "id",
123
+ 'name' => "name",
124
+ 'desc' => "desc",
125
+ 'closed' => false,
126
+ 'url' => "url",
127
+ 'idOrganization' => "org_id"
128
+ }
129
+
130
+ board = Board.new(expected)
131
+ board.client = client
132
+
133
+ board.update_fields({})
134
+
135
+ expected.each_pair do |key, value|
136
+ if board.respond_to?(key)
137
+ board.send(key).should == value
138
+ end
120
139
  end
140
+
141
+ board.description.should == expected['desc']
142
+ board.organization_id.should == expected['idOrganization']
121
143
  end
122
144
 
123
- board.description.should == expected['desc']
124
- board.organization_id.should == expected['idOrganization']
145
+ it "sets any attributes supplied in the fields argument"
125
146
  end
126
147
 
127
- it "sets any attributes supplied in the fields argument"
128
- end
148
+ describe "#save" do
149
+ let(:client) { Trello.client }
129
150
 
130
- describe "#save" do
131
- include Helpers
151
+ let(:any_board_json) do
152
+ JSON.generate(boards_details.first)
153
+ end
132
154
 
133
- let(:any_board_json) do
134
- JSON.generate(boards_details.first)
135
- end
155
+ it "cannot currently save a new instance" do
156
+ client.should_not_receive :put
136
157
 
137
- it "cannot currently save a new instance" do
138
- Client.should_not_receive :put
158
+ the_new_board = Board.new
159
+ lambda{the_new_board.save}.should raise_error
160
+ end
139
161
 
140
- the_new_board = Board.new
141
- lambda{the_new_board.save}.should raise_error
142
- end
162
+ it "puts all fields except id" do
163
+ expected_fields = %w{name description closed}.map{|s| s.to_sym}
143
164
 
144
- it "puts all fields except id" do
145
- expected_fields = %w{name description closed}.map{|s| s.to_sym}
165
+ client.should_receive(:put) do |anything, body|
166
+ body.keys.should =~ expected_fields
167
+ any_board_json
168
+ end
146
169
 
147
- Client.should_receive(:put) do |anything, body|
148
- body.keys.should =~ expected_fields
149
- any_board_json
170
+ the_new_board = Board.new 'id' => "xxx"
171
+ the_new_board.save
150
172
  end
151
173
 
152
- the_new_board = Board.new 'id' => "xxx"
153
- the_new_board.save
154
- end
174
+ it "mutates the current instance" do
175
+ client.stub(:put).and_return any_board_json
155
176
 
156
- it "mutates the current instance" do
157
- Client.stub(:put).and_return any_board_json
177
+ board = Board.new 'id' => "xxx"
158
178
 
159
- board = Board.new 'id' => "xxx"
179
+ the_result_of_save = board.save
160
180
 
161
- the_result_of_save = board.save
181
+ the_result_of_save.should equal board
182
+ end
162
183
 
163
- the_result_of_save.should equal board
164
- end
184
+ it "uses the correct resource" do
185
+ expected_resource_id = "xxx_board_id_xxx"
165
186
 
166
- it "uses the correct resource" do
167
- expected_resource_id = "xxx_board_id_xxx"
187
+ client.should_receive(:put) do |path, anything|
188
+ path.should =~ /#{expected_resource_id}\/$/
189
+ any_board_json
190
+ end
168
191
 
169
- Client.should_receive(:put) do |path, anything|
170
- path.should =~ /#{expected_resource_id}\/$/
171
- any_board_json
192
+ the_new_board = Board.new 'id' => expected_resource_id
193
+ the_new_board.save
172
194
  end
173
195
 
174
- the_new_board = Board.new 'id' => expected_resource_id
175
- the_new_board.save
196
+ it "saves OR updates depending on whether or not it has an id set"
176
197
  end
177
198
 
178
- it "saves OR updates depending on whether or not it has an id set"
179
- end
180
-
181
- describe '#update!' do
182
- include Helpers
199
+ describe '#update!' do
200
+ let(:client) { Trello.client }
183
201
 
184
- let(:any_board_json) do
185
- JSON.generate(boards_details.first)
186
- end
202
+ let(:any_board_json) do
203
+ JSON.generate(boards_details.first)
204
+ end
187
205
 
188
- it "puts basic attributes" do
189
- board = Board.new 'id' => "board_id"
206
+ it "puts basic attributes" do
207
+ board = Board.new 'id' => "board_id"
190
208
 
191
- board.name = "new name"
192
- board.description = "new description"
193
- board.closed = true
209
+ board.name = "new name"
210
+ board.description = "new description"
211
+ board.closed = true
194
212
 
195
- Client.should_receive(:put).with("/boards/#{board.id}/", {
196
- :name => "new name",
197
- :description => "new description",
198
- :closed => true
199
- }).and_return any_board_json
200
- board.update!
213
+ client.should_receive(:put).with("/boards/#{board.id}/", {
214
+ :name => "new name",
215
+ :description => "new description",
216
+ :closed => true
217
+ }).and_return any_board_json
218
+ board.update!
219
+ end
201
220
  end
202
- end
203
221
 
204
- describe "Repository" do
205
- include Helpers
222
+ describe "Repository" do
223
+ include Helpers
206
224
 
207
- let(:any_board_json) do
208
- JSON.generate(boards_details.first)
209
- end
225
+ let(:client) { Trello.client }
210
226
 
211
- it "creates a new board with whatever attributes are supplied " do
212
- expected_attributes = { :name => "Any new board name", :description => "Any new board desription" }
213
- sent_attributes = { :name => expected_attributes[:name], :desc => expected_attributes[:description] }
227
+ let(:any_board_json) do
228
+ JSON.generate(boards_details.first)
229
+ end
214
230
 
215
- Client.should_receive(:post).with("/boards", sent_attributes).and_return any_board_json
231
+ it "creates a new board with whatever attributes are supplied " do
232
+ expected_attributes = { :name => "Any new board name", :description => "Any new board desription" }
233
+ sent_attributes = { :name => expected_attributes[:name], :desc => expected_attributes[:description] }
216
234
 
217
- Board.create expected_attributes
218
- end
235
+ client.should_receive(:post).with("/boards", sent_attributes).and_return any_board_json
219
236
 
220
- it "posts to the boards collection" do
221
- Client.should_receive(:post).with("/boards", anything).and_return any_board_json
237
+ Board.create expected_attributes
238
+ end
222
239
 
223
- Board.create :xxx => ""
224
- end
240
+ it "posts to the boards collection" do
241
+ client.should_receive(:post).with("/boards", anything).and_return any_board_json
225
242
 
226
- it "returns a board" do
227
- Client.stub(:post).with("/boards", anything).and_return any_board_json
243
+ Board.create :xxx => ""
244
+ end
228
245
 
229
- the_new_board = Board.create :xxx => ""
230
- the_new_board.should be_a Board
231
- end
246
+ it "returns a board" do
247
+ client.stub(:post).with("/boards", anything).and_return any_board_json
232
248
 
233
- it "at least name is required"
249
+ the_new_board = Board.create :xxx => ""
250
+ the_new_board.should be_a Board
251
+ end
252
+
253
+ it "at least name is required"
254
+ end
234
255
  end
235
256
  end