Skip to content

Commit

Permalink
Implement #origin
Browse files Browse the repository at this point in the history
Fixes #11
  • Loading branch information
walro committed Oct 15, 2015
1 parent 8975fd8 commit 56178c2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/twingly/url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def host
addressable_uri.host
end

def origin
addressable_uri.origin
end

def path
addressable_uri.path
end
Expand Down
5 changes: 5 additions & 0 deletions spec/lib/twingly/url/null_url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
it { is_expected.to eq("") }
end

describe "#origin" do
subject { url.origin }
it { is_expected.to eq("") }
end

describe "#path" do
subject { url.path }
it { is_expected.to eq("") }
Expand Down
5 changes: 5 additions & 0 deletions spec/lib/twingly/url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ def invalid_urls
it { is_expected.to eq("www.blog.twingly.co.uk") }
end

describe "#origin" do
subject { url.origin }
it { is_expected.to eq("http://www.blog.twingly.co.uk") }
end

describe "#path" do
subject { url.path }
it { is_expected.to eq("/2015/07/01/language-detection-changes/") }
Expand Down

0 comments on commit 56178c2

Please sign in to comment.