Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

Commit

Permalink
Switched off homepage and replaced with 301 redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
njh committed Apr 11, 2019
1 parent e5e2d4e commit 83c5917
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
7 changes: 4 additions & 3 deletions dbpedialite.rb
Expand Up @@ -99,9 +99,10 @@ def format_iso8061(datetime)
end end


get '/' do get '/' do
headers 'Cache-Control' => 'public,max-age=3600' headers 'Cache-Control' => 'public,max-age=31536000'
@readme = RDiscount.new(File.read(File.join(File.dirname(__FILE__), 'README.md'))) redirect "https://github.com/njh/dbpedialite", 301
erb :index #@readme = RDiscount.new(File.read(File.join(File.dirname(__FILE__), 'README.md')))
#erb :index
end end


get %r{/search\.?([a-z]*)} do |format| get %r{/search\.?([a-z]*)} do |format|
Expand Down
25 changes: 3 additions & 22 deletions spec/dbpedialite_spec.rb
Expand Up @@ -25,28 +25,9 @@ def app
get '/' get '/'
end end


it "should be successful" do it "should redirect" do
last_response.should be_ok last_response.status.should == 301
end last_response.location.should == 'https://github.com/njh/dbpedialite'

it "should be of type text/html" do
last_response.content_type.should == 'text/html;charset=utf-8'
end

it "should be cachable" do
last_response.headers['Cache-Control'].should =~ /max-age=([1-9]+)/
end

it "should have CORS enabled" do
last_response.headers['Access-Control-Allow-Origin'].should == '*'
end

it "should contain the readme text" do
last_response.body.should =~ /take some of the structured data/
end

it "should contain the bookmarklet" do
last_response.body.should =~ %r|javascript:location.href='http://example.org/flipr\?url=|
end end


it "should be cachable" do it "should be cachable" do
Expand Down

0 comments on commit 83c5917

Please sign in to comment.