|
2 | 2 |
|
3 | 3 | require 'spec_helper' |
4 | 4 |
|
5 | | -describe Github::Client::Gists, '#list' do |
| 5 | +RSpec.describe Github::Client::Gists, '#list' do |
6 | 6 | let(:user) { 'peter-murach' } |
7 | 7 | let(:body) { fixture('gists/gists.json') } |
8 | 8 | let(:status) { 200 } |
9 | 9 |
|
10 | 10 | before { |
11 | | - stub_get(request_path).to_return(:body => body, :status => status, |
12 | | - :headers => {:content_type => "application/json; charset=utf-8"}) |
| 11 | + stub_get(request_path).to_return(body: body, status: status, |
| 12 | + headers: {content_type: "application/json; charset=utf-8"}) |
13 | 13 | } |
14 | 14 |
|
15 | 15 | after { reset_authentication_for(subject) } |
|
20 | 20 | context "resource found" do |
21 | 21 | it { should respond_to :all } |
22 | 22 |
|
23 | | - it "should get the resources" do |
24 | | - subject.list :user => user |
25 | | - a_get(request_path).should have_been_made |
| 23 | + it "gets the resources" do |
| 24 | + subject.list(user: user) |
| 25 | + expect(a_get(request_path)).to have_been_made |
26 | 26 | end |
27 | 27 |
|
28 | 28 | it_should_behave_like 'an array of resources' do |
29 | 29 | let(:requestable) { subject.list :user => user } |
30 | 30 | end |
31 | 31 |
|
32 | | - it "should get gist information" do |
33 | | - gists = subject.list :user => user |
34 | | - gists.first.user.login.should == 'octocat' |
| 32 | + it "gets gist information" do |
| 33 | + gists = subject.list(user: user) |
| 34 | + expect(gists.first.user.login).to eq('octocat') |
35 | 35 | end |
36 | 36 |
|
37 | | - it "should yield to a block" do |
| 37 | + it "yields to a block" do |
38 | 38 | yielded = [] |
39 | | - result = subject.list(:user => user) { |obj| yielded << obj } |
40 | | - yielded.should == result |
| 39 | + result = subject.list(user: user) { |obj| yielded << obj } |
| 40 | + expect(yielded).to eq(result) |
41 | 41 | end |
42 | 42 | end |
43 | 43 |
|
|
49 | 49 | context 'when public' do |
50 | 50 | let(:request_path) { "/gists/public" } |
51 | 51 |
|
52 | | - it "should get the resources" do |
53 | | - subject.list :public |
54 | | - a_get(request_path).should have_been_made |
| 52 | + it "gets the resources" do |
| 53 | + subject.list(:public) |
| 54 | + expect(a_get(request_path)).to have_been_made |
55 | 55 | end |
56 | 56 |
|
57 | 57 | it_should_behave_like 'an array of resources' do |
|
69 | 69 | :headers => {:content_type => "application/json; charset=utf-8"}) |
70 | 70 | end |
71 | 71 |
|
72 | | - it "should get the resources" do |
| 72 | + it "gets the resources" do |
73 | 73 | subject.list |
74 | | - a_get(request_path).with(:query => {:access_token => OAUTH_TOKEN}). |
75 | | - should have_been_made |
| 74 | + expect(a_get(request_path).with(:query => {:access_token => OAUTH_TOKEN})). |
| 75 | + to have_been_made |
76 | 76 | end |
77 | 77 | end |
78 | 78 | end # list |
0 commit comments