Skip to content

Instantly share code, notes, and snippets.

@iSarCasm
Created February 15, 2016 18:26
Show Gist options
  • Save iSarCasm/548f07717e0b3cdcafd9 to your computer and use it in GitHub Desktop.
Save iSarCasm/548f07717e0b3cdcafd9 to your computer and use it in GitHub Desktop.
class BooksController < ApplicationController
def show
@book = Book.find(params[:id])
@reviews = @book.reviews.where(approved: true) || []
end
end
require 'rails_helper'
RSpec.describe "fill cart -> login -> checkout", :type => :feature, js: true do
it 'fill cart -> login -> checkout' do
user = create(:user)
book_1 = create(:book)
book_2 = create(:book)
expect(Book.find(1)).to eq book_1
visit book_path(book_1)
click_on 'Add to Cart'
click_on 'Add to Cart'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment