Skip to content

Commit

Permalink
Adding test to prove Addressable form encodes precisely as required b…
Browse files Browse the repository at this point in the history
…y OAuth 2.
  • Loading branch information
sporkmonger committed Jun 10, 2015
1 parent c0f296f commit 06896a8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/addressable/uri_spec.rb
Expand Up @@ -5434,6 +5434,24 @@ def to_str
end
end

# See https://tools.ietf.org/html/rfc6749#appendix-B
describe Addressable::URI, "when form encoding the example value from OAuth 2" do
it "should result in correct values" do
expect(Addressable::URI.form_encode(
{"value" => " %&+£€"}
)).to eq("value=+%25%26%2B%C2%A3%E2%82%AC")
end
end

# See https://tools.ietf.org/html/rfc6749#appendix-B
describe Addressable::URI, "when form unencoding the example value from OAuth 2" do
it "should result in correct values" do
expect(Addressable::URI.form_unencode(
"value=+%25%26%2B%C2%A3%E2%82%AC"
)).to eq([["value", " %&+£€"]])
end
end

describe Addressable::URI, "when form unencoding a string" do
it "should result in correct values" do
expect(Addressable::URI.form_unencode(
Expand Down

0 comments on commit 06896a8

Please sign in to comment.