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

Chitter project #2201

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3230616
Initial commit
snptrs Jun 1, 2023
a17dce5
Draft database and app designs
snptrs Jun 1, 2023
fd53bc8
Create Maker and Peep classes
snptrs Jun 1, 2023
2866cab
Create table schemas and seeds
snptrs Jun 1, 2023
8be6a4d
Passing test for MakerRepository.all
snptrs Jun 1, 2023
2cc341e
Passing test for MakerRepository.find
snptrs Jun 1, 2023
4ee0bef
Passing test for MakerRepository.create
snptrs Jun 1, 2023
ced0907
Passing test for PeepRepository.all
snptrs Jun 1, 2023
82c2932
Passing test for PeepRepository.find
snptrs Jun 1, 2023
e2cd8b2
Passing test for PeepRepository.create
snptrs Jun 1, 2023
d7ba677
Passing test for PeepRepository.find_by_maker
snptrs Jun 2, 2023
b7e8f3b
Updated Peep object to also include maker_name
snptrs Jun 2, 2023
45baace
Passing test for GET /
snptrs Jun 2, 2023
e439193
Update seeds
snptrs Jun 2, 2023
c6e736b
Updated SQL sort order and tests
snptrs Jun 2, 2023
d69311c
Add GET /peep/:id route and passing test
snptrs Jun 2, 2023
52122c6
Add GET /peep/new and POST /peep routes and tests
snptrs Jun 2, 2023
40e6761
Add some navigation links
snptrs Jun 2, 2023
6dde69e
Add Maker registration methods and tests
snptrs Jun 2, 2023
05bfd53
Add MakerRepository.find_by_email and passing tests
snptrs Jun 2, 2023
63aee47
Create GET and POST /maker/login and tests
snptrs Jun 2, 2023
36df892
Redirect to login form when trying to post new Peep
snptrs Jun 3, 2023
e466938
Tweaking support fles
snptrs Jun 3, 2023
0e245ab
Implement GET /maker/logout
snptrs Jun 3, 2023
24cd456
Change time formatting
snptrs Jun 3, 2023
2aea017
Add stylesheet and formatting tweaks
snptrs Jun 3, 2023
1adb3a4
Add error handling and input validation
snptrs Jun 3, 2023
3948364
Add production db reset method
snptrs Jun 3, 2023
358f2e1
Setup for deploy
snptrs Jun 3, 2023
39aee04
Change time format to 24-hour
snptrs Jun 4, 2023
304b86f
Create production SQL seeds
snptrs Jun 4, 2023
5ecaadf
Remove .reset_db method
snptrs Jun 4, 2023
ff4697e
Add tests for error output
snptrs Jun 4, 2023
ce3ff2f
Update production password hashes
snptrs Jun 4, 2023
cdabd69
Add MakerRepository.find_by_name method
snptrs Jun 4, 2023
30d91c2
Add Mentions class
snptrs Jun 4, 2023
fda74e6
Check new Peeps for mentions
snptrs Jun 4, 2023
b47f5c4
Add Mailgun gem
snptrs Jun 4, 2023
6e7ae49
Update seed email addresses
snptrs Jun 4, 2023
060a339
Add Notifications.send_notification
snptrs Jun 4, 2023
0219f30
Update notification message
snptrs Jun 4, 2023
a06c594
Mock Mailgun response in test environment
snptrs Jun 4, 2023
6a664c8
Update README
snptrs Jun 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Redirect to login form when trying to post new Peep
snptrs committed Jun 3, 2023
commit 36df892a69ae246af5a8a9bb521aac8fec31a38e
6 changes: 5 additions & 1 deletion app.rb
Original file line number Diff line number Diff line change
@@ -23,7 +23,11 @@ class Application < Sinatra::Base
end

get '/peep/new' do
return erb(:new_peep)
if session[:maker_id] == nil
redirect '/maker/login'
else
return erb(:new_peep)
end
end

get '/peep/:id' do
11 changes: 10 additions & 1 deletion spec/app_spec.rb
Original file line number Diff line number Diff line change
@@ -35,7 +35,15 @@ def reset_chitter_db
end

context "GET /peep/new" do
it "returns the new Peep form" do
it "redirects to the login form if user is not logged in" do
response = get('/peep/new')
follow_redirect!
expect(last_response.status).to eq 200
expect(last_response.body).to include("<h1>Log in</h1>")
end

it "returns the new Peep form if the user is logged in" do
post('/maker/login', email: '[email protected]', password: '1234')
response = get('/peep/new')
expect(response.status).to eq(200)
expect(response.body).to include("<h1>New Peep</h1>")
@@ -83,6 +91,7 @@ def reset_chitter_db
it "logs the user in if their credentials are valid" do
response = post('/maker/login', email: '[email protected]', password: '1234')
expect(response.status).to eq(200)

end

it "returns an error if the password is wrong" do