-
Notifications
You must be signed in to change notification settings - Fork 1
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
feedback commit #118
base: master
Are you sure you want to change the base?
feedback commit #118
Conversation
|
||
expect(page).to have_current_path(cart_path) | ||
expect(page).to have_content("#{item_1.description}") | ||
expect(page).to have_content("#{item_2.description}") |
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.
Prefer to_s over string interpolation.
|
||
expect(page).to have_current_path(cart_path) | ||
expect(page).to have_content("#{item_1.description}") | ||
expect(page).to have_content("#{item_2.description}") |
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.
Prefer to_s over string interpolation.
create_valid_account | ||
|
||
expect(page).to have_current_path(cart_path) | ||
expect(page).to have_content("#{item_1.description}") |
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.
Prefer to_s over string interpolation.
create_valid_account | ||
|
||
expect(page).to have_current_path(cart_path) | ||
expect(page).to have_content("#{item_1.description}") |
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.
Prefer to_s over string interpolation.
|
||
scenario "the user has two items in their cart" do | ||
expect(page).to have_content("#{item_1.description}") | ||
expect(page).to have_content("#{item_2.description}") |
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.
Prefer to_s over string interpolation.
|
||
scenario "the user has two items in their cart" do | ||
expect(page).to have_content("#{item_1.description}") | ||
expect(page).to have_content("#{item_2.description}") |
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.
Prefer to_s over string interpolation.
end | ||
|
||
scenario "the user has two items in their cart" do | ||
expect(page).to have_content("#{item_1.description}") |
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.
Prefer to_s over string interpolation.
end | ||
|
||
scenario "the user has two items in their cart" do | ||
expect(page).to have_content("#{item_1.description}") |
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.
Prefer to_s over string interpolation.
require 'rails_helper' | ||
|
||
feature 'When a visitor has items in their cart' do | ||
|
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.
Extra empty line detected at block body beginning.
require 'rails_helper' | ||
|
||
feature 'When a visitor has items in their cart' do | ||
|
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.
Extra empty line detected at block body beginning.
require 'rails_helper' | ||
|
||
feature "A visitor does not successfully create an account" do | ||
|
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.
Extra empty line detected at block body beginning.
require 'rails_helper' | ||
|
||
feature "A visitor does not successfully create an account" do | ||
|
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.
Extra empty line detected at block body beginning.
require 'rails_helper' | ||
|
||
feature 'A visitor can create an account' do | ||
|
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.
Extra empty line detected at block body beginning.
require 'rails_helper' | ||
|
||
feature 'A visitor can create an account' do | ||
|
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.
Extra empty line detected at block body beginning.
feature "When a site visitor is unauthenticated" do | ||
before do | ||
customer = create(:customer) | ||
@order_1, order_2, order_3 = create_list(:all_new_order, 3, customer: customer) |
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.
Useless assignment to variable - order_2. Use _ or _order_2 as a variable name to indicate that it won't be used.
Useless assignment to variable - order_3. Use _ or _order_3 as a variable name to indicate that it won't be used.
feature "When a site visitor is unauthenticated" do | ||
before do | ||
customer = create(:customer) | ||
@order_1, order_2, order_3 = create_list(:all_new_order, 3, customer: customer) |
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.
Useless assignment to variable - order_2. Use _ or _order_2 as a variable name to indicate that it won't be used.
Useless assignment to variable - order_3. Use _ or _order_3 as a variable name to indicate that it won't be used.
|
||
feature "When a visitor is logged in" do | ||
before do | ||
Customer.create!( first_name: "Jane", |
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.
Space inside parentheses detected.
|
||
feature "When a visitor is logged in" do | ||
before do | ||
Customer.create!( first_name: "Jane", |
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.
Space inside parentheses detected.
end | ||
|
||
feature "When a customer visits the items detail page and adds that item to their cart" do | ||
|
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.
Extra empty line detected at block body beginning.
end | ||
|
||
feature "When a customer visits the items detail page and adds that item to their cart" do | ||
|
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.
Extra empty line detected at block body beginning.
scenario "the admin updates the item description" do | ||
new_description = "Genuine lumberjack pants. Look like you do work, without actually doing it." | ||
click_on_edit | ||
fill_in "item[description]", with: "#{new_description}" |
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.
Prefer to_s over string interpolation.
scenario "the admin updates the item description" do | ||
new_description = "Genuine lumberjack pants. Look like you do work, without actually doing it." | ||
click_on_edit | ||
fill_in "item[description]", with: "#{new_description}" |
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.
Prefer to_s over string interpolation.
@@ -0,0 +1,81 @@ | |||
FactoryGirl.define do | |||
|
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.
Extra empty line detected at block body beginning.
@@ -0,0 +1,81 @@ | |||
FactoryGirl.define do | |||
|
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.
Extra empty line detected at block body beginning.
end | ||
|
||
def items_and_quantities | ||
items.reduce(Hash.new(0)) do |hash, item| |
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.
Use each_with_object instead of reduce.
end | ||
|
||
def items_and_quantities | ||
items.reduce(Hash.new(0)) do |hash, item| |
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.
Use each_with_object instead of reduce.
|
||
def clean_cart | ||
contents.delete_if do |item_id, quantity| | ||
quantity == 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.
Use quantity.zero? instead of quantity == 0.
|
||
def clean_cart | ||
contents.delete_if do |item_id, quantity| | ||
quantity == 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.
Use quantity.zero? instead of quantity == 0.
private | ||
|
||
def clean_cart | ||
contents.delete_if do |item_id, quantity| |
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.
Unused block argument - item_id. If it's necessary, use _ or _item_id as an argument name to indicate that it won't be used.
end | ||
|
||
def items_with_quantities | ||
contents.reduce({}) do |memo, (id, quantity)| |
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.
Use each_with_object instead of reduce.
private | ||
|
||
def clean_cart | ||
contents.delete_if do |item_id, quantity| |
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.
Unused block argument - item_id. If it's necessary, use _ or _item_id as an argument name to indicate that it won't be used.
end | ||
|
||
def items_with_quantities | ||
contents.reduce({}) do |memo, (id, quantity)| |
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.
Use each_with_object instead of reduce.
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.
@CPowell23 @robbie-smith @ski-climb @lucyconklin great work on this. here's some feedback 😄 sorry for the delay!
@@ -1,24 +1,11 @@ | |||
# README | |||
# Little Shop |
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 suggest adding an overview of what this application does here and perhaps how to pull it down and get it working locally 👍
}); | ||
}); | ||
|
||
function stripeResponseHandler(status, response) { |
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.
wooo stripe checkout 🎉
|
||
def filter_orders | ||
if status_filter.nil? | ||
Order.all.most_recent |
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.
if most_recent
is a class method, we don't need to call all
here
@@ -1,3 +1,38 @@ | |||
class ApplicationController < ActionController::Base | |||
include ApplicationHelper | |||
include MessageHelper |
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.
we talked about this in your eval a bit, helper modules are conventionally used for your views - their responsibility is formatting output for viewing purposes. i like how you refactored your controllers - could we make a PORO though to handle some of this logic?
def create | ||
customer = current_customer.stripe_customer | ||
|
||
begin |
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.
there's a lot of stuff going on here (i know this is all stripe logic) - i suggest pulling this out to a PORO in order to keep your controller more single responsibility 👍
<p><%= @item.description %></p> | ||
<div> | ||
<h4><%= number_to_currency(@item.price_in_dollars) %></h4> | ||
<% if @item.retired == false %> |
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.
this is too much logic in your view. i suggest creating a method on Item
called retired?
that does this for you 😄
<%= yield %> | ||
<%= render partial: 'layouts/nav' %> | ||
<section class="main"> | ||
<%= render partial: 'shared/errors' %> |
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.
woooo shared partials 👍
</div> | ||
<% end %> | ||
<p><%= number_to_currency(item.price_in_dollars) %></p> | ||
<% if item.retired == false %> |
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.
you could reuse that retired?
method here!
<% end %> | ||
</td> | ||
<td> | ||
<% if order.status.paid? || order.status.ordered? %> |
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.
this is also a lot of logic in your view. can we create a method in Order
that does this for us? maybe something called paid_or_ordered?
?
@@ -58,6 +58,9 @@ development: | |||
test: | |||
<<: *default | |||
database: little_shop_test | |||
|
|||
adapter: postgresql | |||
database: travis_ci_test |
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.
🎉 🎉 🎉
feedback only - do NOT merge!