Skip to content

Commit

Permalink
Merge pull request #1 from porras/update
Browse files Browse the repository at this point in the history
Small changes to run on Ruby > 1.8.7
  • Loading branch information
dball committed Feb 18, 2014
2 parents 5203e19 + 704d32c commit 87fb90f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org/'

gemspec
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PATH
remote: .
specs:
data_uri (0.0.3)

GEM
remote: https://rubygems.org/
specs:
minitest (5.2.3)
rake (10.1.1)

PLATFORMS
ruby

DEPENDENCIES
data_uri!
minitest
rake
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
require 'rake/testtask'
Rake::TestTask.new
task :default => :test

desc "Build a gem file"
task :build do
system "gem build data_uri.gemspec"
end

3 changes: 3 additions & 0 deletions data_uri.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ Gem::Specification.new do |s|

s.require_path = 'lib'
s.files = %w(README.rdoc Rakefile) + Dir.glob("lib/**/*")

s.add_development_dependency 'rake'
s.add_development_dependency 'minitest'
end
2 changes: 1 addition & 1 deletion test/test_data_open_uri.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'data_uri'
require 'open-uri'
require 'data_uri/open_uri'
require 'minitest/spec'
require 'minitest/autorun'
require 'minitest/spec'

describe URI::Data do

Expand Down
14 changes: 9 additions & 5 deletions test/test_data_uri.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'data_uri'
require 'minitest/spec'
require 'minitest/autorun'
require 'minitest/spec'

describe URI::Data do

Expand Down Expand Up @@ -75,14 +75,18 @@
@raw = "data:application/octet-stream;base64,#{Base64.encode64(@data).chop}"
end

it "shouldn't be parsed by URI.parse because the ABS_URI regexp is silly" do
uri = URI.parse(@raw)
assert uri.data != @data
it "isn't parsed by URI.parse" do
if RUBY_VERSION == "1.8.7"
uri = URI.parse(@raw)
refute_equal uri.data, @data
else
proc { URI.parse(@raw) }.must_raise(URI::InvalidURIError)
end
end

it "should be parsed by URI::Data.new" do
uri = URI::Data.new(@raw)
assert uri.data == @data
assert_equal uri.data, @data
end

end
Expand Down

0 comments on commit 87fb90f

Please sign in to comment.