Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add about page #4

Merged
merged 1 commit into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/quke/demo_app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class App < Sinatra::Base
@title = "Welcome to Quke"
erb :index
end

get "/about" do
@title = "About"
erb :about
end
end
end
end
2 changes: 2 additions & 0 deletions lib/quke/demo_app/views/about.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1><%= @title %></h1>
<p class="lead">The about page.</p>
29 changes: 25 additions & 4 deletions spec/quke/demo_app/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,32 @@
module Quke
module DemoApp
RSpec.describe App do
it "should allow accessing the home page" do
get "/"
context "/" do
it "GET displays the page" do
get "/"

expect(last_response).to be_ok
expect(last_response.body).to include("Welcome to Quke")
expect(last_response.body).to include("Welcome to Quke")
end

it "GET returns the status 200" do
get "/"

expect(last_response).to be_ok
end
end

context "/about" do
it "GET displays the page" do
get "/"

expect(last_response.body).to include("About")
end

it "GET returns the status 200" do
get "/"

expect(last_response).to be_ok
end
end
end
end
Expand Down