Skip to content

Chitter Challenge - Rhys#212

Open
RhysFJohn wants to merge 4 commits into
makersacademy:mainfrom
RhysFJohn:main
Open

Chitter Challenge - Rhys#212
RhysFJohn wants to merge 4 commits into
makersacademy:mainfrom
RhysFJohn:main

Conversation

@RhysFJohn
Copy link
Copy Markdown

@RhysFJohn RhysFJohn commented Apr 1, 2022

…ry 3

Rhys

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).

  • User story 1: "I want to see all the messages (peeps) in a browser"
  • User story 2: "I want to post a message (peep) to chitter"
  • User story 3: "I want to see the date the message was posted"
  • User story 4: "I want to see a list of peeps in reverse chronological order"
  • User story 5: "I want to filter on a specific keyword"

README checklist

Does your README contains instructions for

  • how to install,
  • how to run,
  • and how to test your code?

Here is a pill that can help you write a great README!

@RhysFJohn RhysFJohn changed the title First commit for chitter Individual challenge completed upto user sto… Chitter Challenge - Rhys Apr 1, 2022
Comment thread spec/peep_spec.rb
it 'returns all peeps' do
connection = PG.connect(dbname: 'chitter_test')

# connection.exec("INSERT INTO peeps (message) VALUES('Hey, Welcome to my chitter page');")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to delete old notes if not required

Copy link
Copy Markdown
Contributor

@siellsiell siellsiell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, it's Simo, a coach. I've reviewed your code and left a few comments below. Do ask if you have any questions.

Comment thread app.rb
Comment on lines +15 to +17
get '/new_peep' do
erb :new_peep
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you'd like to use more standard names for you routes, check out this blog post on RESTful routing: https://medium.com/@shubhangirajagrawal/the-7-restful-routes-a8e84201f206

@@ -0,0 +1 @@
ALTER TABLE peeps ADD COLUMN peep_date DATE DEFAULT CURRENT_DATE; No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of the DATE column type!

Comment thread lib/peeps.rb
Comment on lines +26 to +30
if ENV['ENVIRONMENT'] == 'test'
connection = PG.connect(dbname: 'chitter_test')
else
connection = PG.connect(dbname: 'chitter')
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece of code appears twice in this file. How might you remove this duplication?

Comment thread lib/peeps.rb
Comment on lines +37 to +45
# def self.filter(filter:)
# if ENV['ENVIRONMENT'] == 'test'
# connection = PG.connect(dbname: 'chitter_test')
# else
# connection = PG.connect(dbname: 'chitter')
# end

# connection.exec_params("SELECT * FROM peeps WHERE peeps.message LIKE '%#{filter}%'")
# end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always a good idea to remove commented out code from code you submit for code review (anywhere, not just at Makers)

Comment on lines +9 to +11
expect(page).to have_content('Today was a great day')
expect(page).to have_content('Today was a greater day')
expect(page).to have_content('Today was the greatest day')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you added the date feature, there should also be a feature test for that.

fill_in('message', with: 'Today was a great day')
click_button('Post')

expect(page).to have_content("Today was a great day")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants