Skip to content

Commit

Permalink
Add signup page
Browse files Browse the repository at this point in the history
  • Loading branch information
aubreysalmins committed May 11, 2023
1 parent f346f0d commit ffa01c1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ class Application < Sinatra::Base
@peep_list = repo.all
return erb(:index)
end

get "/signup" do
return erb(:signup)
end
end

14 changes: 11 additions & 3 deletions spec/Integration/app_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,23 @@ def reset_tables
expect(response.body).to include "Peep 1"
expect(response.body).to include "Meow"
end


end

context 'POST /' do
it 'posts a new peep' do
response = post('/', title: 'New peep', content: 'new peep content')

expect(response.status).to eq 200
expect(response.body).to include 'New peep'
end
end

context 'GET /signup' do
it 'gets the signup page' do
response = get('/signup')

expect(response.status).to eq 200
expect(response.body).to include '<h2>Sign up</h2>'
expect(response.body).to include '<label>Password</label>'
end
end
end
3 changes: 3 additions & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
</head>
<body>
<h1>Chitter</h1>
<form action ="/signup" method="get">
<input type="submit" value="Sign up">
</form>
<h2>Post</h2>
<form method="POST" action="/">
<div>
Expand Down
18 changes: 18 additions & 0 deletions views/signup.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<body>
<div>
<h2>Sign up</h2>
</div>
<form action="/signup" method="POST">
<label>Name</label>
<input type="text" name="name">
<label>Username</label>
<input type="text" name="username">
<label>Email</label>
<input type="text" name="email">
<label>Password</label>
<input type="text" name="password">
<input type="submit" value="Sign up">
</form>
</body>
</html>

0 comments on commit ffa01c1

Please sign in to comment.