Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ You can find them in the `spec/features` directory.

## Development

NOTE: Whenever you change a ruby file, you need to stop the server, and restart it.
NOTE: Whenever you change a ruby file, you need to stop the server, and restart it.

## Staging

Heroku URL: http://stormy-cove-3531.herokuapp.com/
5 changes: 0 additions & 5 deletions Rakefile

This file was deleted.

1 change: 1 addition & 0 deletions lib/app.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'erb'
require 'menu'

class App
def call(env)
Expand Down
15 changes: 15 additions & 0 deletions lib/item.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Item
attr_reader :name, :price, :description

def initialize(name, price, description)
@name = name
@price = price
@description = description
end

def == (other)
self.name == other.name
self.price == other.price
self.description == other.description
end
end
10 changes: 10 additions & 0 deletions lib/menu.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'item'

class Menu
def items
[
Item.new("Channa Masala", 5.95, "Yummy goodness"),
Item.new("Chicken Tikka Masala", 5.95, "Yummy goodness")
]
end
end
11 changes: 5 additions & 6 deletions public/index.html → public/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
<img src="/images/food1.jpg">

<dl>
<dt>Channa Masala - 5.95</dt>
<dd>Yummy goodness</dd>

<dt>Chicken Tikka Masala - 5.95</dt>
<dd>Yummy goodness</dd>
<%Menu.new.items.each do |item|%>
<dt><%= item.name %> - <%= item.price%></dt>
<dd><%= item.description%></dd>
<%end%>
</dl>
</main>

Expand All @@ -45,7 +44,7 @@
Boulder, CO 80301
<a href="mailto:bob@example.com">Contact Us</a>
</address>
&copy; 2013
&copy; <%= Date.today.year %>
</footer>

</body>
Expand Down
8 changes: 7 additions & 1 deletion spec/features/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
expect(page).to have_content("Channa Masala")
expect(page).to have_content("Chicken Tikka Masala")
end


it "displays the current year for the copyright" do
visit "/"
within("footer") do
expect(page).to have_content("2014")
end
end
end
28 changes: 28 additions & 0 deletions spec/models/item_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'spec_helper'
require 'item'

describe Item do
it 'has a name' do
item = Item.new("Channa Masala", 5.95, "Yummy goodness")

expect(item.name).to eq "Channa Masala"
end
it 'has a price' do
item = Item.new("Channa Masala", 5.95, "Yummy goodness")

expect(item.price).to eq 5.95
end

it 'has a description' do
item = Item.new("Channa Masala", 5.95, "Yummy goodness")

expect(item.description).to eq "Yummy goodness"
end

it 'knows that two items are the same if they have the same attributes' do
item1 = Item.new("Channa Masala", 5.95, "Yummy goodness")
item2 = Item.new("Channa Masala", 5.95, "Yummy goodness")

expect(item1).to eq item2
end
end
12 changes: 12 additions & 0 deletions spec/models/menu_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'spec_helper'
require 'menu'

describe Menu do
it 'knows about about the items' do
menu = Menu.new
expect(menu.items).to match_array [
Item.new("Channa Masala", 5.95, "Yummy goodness"),
Item.new("Chicken Tikka Masala", 5.95, "Yummy goodness")
]
end
end