|
110 | 110 | end |
111 | 111 | let(:fake_github_client) do |
112 | 112 | double("Fake GitHub Client").tap do |github_client| |
113 | | - github_client.stub(:create_issue).and_return(fake_issue) |
| 113 | + expect(github_client).to receive(:create_issue).and_return(fake_issue) |
114 | 114 | end |
115 | 115 | end |
116 | 116 | let(:fake_issue) do |
117 | 117 | double("Fake Issue").tap do |issue| |
118 | | - issue.stub(:html_url).and_return("http://github.com/user/repos/issues/878") |
| 118 | + expect(issue).to receive(:html_url).and_return("http://github.com/user/repos/issues/878") |
119 | 119 | end |
120 | 120 | end |
121 | 121 |
|
|
127 | 127 | } |
128 | 128 | end |
129 | 129 | it "return issue url" do |
130 | | - Octokit::Client.stub(:new).with( |
| 130 | + expect(Octokit::Client).to receive(:new).with( |
131 | 131 | login: user["github_login"], access_token: user["github_oauth_token"] |
132 | 132 | ).and_return(fake_github_client) |
133 | 133 | expect(subject).to eq fake_issue.html_url |
|
137 | 137 | context "signed in with password" do |
138 | 138 | let(:user) { {} } |
139 | 139 | it "return issue url" do |
140 | | - Octokit::Client.stub(:new).with( |
| 140 | + expect(Octokit::Client).to receive(:new).with( |
141 | 141 | login: options["username"], password: options["password"] |
142 | 142 | ).and_return(fake_github_client) |
143 | 143 | expect(subject).to eq fake_issue.html_url |
|
149 | 149 | {"github_login" => "alice", "github_oauth_token" => "invalid_token"} |
150 | 150 | end |
151 | 151 | it "raise AuthenticationError" do |
152 | | - Octokit::Client.stub(:new).with( |
| 152 | + expect(Octokit::Client).to receive(:new).with( |
153 | 153 | login: user["github_login"], access_token: user["github_oauth_token"] |
154 | 154 | ).and_raise(Octokit::Unauthorized) |
155 | 155 | expect { subject }.to raise_error |
|
0 commit comments