summaryrefslogtreecommitdiff
path: root/spec/ruby/library/base64
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/base64')
-rw-r--r--spec/ruby/library/base64/decode64_spec.rb4
-rw-r--r--spec/ruby/library/base64/strict_decode64_spec.rb8
2 files changed, 8 insertions, 4 deletions
diff --git a/spec/ruby/library/base64/decode64_spec.rb b/spec/ruby/library/base64/decode64_spec.rb
index f6cd26d788..6dd33dddfe 100644
--- a/spec/ruby/library/base64/decode64_spec.rb
+++ b/spec/ruby/library/base64/decode64_spec.rb
@@ -22,4 +22,8 @@ describe "Base64#decode64" do
it "returns a binary encoded string" do
Base64.decode64("SEk=").encoding.should == Encoding::BINARY
end
+
+ it "decodes without padding suffix ==" do
+ Base64.decode64("eyJrZXkiOnsibiI6InR0dCJ9fQ").should == "{\"key\":{\"n\":\"ttt\"}}"
+ end
end
diff --git a/spec/ruby/library/base64/strict_decode64_spec.rb b/spec/ruby/library/base64/strict_decode64_spec.rb
index d258223c82..7b52f0c922 100644
--- a/spec/ruby/library/base64/strict_decode64_spec.rb
+++ b/spec/ruby/library/base64/strict_decode64_spec.rb
@@ -14,25 +14,25 @@ describe "Base64#strict_decode64" do
it "raises ArgumentError when the given string contains CR" do
-> do
Base64.strict_decode64("U2VuZCByZWluZm9yY2VtZW50cw==\r")
- end.should raise_error(ArgumentError)
+ end.should.raise(ArgumentError)
end
it "raises ArgumentError when the given string contains LF" do
-> do
Base64.strict_decode64("U2VuZCByZWluZm9yY2VtZW50cw==\n")
- end.should raise_error(ArgumentError)
+ end.should.raise(ArgumentError)
end
it "raises ArgumentError when the given string has wrong padding" do
-> do
Base64.strict_decode64("=U2VuZCByZWluZm9yY2VtZW50cw==")
- end.should raise_error(ArgumentError)
+ end.should.raise(ArgumentError)
end
it "raises ArgumentError when the given string contains an invalid character" do
-> do
Base64.strict_decode64("%3D")
- end.should raise_error(ArgumentError)
+ end.should.raise(ArgumentError)
end
it "returns a binary encoded string" do