Skip to content

Commit

Permalink
Merge f105b3c into 50c53ea
Browse files Browse the repository at this point in the history
  • Loading branch information
damian committed May 20, 2013
2 parents 50c53ea + f105b3c commit 3ada58b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/octokit/client/contents.rb
Expand Up @@ -68,7 +68,7 @@ def create_contents(*args)
end
end
raise ArgumentError.new "content or :file option required" if content.nil?
options[:content] = Base64.encode64(content)
options[:content] = Base64.encode64(content).delete("\r\n")
options[:message] = message
url = "repos/#{Repository.new repo}/contents/#{path}"
put(url, options)
Expand Down
12 changes: 6 additions & 6 deletions spec/octokit/client/contents_spec.rb
Expand Up @@ -51,7 +51,7 @@
describe ".create_contents" do
it "creates repository contents at a path" do
stub_put("/repos/pengwynn/api-sandbox/contents/foo/bar/baz.txt").
with({:body => {:message => "I am commit-ing", :content => "SGVyZSBiZSB0aGUgY29udGVudA==\n"}}).
with({:body => {:message => "I am commit-ing", :content => "SGVyZSBiZSB0aGUgY29udGVudA=="}}).
to_return(json_response("create_content.json"))

response = @client.create_contents("pengwynn/api-sandbox",
Expand All @@ -62,7 +62,7 @@
end
it "creates contents from file path" do
stub_put("/repos/pengwynn/api-sandbox/contents/foo/bar/baz.txt").
with({:body => {:message => "I am commit-ing", :content => "SGVyZSBiZSB0aGUgY29udGVudAo=\n"}}).
with({:body => {:message => "I am commit-ing", :content => "SGVyZSBiZSB0aGUgY29udGVudAo="}}).
to_return(json_response("create_content.json"))

response = @client.create_contents("pengwynn/api-sandbox",
Expand All @@ -73,7 +73,7 @@
end
it "creates contents from File object" do
stub_put("/repos/pengwynn/api-sandbox/contents/foo/bar/baz.txt").
with({:body => {:message => "I am commit-ing", :content => "SGVyZSBiZSB0aGUgY29udGVudAo=\n"}}).
with({:body => {:message => "I am commit-ing", :content => "SGVyZSBiZSB0aGUgY29udGVudAo="}}).
to_return(json_response("create_content.json"))

file = File.new "spec/fixtures/new_file.txt", "r"
Expand All @@ -91,7 +91,7 @@
with({:body => {
:sha => "4d149b826e7305659006eb64cfecd3be68d0f2f0",
:message => "I am commit-ing",
:content => "SGVyZSBiZSBtb2FyIGNvbnRlbnQ=\n"
:content => "SGVyZSBiZSBtb2FyIGNvbnRlbnQ="
}}).
to_return(json_response("update_content.json"))

Expand All @@ -107,7 +107,7 @@
with({:body => {
:sha => "4d149b826e7305659006eb64cfecd3be68d0f2f0",
:message => "I am commit-ing",
:content => "SGVyZSBiZSBtb2FyIGNvbnRlbnQK\n"
:content => "SGVyZSBiZSBtb2FyIGNvbnRlbnQK"
}}).
to_return(json_response("update_content.json"))

Expand All @@ -123,7 +123,7 @@
with({:body => {
:sha => "4d149b826e7305659006eb64cfecd3be68d0f2f0",
:message => "I am commit-ing",
:content => "SGVyZSBiZSBtb2FyIGNvbnRlbnQK\n"
:content => "SGVyZSBiZSBtb2FyIGNvbnRlbnQK"
}}).
to_return(json_response("update_content.json"))

Expand Down

0 comments on commit 3ada58b

Please sign in to comment.