-
Notifications
You must be signed in to change notification settings - Fork 235
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
Amy's Chitter #233
base: main
Are you sure you want to change the base?
Amy's Chitter #233
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your code is easy to follow and nicely organised!
connection = PG.connect(dbname: 'chitter') | ||
result = connection.exec("SELECT * FROM peeps;") | ||
result.map { |peep| peep['message'] } | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class follows the single responsibility principle
"result": { | ||
"line": 100.0 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
connection = PG.connect(dbname: 'chitter') | ||
connection.exec("INSERT INTO peeps (message) VALUES('#{peep}')") | ||
redirect '/' | ||
p "Peep sent!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything clear and neatly laid out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no repetitions either
expect(page).to have_content "It is a bit warm!" | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should pass!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Amy,
This is a good start to the challenge. You've demonstrated that you can read and write to the database from a web app. To make your code easier to test, it would be beneficial to have a test database. I left some more detailed comments below.
I saw that there were some bits that you were probably planning on doing but didn't get to. Was this a matter of time or did you find yourself getting blocked somewhere?
If you have any questions, feel free to answer in the comments on here or DM me.
Simo
get '/test' do | ||
'Test page' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! It's always a good idea to remove test code from code you submit for code review (anywhere, not just at Makers). Make sure you remember to also remove code you added for debugging.
connection = PG.connect(dbname: 'chitter') | ||
connection.exec("INSERT INTO peeps (message) VALUES('#{peep}')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you already have aPeep
class, it would make sense for this code to be part of that class. I see you already have a method in there called Peep.create
, which would be a good place to put it.
click_button('Peep') | ||
expect(page).to have_content "It is a bit warm!" | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature tests! It would be good to see a unit test for your Peep
class as well so that you can test it in isolation.
Your name
Please write your full name here to make it easier to find your pull request.
User stories
Please list which user stories you've implemented (delete the ones that don't apply).
README checklist
Does your README contains instructions for
Here is a pill that can help you write a great README!