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

Miranda code review #238

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ruby '3.0.2'

gem 'pg'
gem 'sinatra'
gem 'sinatra-contrib'

group :test do
gem 'capybara'
Expand Down
11 changes: 11 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ GEM
diff-lcs (1.4.4)
docile (1.4.0)
mini_mime (1.1.1)
multi_json (1.15.0)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
nokogiri (1.12.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.12.3-x86_64-darwin)
racc (~> 1.4)
parallel (1.20.1)
Expand Down Expand Up @@ -75,6 +78,12 @@ GEM
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
sinatra-contrib (2.1.0)
multi_json
mustermann (~> 1.0)
rack-protection (= 2.1.0)
sinatra (= 2.1.0)
tilt (~> 2.0)
terminal-table (3.0.1)
unicode-display_width (>= 1.1.1, < 3)
tilt (2.0.10)
Expand All @@ -83,6 +92,7 @@ GEM
nokogiri (~> 1.8)

PLATFORMS
arm64-darwin-21
x86_64-darwin-20

DEPENDENCIES
Expand All @@ -93,6 +103,7 @@ DEPENDENCIES
simplecov
simplecov-console
sinatra
sinatra-contrib

RUBY VERSION
ruby 3.0.2p107
Expand Down
26 changes: 26 additions & 0 deletions README2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
As a Maker
So that I can see what people are doing
I want to see all the messages (peeps)
in a browser

As a Maker
So that I can let people know what I am doing
I want to post a message (peep) to chitter

As a Maker
So that I can see when people are doing things
I want to see the date the message was posted





DATABASE TABLE
As a Maker
So that I can easily see the latest peeps
I want to see a list of peeps in reverse chronological order


As a Maker
So that I can find relevant peeps
I want to filter on a specific keyword
29 changes: 27 additions & 2 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
require 'sinatra/base'
require 'sinatra/reloader'

class Chitter < Sinatra::Base
get '/test' do
'Test page'
configure :development do
register Sinatra::Reloader
end
get '/' do
"Welcome to Chitter! It's like Twitter, but with Ch :P"
end


get '/homepage' do
@peep_posts = ["look at my new car!",
"Check out my new puppy!",
"Look at the sky today!"]
erb :'homepage/index'
end














run! if app_file == $0
end
8 changes: 8 additions & 0 deletions lib/peeps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Peeps
def self.all
[ "look at my new car!",
"Check out my new puppy!",
"Look at the sky today!" ]

end
end
Empty file added spec/features/date_of_peep.rb
Empty file.
31 changes: 31 additions & 0 deletions spec/features/list_peeps_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# feature 'Viewing Peeps' do
# scenario 'A user can see messages' do
# visit('/homepage')

# expect(page).to have_content "look at my new car!"
# expect(page).to have_content "Check out my new puppy!"
# expect(page).to have_content "Look at the sky today!"
# end
# end

require 'peeps'

describe Peeps do
describe '.all' do
it 'returns all peeps' do
all_peeps = Peeps.all

expect(all_peeps).to include("look at my new car!")
expect(all_peeps).to include("Check out my new puppy!")
expect(all_peeps).to include("Look at the sky today!")
end
end
end








Empty file.
8 changes: 4 additions & 4 deletions spec/features/test_page_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
feature 'Viewing test page' do
scenario 'visiting the test page' do
visit('/test')
expect(page).to have_content "Test page"
feature 'Viewing welcome page' do
scenario 'visiting the welcome page' do
visit('/')
expect(page).to have_content "Welcome to Chitter! It's like Twitter, but with Ch :P"
end
end
Empty file added spec/peep_spec.rb
Empty file.
5 changes: 5 additions & 0 deletions views/homepage/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ul>
<% @peep_post.each do |post| %>
<li><%= post %></li>
<% end %>
</ul>
Empty file added views/new.erb
Empty file.