Skip to content

Commit 67e7c38

Browse files
author
Sam Davies
committed
Address PR comments
1 parent 3ea0fa0 commit 67e7c38

8 files changed

Lines changed: 18 additions & 27 deletions

File tree

lib/github_api/client/orgs/projects.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ class Client::Orgs::Projects < API
2222
#
2323
# @api public
2424
def list(*args)
25-
arguments(args, required: [:org_name]) do
26-
permit %w[ state ]
27-
end
25+
arguments(args, required: [:org_name])
2826
params = arguments.params
2927

3028
params['options'] = OPTIONS
@@ -49,7 +47,6 @@ def list(*args)
4947
# github.repos.create name: 'project-name', body: 'project-body', owner: 'owner-name', repo: 'repo-name'
5048
def create(*args)
5149
arguments(args, required: [:org_name]) do
52-
permit %w[ body name ]
5350
assert_required %w[ name ]
5451
end
5552
params = arguments.params

lib/github_api/client/projects.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ def get(*args)
4646
#
4747
# @api public
4848
def edit(*args)
49-
arguments(args, required: [:id]) do
50-
permit %w[ name body state ]
51-
end
49+
arguments(args, required: [:id])
5250

5351
params = arguments.params
5452
params['options'] = OPTIONS

lib/github_api/client/repos/projects.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ class Client::Repos::Projects < API
2525
#
2626
# @api public
2727
def list(*args)
28-
arguments(args, required: [:owner, :repo]) do
29-
permit %w[ state ]
30-
end
28+
arguments(args, required: [:owner, :repo])
3129
params = arguments.params
3230

3331
params['options'] = OPTIONS
@@ -52,7 +50,6 @@ def list(*args)
5250
# github.repos.create name: 'project-name', body: 'project-body', owner: 'owner-name', repo: 'repo-name'
5351
def create(*args)
5452
arguments(args, required: [:owner, :repo]) do
55-
permit %w[ body name ]
5653
assert_required %w[ name ]
5754
end
5855
params = arguments.params

spec/github/client/repos/projects/create_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232

3333
it "should create resource" do
3434
subject.create owner, repo, inputs
35-
a_post(request_path).with(body: inputs).should have_been_made
35+
expect(a_post(request_path).with(body: inputs)).to have_been_made
3636
end
3737

3838
it "should return the resource" do
3939
project = subject.create owner, repo, inputs
40-
project.name.should == 'Projects Documentation'
40+
expect(project.name).to eq 'Projects Documentation'
4141
end
4242

4343
it "should return mash type" do
4444
project = subject.create owner, repo, inputs
45-
project.should be_a Github::ResponseWrapper
45+
expect(project).to be_a Github::ResponseWrapper
4646
end
4747
end
4848
end # create

spec/github/client/repos/projects/list_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@
88
let(:repo) { 'github' }
99
let(:request_path) { "/repos/#{user}/#{repo}/projects" }
1010

11-
before {
11+
before do
1212
stub_get(request_path)
13-
.with(headers: {'Accept'=>'application/vnd.github.inertia-preview+json'})
13+
.with(headers: { 'Accept' => 'application/vnd.github.inertia-preview+json' })
1414
.to_return(
1515
body: body,
1616
status: status,
1717
headers: {
1818
content_type: "application/json; charset=utf-8"
1919
}
2020
)
21-
}
21+
end
2222

2323
after { reset_authentication_for(subject) }
2424

2525
context "resource found" do
2626
let(:body) { fixture('repos/projects.json') }
2727
let(:status) { 200 }
2828

29-
it { should respond_to :all }
29+
it { expect(subject).to respond_to :all }
3030

3131
it { expect { subject.list }.to raise_error(ArgumentError) }
3232

@@ -36,7 +36,7 @@
3636

3737
it "should get the resources" do
3838
subject.list user, repo
39-
a_get(request_path).should have_been_made
39+
expect(a_get(request_path)).to have_been_made
4040
end
4141

4242
it_should_behave_like 'an array of resources' do
@@ -45,13 +45,13 @@
4545

4646
it "should get project information" do
4747
projects = subject.list user, repo
48-
projects.first.name.should == 'Projects Documentation'
48+
expect(projects.first.name).to eq 'Projects Documentation'
4949
end
5050

5151
it "should yield to a block" do
5252
yielded = []
5353
result = subject.list(user, repo) { |obj| yielded << obj }
54-
yielded.should == result
54+
expect(yielded).to eq result
5555
end
5656
end
5757

spec/integration/repos_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@
3535
its(:pubsubhubbub) { should be_a Github::Client::Repos::PubSubHubbub }
3636

3737
its(:projects) { should be_a Github::Client::Repos::Projects }
38-
3938
end # Github::Repos

spec/unit/client/orgs/projects/create_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030

3131
it "should create resource" do
3232
subject.create org, inputs
33-
a_post(request_path).with(body: inputs).should have_been_made
33+
expect(a_post(request_path).with(body: inputs)).to have_been_made
3434
end
3535

3636
it "should return the resource" do
3737
project = subject.create org, inputs
38-
project.name.should == 'Projects Documentation'
38+
expect(project.name).to eq 'Projects Documentation'
3939
end
4040

4141
it "should return mash type" do
4242
project = subject.create org, inputs
43-
project.should be_a Github::ResponseWrapper
43+
expect(project).to be_a Github::ResponseWrapper
4444
end
4545
end
4646
end # create

spec/unit/client/projects/delete_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
after { reset_authentication_for subject }
1717

18-
it { should respond_to :remove }
18+
it { expect(subject).to respond_to :remove }
1919

2020
it "should delete the resource successfully" do
2121
subject.delete project_id
22-
a_delete(request_path).should have_been_made
22+
expect(a_delete(request_path)).to have_been_made
2323
end
2424

2525
it "should fail to delete resource without 'id' parameter" do

0 commit comments

Comments
 (0)