jira-ruby 0.0.4 → 0.1.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.
@@ -2,55 +2,55 @@ require 'spec_helper'
2
2
 
3
3
  describe JIRA::Resource::Project do
4
4
 
5
- let(:client) do
6
- client = JIRA::Client.new('foo', 'bar')
7
- client.set_access_token('abc', '123')
8
- client
9
- end
5
+ with_each_client do |site_url, client|
6
+ let(:client) { client }
7
+ let(:site_url) { site_url }
10
8
 
11
- let(:key) { "SAMPLEPROJECT" }
12
9
 
13
- let(:expected_attributes) do
14
- {
15
- 'self' => "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT",
16
- 'key' => key,
17
- 'name' => "Sample Project for Developing RoR RESTful API"
18
- }
19
- end
10
+ let(:key) { "SAMPLEPROJECT" }
11
+
12
+ let(:expected_attributes) do
13
+ {
14
+ 'self' => "http://localhost:2990/jira/rest/api/2/project/SAMPLEPROJECT",
15
+ 'key' => key,
16
+ 'name' => "Sample Project for Developing RoR RESTful API"
17
+ }
18
+ end
20
19
 
21
- let(:expected_collection_length) { 1 }
20
+ let(:expected_collection_length) { 1 }
22
21
 
23
- it_should_behave_like "a resource"
24
- it_should_behave_like "a resource with a collection GET endpoint"
25
- it_should_behave_like "a resource with a singular GET endpoint"
22
+ it_should_behave_like "a resource"
23
+ it_should_behave_like "a resource with a collection GET endpoint"
24
+ it_should_behave_like "a resource with a singular GET endpoint"
26
25
 
27
- describe "issues" do
26
+ describe "issues" do
27
+
28
+ it "returns all the issues" do
29
+ stub_request(:get, site_url + "/jira/rest/api/2/search?jql=project='SAMPLEPROJECT'").
30
+ to_return(:status => 200, :body => get_mock_response('project/SAMPLEPROJECT.issues.json'))
31
+ subject = client.Project.build('key' => key)
32
+ issues = subject.issues
33
+ issues.length.should == 11
34
+ issues.each do |issue|
35
+ issue.class.should == JIRA::Resource::Issue
36
+ issue.expanded?.should be_false
37
+ end
28
38
 
29
- it "returns all the issues" do
30
- stub_request(:get, "http://localhost:2990/jira/rest/api/2/search?jql=project='SAMPLEPROJECT'").
31
- to_return(:status => 200, :body => get_mock_response('project/SAMPLEPROJECT.issues.json'))
32
- subject = client.Project.build('key' => key)
33
- issues = subject.issues
34
- issues.length.should == 11
35
- issues.each do |issue|
36
- issue.class.should == JIRA::Resource::Issue
37
- issue.expanded?.should be_false
38
39
  end
39
40
 
40
41
  end
41
42
 
42
- end
43
+ it "returns a collection of components" do
43
44
 
44
- it "returns a collection of components" do
45
+ stub_request(:get, site_url + described_class.singular_path(client, key)).
46
+ to_return(:status => 200, :body => get_mock_response('project/SAMPLEPROJECT.json'))
45
47
 
46
- stub_request(:get, 'http://localhost:2990' + described_class.singular_path(client, key)).
47
- to_return(:status => 200, :body => get_mock_response('project/SAMPLEPROJECT.json'))
48
+ subject = client.Project.find(key)
49
+ subject.components.length.should == 2
50
+ subject.components.each do |component|
51
+ component.class.should == JIRA::Resource::Component
52
+ end
48
53
 
49
- subject = client.Project.find(key)
50
- subject.components.length.should == 2
51
- subject.components.each do |component|
52
- component.class.should == JIRA::Resource::Component
53
54
  end
54
-
55
55
  end
56
56
  end
@@ -2,26 +2,26 @@ require 'spec_helper'
2
2
 
3
3
  describe JIRA::Resource::Status do
4
4
 
5
- let(:client) do
6
- client = JIRA::Client.new('foo', 'bar')
7
- client.set_access_token('abc', '123')
8
- client
9
- end
5
+ with_each_client do |site_url, client|
6
+ let(:client) { client }
7
+ let(:site_url) { site_url }
10
8
 
11
- let(:key) { "1" }
12
9
 
13
- let(:expected_attributes) do
14
- {
15
- 'self' => "http://localhost:2990/jira/rest/api/2/status/1",
16
- 'id' => key,
17
- 'name' => 'Open'
18
- }
19
- end
10
+ let(:key) { "1" }
20
11
 
21
- let(:expected_collection_length) { 5 }
12
+ let(:expected_attributes) do
13
+ {
14
+ 'self' => "http://localhost:2990/jira/rest/api/2/status/1",
15
+ 'id' => key,
16
+ 'name' => 'Open'
17
+ }
18
+ end
22
19
 
23
- it_should_behave_like "a resource"
24
- it_should_behave_like "a resource with a collection GET endpoint"
25
- it_should_behave_like "a resource with a singular GET endpoint"
20
+ let(:expected_collection_length) { 5 }
26
21
 
22
+ it_should_behave_like "a resource"
23
+ it_should_behave_like "a resource with a collection GET endpoint"
24
+ it_should_behave_like "a resource with a singular GET endpoint"
25
+
26
+ end
27
27
  end
@@ -3,23 +3,23 @@ require 'spec_helper'
3
3
  describe JIRA::Resource::User do
4
4
 
5
5
 
6
- let(:client) do
7
- client = JIRA::Client.new('foo', 'bar')
8
- client.set_access_token('abc', '123')
9
- client
10
- end
6
+ with_each_client do |site_url, client|
7
+ let(:client) { client }
8
+ let(:site_url) { site_url }
11
9
 
12
- let(:key) { "admin" }
13
10
 
14
- let(:expected_attributes) do
15
- {
16
- 'self' => "http://localhost:2990/jira/rest/api/2/user?username=admin",
17
- 'name' => key,
18
- 'emailAddress' => 'admin@example.com'
19
- }
20
- end
11
+ let(:key) { "admin" }
21
12
 
22
- it_should_behave_like "a resource"
23
- it_should_behave_like "a resource with a singular GET endpoint"
13
+ let(:expected_attributes) do
14
+ {
15
+ 'self' => "http://localhost:2990/jira/rest/api/2/user?username=admin",
16
+ 'name' => key,
17
+ 'emailAddress' => 'admin@example.com'
18
+ }
19
+ end
24
20
 
21
+ it_should_behave_like "a resource"
22
+ it_should_behave_like "a resource with a singular GET endpoint"
23
+
24
+ end
25
25
  end
@@ -3,41 +3,41 @@ require 'spec_helper'
3
3
  describe JIRA::Resource::Version do
4
4
 
5
5
 
6
- let(:client) do
7
- client = JIRA::Client.new('foo', 'bar')
8
- client.set_access_token('abc', '123')
9
- client
10
- end
6
+ with_each_client do |site_url, client|
7
+ let(:client) { client }
8
+ let(:site_url) { site_url }
9
+
10
+
11
+ let(:key) { "10000" }
11
12
 
12
- let(:key) { "10000" }
13
+ let(:expected_attributes) do
14
+ {
15
+ 'self' => "http://localhost:2990/jira/rest/api/2/version/10000",
16
+ 'id' => key,
17
+ 'description' => "Initial version"
18
+ }
19
+ end
13
20
 
14
- let(:expected_attributes) do
15
- {
16
- 'self' => "http://localhost:2990/jira/rest/api/2/version/10000",
17
- 'id' => key,
18
- 'description' => "Initial version"
21
+ let(:attributes_for_post) {
22
+ {"name" => "2.0", "project" => "SAMPLEPROJECT" }
23
+ }
24
+ let(:expected_attributes_from_post) {
25
+ { "id" => "10001", "name" => "2.0" }
19
26
  }
20
- end
21
27
 
22
- let(:attributes_for_post) {
23
- {"name" => "2.0", "project" => "SAMPLEPROJECT" }
24
- }
25
- let(:expected_attributes_from_post) {
26
- { "id" => "10001", "name" => "2.0" }
27
- }
28
-
29
- let(:attributes_for_put) {
30
- {"name" => "2.0.0" }
31
- }
32
- let(:expected_attributes_from_put) {
33
- { "id" => "10000", "name" => "2.0.0" }
34
- }
35
-
36
- it_should_behave_like "a resource"
37
- it_should_behave_like "a resource with a singular GET endpoint"
38
- it_should_behave_like "a resource with a DELETE endpoint"
39
- it_should_behave_like "a resource with a POST endpoint"
40
- it_should_behave_like "a resource with a PUT endpoint"
41
- it_should_behave_like "a resource with a PUT endpoint that rejects invalid fields"
28
+ let(:attributes_for_put) {
29
+ {"name" => "2.0.0" }
30
+ }
31
+ let(:expected_attributes_from_put) {
32
+ { "id" => "10000", "name" => "2.0.0" }
33
+ }
42
34
 
35
+ it_should_behave_like "a resource"
36
+ it_should_behave_like "a resource with a singular GET endpoint"
37
+ it_should_behave_like "a resource with a DELETE endpoint"
38
+ it_should_behave_like "a resource with a POST endpoint"
39
+ it_should_behave_like "a resource with a PUT endpoint"
40
+ it_should_behave_like "a resource with a PUT endpoint that rejects invalid fields"
41
+
42
+ end
43
43
  end
@@ -3,53 +3,53 @@ require 'spec_helper'
3
3
  describe JIRA::Resource::Worklog do
4
4
 
5
5
 
6
- let(:client) do
7
- client = JIRA::Client.new('foo', 'bar')
8
- client.set_access_token('abc', '123')
9
- client
10
- end
6
+ with_each_client do |site_url, client|
7
+ let(:client) { client }
8
+ let(:site_url) { site_url }
9
+
10
+
11
+ let(:key) { "10000" }
11
12
 
12
- let(:key) { "10000" }
13
+ let(:target) { JIRA::Resource::Worklog.new(client, :attrs => {'id' => '99999'}, :issue_id => '54321') }
13
14
 
14
- let(:target) { JIRA::Resource::Worklog.new(client, :attrs => {'id' => '99999'}, :issue_id => '54321') }
15
+ let(:expected_collection_length) { 3 }
15
16
 
16
- let(:expected_collection_length) { 3 }
17
+ let(:belongs_to) {
18
+ JIRA::Resource::Issue.new(client, :attrs => {
19
+ 'id' => '10002', 'fields' => {
20
+ 'comment' => {'comments' => []}
21
+ }
22
+ })
23
+ }
17
24
 
18
- let(:belongs_to) {
19
- JIRA::Resource::Issue.new(client, :attrs => {
20
- 'id' => '10002', 'fields' => {
21
- 'comment' => {'comments' => []}
25
+ let(:expected_attributes) do
26
+ {
27
+ 'self' => "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10000",
28
+ 'id' => key,
29
+ 'comment' => "Some epic work."
22
30
  }
23
- })
24
- }
25
-
26
- let(:expected_attributes) do
27
- {
28
- 'self' => "http://localhost:2990/jira/rest/api/2/issue/10002/worklog/10000",
29
- 'id' => key,
30
- 'comment' => "Some epic work."
31
+ end
32
+
33
+ let(:attributes_for_post) {
34
+ {"timeSpent" => "2d"}
35
+ }
36
+ let(:expected_attributes_from_post) {
37
+ { "id" => "10001", "timeSpent" => "2d"}
31
38
  }
32
- end
33
39
 
34
- let(:attributes_for_post) {
35
- {"timeSpent" => "2d"}
36
- }
37
- let(:expected_attributes_from_post) {
38
- { "id" => "10001", "timeSpent" => "2d"}
39
- }
40
-
41
- let(:attributes_for_put) {
42
- {"timeSpent" => "2d"}
43
- }
44
- let(:expected_attributes_from_put) {
45
- { "id" => "10001", "timeSpent" => "4d"}
46
- }
47
-
48
- it_should_behave_like "a resource"
49
- it_should_behave_like "a resource with a collection GET endpoint"
50
- it_should_behave_like "a resource with a singular GET endpoint"
51
- it_should_behave_like "a resource with a DELETE endpoint"
52
- it_should_behave_like "a resource with a POST endpoint"
53
- it_should_behave_like "a resource with a PUT endpoint"
40
+ let(:attributes_for_put) {
41
+ {"timeSpent" => "2d"}
42
+ }
43
+ let(:expected_attributes_from_put) {
44
+ { "id" => "10001", "timeSpent" => "4d"}
45
+ }
54
46
 
47
+ it_should_behave_like "a resource"
48
+ it_should_behave_like "a resource with a collection GET endpoint"
49
+ it_should_behave_like "a resource with a singular GET endpoint"
50
+ it_should_behave_like "a resource with a DELETE endpoint"
51
+ it_should_behave_like "a resource with a POST endpoint"
52
+ it_should_behave_like "a resource with a PUT endpoint"
53
+
54
+ end
55
55
  end
@@ -2,157 +2,187 @@ require 'spec_helper'
2
2
 
3
3
  describe JIRA::Client do
4
4
 
5
- subject {JIRA::Client.new('foo','bar')}
5
+ let(:oauth_client) do
6
+ JIRA::Client.new({ :consumer_key => 'foo', :consumer_secret => 'bar' })
7
+ end
8
+
9
+ let(:basic_client) do
10
+ JIRA::Client.new({ :username => 'foo', :password => 'bar', :auth_type => :basic })
11
+ end
12
+
13
+ let(:clients) { [oauth_client, basic_client] }
6
14
 
7
15
  let(:response) do
8
16
  response = mock("response")
9
17
  response.stub(:kind_of?).with(Net::HTTPSuccess).and_return(true)
10
18
  response
11
19
  end
20
+
21
+ let(:headers) { {'Accept' => 'application/json'} }
22
+ let(:content_type_header) { {'Content-Type' => 'application/json'} }
23
+ let(:merged_headers) { headers.merge(content_type_header) }
12
24
 
13
25
  it "creates an instance" do
14
- subject.class.should == JIRA::Client
15
- end
16
-
17
- it "sets consumer key" do
18
- subject.key.should == 'foo'
19
- end
20
-
21
- it "sets consumer secret" do
22
- subject.secret.should == 'bar'
23
- end
24
-
25
- it "sets the non path default options" do
26
- options = [:site, :signature_method, :private_key_file]
27
- options.each do |key|
28
- subject.options[key].should == JIRA::Client::DEFAULT_OPTIONS[key]
29
- end
26
+ clients.each {|client| client.class.should == JIRA::Client }
30
27
  end
31
28
 
32
29
  it "allows the overriding of some options" do
33
- # Check it overrides a given option ...
34
- client = JIRA::Client.new('foo', 'bar', :site => 'http://foo.com/')
30
+ client = JIRA::Client.new({:consumer_key => 'foo', :consumer_secret => 'bar', :site => 'http://foo.com/'})
35
31
  client.options[:site].should == 'http://foo.com/'
36
32
  JIRA::Client::DEFAULT_OPTIONS[:site].should_not == 'http://foo.com/'
37
33
  end
38
34
 
39
- it "prepends the context path to all authorization and rest paths" do
40
- options = [:request_token_path, :authorize_path, :access_token_path, :rest_base_path]
35
+ it "prepends the context path to the rest base path" do
36
+ options = [:rest_base_path]
41
37
  defaults = JIRA::Client::DEFAULT_OPTIONS
42
38
  options.each do |key|
43
- subject.options[key].should == defaults[:context_path] + defaults[key]
39
+ clients.each { |client| client.options[key].should == defaults[:context_path] + defaults[key] }
44
40
  end
45
41
  end
46
42
 
47
43
  # To avoid having to validate options after initialisation, e.g. setting
48
44
  # client.options[:invalid] = 'foo'
49
45
  it "freezes the options" do
50
- subject.options.should be_frozen
46
+ clients.each { |client| client.options.should be_frozen }
51
47
  end
52
48
 
53
- it "creates a Oauth::Consumer on initialize" do
54
- subject.consumer.class.should == OAuth::Consumer
55
- subject.consumer.key.should == subject.key
56
- subject.consumer.secret.should == subject.secret
49
+ it "merges headers" do
50
+ clients.each { |client| client.send(:merge_default_headers, {}).should == {'Accept' => 'application/json'} }
57
51
  end
58
52
 
59
- it "returns an OAuth request_token" do
60
- # Cannot just check for method delegation as http connection will be attempted
61
- request_token = OAuth::RequestToken.new(subject.consumer)
62
- subject.consumer.stub(:get_request_token => request_token)
63
- subject.get_request_token.should == request_token
64
- end
53
+ describe "creates instances of request clients" do
54
+ specify "that are of the correct class" do
55
+ oauth_client.request_client.class.should == JIRA::OauthClient
56
+ basic_client.request_client.class.should == JIRA::HttpClient
57
+ end
65
58
 
66
- it "is possible to set the request token" do
67
- token = mock()
68
- OAuth::RequestToken.should_receive(:new).with(subject.consumer, 'foo', 'bar').and_return(token)
59
+ specify "which have a corresponding auth type option" do
60
+ oauth_client.options[:auth_type].should == :oauth
61
+ basic_client.options[:auth_type].should == :basic
62
+ end
69
63
 
70
- request_token = subject.set_request_token('foo', 'bar')
64
+ describe "like oauth" do
71
65
 
72
- request_token.should == token
73
- subject.request_token.should == token
74
- end
66
+ it "allows setting an access token" do
67
+ token = mock()
68
+ OAuth::AccessToken.should_receive(:new).with(oauth_client.consumer, 'foo', 'bar').and_return(token)
69
+ access_token = oauth_client.set_access_token('foo', 'bar')
75
70
 
76
- describe "access token" do
71
+ access_token.should == token
72
+ oauth_client.access_token.should == token
73
+ end
77
74
 
78
- it "initializes the access token" do
79
- request_token = OAuth::RequestToken.new(subject.consumer)
80
- subject.consumer.stub(:get_request_token => request_token)
81
- mock_access_token = mock()
82
- request_token.should_receive(:get_access_token).with(:oauth_verifier => 'abc123').and_return(mock_access_token)
83
- subject.init_access_token(:oauth_verifier => 'abc123')
84
- subject.access_token.should == mock_access_token
85
- end
75
+ it "allows initializing the access token" do
76
+ request_token = OAuth::RequestToken.new(oauth_client.consumer)
77
+ oauth_client.consumer.stub(:get_request_token => request_token)
78
+ mock_access_token = mock()
79
+ request_token.should_receive(:get_access_token).with(:oauth_verifier => 'abc123').and_return(mock_access_token)
80
+ oauth_client.init_access_token(:oauth_verifier => 'abc123')
81
+ oauth_client.access_token.should == mock_access_token
82
+ end
86
83
 
87
- it "raises an exception when accessing without initialisation" do
88
- lambda do
89
- subject.access_token
90
- end.should raise_exception(JIRA::Client::UninitializedAccessTokenError, "init_access_token must be called before using the client")
84
+ specify "that has specific default options" do
85
+ options = [:signature_method, :private_key_file]
86
+ options.each do |key|
87
+ oauth_client.options[key].should == JIRA::Client::DEFAULT_OPTIONS[key]
88
+ end
89
+ end
91
90
  end
92
91
 
93
- it "is possible to set the access token" do
94
- token = mock()
95
- OAuth::AccessToken.should_receive(:new).with(subject.consumer, 'foo', 'bar').and_return(token)
96
-
97
- access_token = subject.set_access_token('foo', 'bar')
92
+ describe "like basic http" do
93
+ it "sets the username and password" do
94
+ basic_client.options[:username].should == 'foo'
95
+ basic_client.options[:password].should == 'bar'
96
+ end
97
+ end
98
+ end
98
99
 
99
- access_token.should == token
100
- subject.access_token.should == token
100
+ describe "has http methods" do
101
+ before do
102
+ oauth_client.set_access_token("foo", "bar")
101
103
  end
102
104
 
103
- end
105
+ specify "that merge default headers" do
106
+ # stubbed response for generic client request method
107
+ oauth_client.should_receive(:request).exactly(5).times.and_return(response)
108
+ basic_client.should_receive(:request).exactly(5).times.and_return(response)
109
+
110
+ # response for merging headers for http methods with no body
111
+ oauth_client.should_receive(:merge_default_headers).exactly(3).times.with({})
112
+ basic_client.should_receive(:merge_default_headers).exactly(3).times.with({})
104
113
 
105
- describe "http" do
114
+ # response for merging headers for http methods with body
115
+ oauth_client.should_receive(:merge_default_headers).exactly(2).times.with(content_type_header)
116
+ basic_client.should_receive(:merge_default_headers).exactly(2).times.with(content_type_header)
106
117
 
107
- it "responds to the http methods" do
108
- mock_access_token = mock()
109
- subject.stub(:access_token => mock_access_token)
110
118
  [:delete, :get, :head].each do |method|
111
- mock_access_token.should_receive(:request).with(method, '/path', {'Accept' => 'application/json'}).and_return(response)
112
- subject.send(method, '/path')
119
+ oauth_client.send(method, '/path', {})
120
+ basic_client.send(method, '/path', {})
113
121
  end
122
+
114
123
  [:post, :put].each do |method|
115
- mock_access_token.should_receive(:request).with(method,
116
- '/path', '',
117
- {'Accept' => 'application/json', 'Content-Type' => 'application/json'}).and_return(response)
118
- subject.send(method, '/path')
124
+ oauth_client.send(method, '/path', '', content_type_header)
125
+ basic_client.send(method, '/path', '', content_type_header)
119
126
  end
120
127
  end
121
128
 
122
- it "performs a request" do
123
- access_token = mock()
124
- access_token.should_receive(:request).with(:get, '/foo').and_return(response)
125
- subject.stub(:access_token => access_token)
126
- subject.request(:get, '/foo')
127
- end
129
+ specify "that call the generic request method" do
130
+ [:delete, :get, :head].each do |method|
131
+ oauth_client.should_receive(:request).with(method, '/path', nil, headers).and_return(response)
132
+ basic_client.should_receive(:request).with(method, '/path', nil, headers).and_return(response)
133
+ oauth_client.send(method, '/path', {})
134
+ basic_client.send(method, '/path', {})
135
+ end
128
136
 
129
- it "raises an exception for non success responses" do
130
- response = mock()
131
- response.stub(:kind_of?).with(Net::HTTPSuccess).and_return(false)
132
- access_token = mock()
133
- access_token.should_receive(:request).with(:get, '/foo').and_return(response)
134
- subject.stub(:access_token => access_token)
135
-
136
- lambda do
137
- subject.request(:get, '/foo')
138
- end.should raise_exception(JIRA::HTTPError)
137
+ [:post, :put].each do |method|
138
+ oauth_client.should_receive(:request).with(method, '/path', '', merged_headers)
139
+ basic_client.should_receive(:request).with(method, '/path', '', merged_headers)
140
+ oauth_client.send(method, '/path', '', {})
141
+ basic_client.send(method, '/path', '', {})
142
+ end
139
143
  end
140
144
 
145
+ describe "that call a oauth client" do
146
+ specify "which makes a request" do
147
+ [:delete, :get, :head].each do |method|
148
+ oauth_client.request_client.should_receive(:make_request).with(method, '/path', nil, headers).and_return(response)
149
+ oauth_client.send(method, '/path', {})
150
+ end
151
+ [:post, :put].each do |method|
152
+ oauth_client.request_client.should_receive(:make_request).with(method, '/path', '', merged_headers).and_return(response)
153
+ oauth_client.send(method, '/path', '', {})
154
+ end
155
+ end
156
+ end
157
+
158
+ describe "that call a http client" do
159
+ it "which makes a request" do
160
+ [:delete, :get, :head].each do |method|
161
+ basic_client.request_client.should_receive(:make_request).with(method, '/path', nil, headers).and_return(response)
162
+ basic_client.send(method, '/path', headers)
163
+ end
164
+ [:post, :put].each do |method|
165
+ basic_client.request_client.should_receive(:make_request).with(method, '/path', '', merged_headers).and_return(response)
166
+ basic_client.send(method, '/path', '', headers)
167
+ end
168
+ end
169
+ end
141
170
  end
142
-
171
+
143
172
  describe "Resource Factories" do
144
-
145
173
  it "gets all projects" do
146
- JIRA::Resource::Project.should_receive(:all).with(subject).and_return([])
147
- subject.Project.all.should == []
174
+ JIRA::Resource::Project.should_receive(:all).with(oauth_client).and_return([])
175
+ JIRA::Resource::Project.should_receive(:all).with(basic_client).and_return([])
176
+ oauth_client.Project.all.should == []
177
+ basic_client.Project.all.should == []
148
178
  end
149
179
 
150
180
  it "finds a single project" do
151
181
  find_result = mock()
152
- JIRA::Resource::Project.should_receive(:find).with(subject, '123').and_return(find_result)
153
- subject.Project.find('123').should == find_result
182
+ JIRA::Resource::Project.should_receive(:find).with(oauth_client, '123').and_return(find_result)
183
+ JIRA::Resource::Project.should_receive(:find).with(basic_client, '123').and_return(find_result)
184
+ oauth_client.Project.find('123').should == find_result
185
+ basic_client.Project.find('123').should == find_result
154
186
  end
155
-
156
187
  end
157
-
158
188
  end