more tests for Story#domain

This commit is contained in:
Peter Bhat Harkins 2018-04-18 18:48:42 -05:00
parent 828758bb17
commit 60c7a9cc3a
1 changed files with 6 additions and 8 deletions

View File

@ -75,14 +75,12 @@ describe Story do
end
it "parses domain properly" do
s = Story.make!(:url => "http://example.com")
expect(s.domain).to eq("example.com")
s = Story.make!(:url => "http://www3.example.com/goose")
expect(s.domain).to eq("example.com")
s = Story.make!(:url => "http://flub.example.com")
expect(s.domain).to eq("flub.example.com")
expect(Story.new(url: "http://example.com").domain).to eq("example.com")
expect(Story.new(url: "https://example.com").domain).to eq("example.com")
expect(Story.new(url: "http://example.com:8000").domain).to eq("example.com")
expect(Story.new(url: "http://example.com:8000/").domain).to eq("example.com")
expect(Story.new(url: "http://www3.example.com/goose").domain).to eq("example.com")
expect(Story.new(url: "http://flub.example.com").domain).to eq("flub.example.com")
end
it "converts a title to a url properly" do