Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] #62 - Provide link towards created issue #63

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion bin/checklister
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ command :new do |c|
puts " to the project: #{project[:name]}"
parsed_checklist = Checklister::Parser.new(checklist_path, title)
issue = api_client.issue.create(project_id, parsed_checklist.to_params)
puts "* Issue successfully created!"
issue_url = issue.html_url || issue.web_url
puts "* Issue successfully created! (#{issue_url})"
end
end

Expand Down
14 changes: 6 additions & 8 deletions spec/checklister/github/issue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
{ endpoint: "https://api.github.com", private_token: "supersecret", kind: "github" }
end
let(:client) { Checklister::Client.new(github_config).api_client }
let(:issue) { Checklister::Github::Issue.new(client).create(3, title: "Beatae possimus nostrum", body: "nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.") }

before(:each) do
stub_request(:post, /api.github.com/).
to_return(status: 200, body: load_fixture("github_issue"), headers: {})
end

describe "#create" do
before(:each) do
stub_request(:post, /api.github.com/).
to_return(status: 200, body: load_fixture("github_issue"), headers: {})
end

context "with valid attributes" do
it "creates an issue by calling the remote service" do
issue = Checklister::Github::Issue.new(client).create(3, title: "Beatae possimus nostrum", body: "nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.")
expect(JSON.parse(issue)["title"]).to eq("Found a bug")
expect(JSON.parse(issue)["body"]).to eq("I'm having a problem with this.")
end
end

context "with invalid attributes" do
end
end
end
15 changes: 6 additions & 9 deletions spec/checklister/gitlab/issue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@
{ endpoint: "https://www.gitlab.com/api", private_token: "supersecret", kind: "gitlab" }
end
let(:client) { Checklister::Client.new(gitlab_config).api_client }
let(:issue) { Checklister::Gitlab::Issue.new(client).create(3, title: "Beatae possimus nostrum", body: "nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.") }

describe "#create" do
before(:each) do
stub_request(:post, /www.gitlab.com/).
to_return(status: 200, body: load_fixture("issue"), headers: {})
end
before(:each) do
stub_request(:post, /www.gitlab.com/).
to_return(status: 200, body: load_fixture("issue"), headers: {})
end

describe "#create" do
context "with valid attributes" do
it "creates an issue by calling the remote service" do
issue = Checklister::Gitlab::Issue.new(client).create(3, title: "Beatae possimus nostrum", body: "nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.")
expect(issue.to_hash["project_id"]).to eq(3)
expect(issue.to_hash["title"]).to eq("Beatae possimus nostrum")
expect(issue.to_hash["description"]).to eq("nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.")
end
end

context "with invalid attributes" do
end
end
end
3 changes: 2 additions & 1 deletion spec/fixtures/issue.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
},
"closed":false,
"updated_at":"2012-09-17T09:42:20Z",
"created_at":"2012-09-17T09:42:20Z"
"created_at":"2012-09-17T09:42:20Z",
"web_url": "http://example.com/example/example/issues/14"
}