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

Fixes grammar and style #1356

Merged
merged 2 commits into from
May 24, 2022
Merged

Conversation

nikoandpiko
Copy link
Contributor

Grammar issues are of most importance here. If anything needs updating, I would suggest those.

Copy link

@cristianMuntean1 cristianMuntean1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a branch

  #
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
  # @param branch [String] The branch name, e.g. <tt>feature/branchA</tt>
  # @param sha [String] A SHA, e.g. e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
  # @return [Array<Sawyer::Resource>] The list of references, already containing the new one
  # @see https://developer.github.com/v3/git/refs/#create-a-reference
  # @example Create branch feature/branchA (refs/heads/feature/branchA) for octocat/Hello-World with sha 827efc6d56897b048c772eb4087f854f46256132
  #   Octokit.create_branch("octocat/Hello-World", "feature/branchA", "827efc6d56897b048c772eb4087f854f46256132")
  def create_branch(repo, branch, sha, options = {})
    branch = "heads/#{branch}" unless branch =~ %r{heads/}
    create_ref repo, branch, sha, options
  end

  describe ".create_branch" do 
       it "prepends heads/ to the branch parameter" do 
       request = stub_post(""/repos/#{@test_repo}/git/refs"").
         (:body => {ref: "refs/heads/testing/test-ref-2", sha: @first_sha}.to_json)
  @client.create_branch(@test_repo, "testing/test-ref-2", @first_sha)
  assert_requested request
end

it "does not duplicate heads/ in branch parameter" do
  request = stub_post("/repos/#{@test_repo}/git/refs").
    (:body => {ref: "refs/heads/testing/test-ref-2", sha: @first_sha}.to_json)
  @client.create_branch(@test_repo, "heads/testing/test-ref-2", @first_sha)
  assert_requested request
end

end # .create_branch

context "with ref", :vcr do
before(:each) do
commits = @client.commits(@test_repo)
@@ -64,6 +80,12 @@
end
end # .create_ref

describe ".create_branch" do
  it "creates a branch" do
    assert_requested :post, github_url("/repos/#{@test_repo}/git/refs")
  end
end # .create_branch

describe ".update_branch" do
  it "updates a branch" do
    @client.update_branch(@test_repo, "testing/test-ref", @last_sha, true)

Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making these changes ❤️ . Just one small nit but definitely not a blocker.

README.md Show resolved Hide resolved
@nickfloyd nickfloyd merged commit 8b1851a into octokit:4-stable May 24, 2022
@nickfloyd nickfloyd added Type: Documentation Improvements or additions to documentation and removed docs-and-samples labels Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants