forked from gotealeaf/myflix
-
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.
Merge pull request #6 from Jameskcoleman/week_3_part_2
Week 3 part 2
- Loading branch information
Showing
13 changed files
with
161 additions
and
33 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
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
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
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
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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Fabricator(:category) do | ||
name { Faker::Lorem.words(1) } | ||
name { Faker::Lorem.word } | ||
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,61 @@ | ||
require 'spec_helper' | ||
|
||
feature "User interacts with the queue" do | ||
scenario "user adds and reorders videos in the queue" do | ||
comedies = Fabricate(:category) | ||
monk = Fabricate(:video, title: "Monk", category: comedies) | ||
south_park = Fabricate(:video, title: "South Park", category: comedies) | ||
futurama = Fabricate(:video, title: "Futurama", category: comedies) | ||
sign_in | ||
|
||
add_video_to_queue(monk) | ||
expect_video_to_be_in_queue(monk) | ||
|
||
visit video_path(monk) | ||
expect_link_not_to_be_seen("+ My Queue") | ||
|
||
|
||
add_video_to_queue(south_park) | ||
add_video_to_queue(futurama) | ||
|
||
|
||
set_video_position(monk, 3) | ||
set_video_position(south_park, 1) | ||
set_video_position(futurama, 2) | ||
|
||
update_queue | ||
|
||
expect_video_position(south_park, 1) | ||
expect_video_position(futurama, 2) | ||
expect_video_position(monk, 3) | ||
|
||
end | ||
|
||
def update_queue | ||
click_button "Update Instant Queue" | ||
end | ||
|
||
def expect_video_to_be_in_queue(video) | ||
page.should have_content(video.title) | ||
end | ||
|
||
def expect_link_not_to_be_seen(link_text) | ||
page.should_not have_content(link_text) | ||
end | ||
|
||
def add_video_to_queue(video) | ||
visit home_path | ||
find("a[href='/videos/#{video.id}']").click | ||
click_link "+ My Queue" | ||
end | ||
|
||
def set_video_position(video, position) | ||
within(:xpath, "//tr[contains(.,'#{video.title}')]") do | ||
fill_in "queue_items[][position]", with: position | ||
end | ||
end | ||
|
||
def expect_video_position(video, position) | ||
expect(find(:xpath, "//tr[contains(.,'#{video.title}')]//input[@type='text']").value).to eq(position.to_s) | ||
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,9 @@ | ||
require 'spec_helper' | ||
|
||
feature "user signs in" do | ||
scenario "with valid user email and password" do | ||
alice = Fabricate(:user) | ||
sign_in(alice) | ||
page.should have_content alice.full_name | ||
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
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
Oops, something went wrong.