generated from lighthouse-labs/jungle-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bad1b29
commit 7a4c678
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature "Visitor navigates to home page", type: :feature, js: true do | ||
|
||
# SETUP | ||
before :each do | ||
@category = Category.create! name: 'Apparel' | ||
|
||
10.times do |n| | ||
@category.products.create!( | ||
name: Faker::Hipster.sentence(3), | ||
description: Faker::Hipster.paragraph(4), | ||
image: open_asset('apparel1.jpg'), | ||
quantity: 10, | ||
price: 64.99 | ||
) | ||
end | ||
end | ||
|
||
scenario "They see all products" do | ||
# This is the act | ||
visit root_path | ||
|
||
# Takes a screenshot | ||
save_and_open_screenshot | ||
|
||
# This is to verify | ||
expect(page).to have_css 'article.product', count: 10 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Helper function to open product images | ||
def open_asset(file_name) | ||
File.open(Rails.root.join('db', 'seed_assets', file_name)) | ||
end |