Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix issue for 1.9.3 URI

  • Loading branch information...
commit 8bba8ac23ec6ea4c9c350d80cff28423bea3c2af 1 parent 2d0e813
Allen Madsen authored
2  .rvmrc
View
@@ -1 +1 @@
-rvm use 1.9.2@page_rankr --create
+rvm use 1.9.3@page_rankr --create
1  .travis.yml
View
@@ -2,5 +2,4 @@ rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- - rbx-2.0
- ree
3  Gemfile
View
@@ -3,5 +3,6 @@ source :gemcutter
gemspec
group :development do
- gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
+ gem 'pry'
+ gem 'pry-nav'
end
8 lib/page_rankr/site.rb
View
@@ -8,7 +8,7 @@ class Site
def initialize(site)
@uri = URI.parse(site)
- @domain = PublicSuffix.parse(@uri.host)
+ @domain = PublicSuffix.parse(@uri.host || "")
@domain.valid? or raise DomainInvalid, "The domain provided is invalid.1"
rescue PublicSuffix::DomainInvalid, URI::InvalidURIError
@@ -44,13 +44,13 @@ def fragment
end
def url(supported_components = [:domain])
- supported_components = COMPONENTS & supported_components #get ordered list
+ components = COMPONENTS & supported_components #get ordered list
- unless supported_components.include?(:subdomain) ^ supported_components.include?(:domain)
+ unless components.include?(:subdomain) ^ components.include?(:domain)
raise SupportedComponentsInvalid, "Either subdomain or domain should be set as a supported component, not both."
end
- supported_components.inject("") do |url, component|
+ components.inject("") do |url, component|
url + case component
when :scheme
scheme and "#{scheme}://" or ""
2  spec/page_rankr_spec.rb
View
@@ -144,7 +144,7 @@
describe "::Site" do
[nil, '', 'batman.thedarkknight'].each do |value|
- it "should raise an exception when given #{value}" do
+ it "should raise an exception when given #{value.inspect}" do
expect{PageRankr::Site(value)}.should raise_error(PageRankr::DomainInvalid)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.