Amy's Chitter#233
Conversation
erb16
left a comment
There was a problem hiding this comment.
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.
class follows the single responsibility principle
| "result": { | ||
| "line": 100.0 | ||
| } | ||
| } |
| connection = PG.connect(dbname: 'chitter') | ||
| connection.exec("INSERT INTO peeps (message) VALUES('#{peep}')") | ||
| redirect '/' | ||
| p "Peep sent!" |
| expect(page).to have_content "It is a bit warm!" | ||
| end | ||
| end | ||
|
|
siellsiell
left a comment
There was a problem hiding this comment.
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.
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.
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.
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!