Skip to content
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

Week 7 part 2 #144

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
84166d0
Finished prework
Jameskcoleman Jun 22, 2014
8389e62
Finished week 1 assignments 7 through 10
Jameskcoleman Jun 22, 2014
f41e882
Merge pull request #1 from Jameskcoleman/week_1_first_assignments
Jameskcoleman Jun 23, 2014
503fb10
Completed assignments 15 and 16
Jameskcoleman Jun 23, 2014
c651f11
Trying to solve problem
Jameskcoleman Jun 23, 2014
bbf12e5
Finished Week 1
Jameskcoleman Jun 29, 2014
d37d229
Merge pull request #2 from Jameskcoleman/week_1_section_2
Jameskcoleman Jun 29, 2014
7c7f812
Finished Week 2 assignment 10
Jameskcoleman Jul 4, 2014
596aed6
Completed through week 2 assignment 17
Jameskcoleman Jul 7, 2014
c578c38
Merge pull request #3 from Jameskcoleman/week_2_part_1
Jameskcoleman Jul 7, 2014
79ea0ad
Completed week 2 assignments 15 and 16
Jameskcoleman Jul 7, 2014
394f9c7
Finished Week 2
Jameskcoleman Jul 7, 2014
7b8e61d
Merge pull request #4 from Jameskcoleman/week_2_part_2
Jameskcoleman Jul 7, 2014
cced288
User can reorder videos in the queue
Jameskcoleman Jul 9, 2014
6c32f0c
Pushed down complexity. User can change video ratings in the queue.
Jameskcoleman Jul 9, 2014
2cda3ef
Merge pull request #5 from Jameskcoleman/week_3_part_1
Jameskcoleman Jul 9, 2014
80d46d8
Implemented feature spec for user sign in
Jameskcoleman Jul 10, 2014
e9b76e9
Completed Week 3
Jameskcoleman Jul 11, 2014
d0f3e1e
Merge pull request #6 from Jameskcoleman/week_3_part_2
Jameskcoleman Jul 11, 2014
d9df28f
Implemented the user profile page
Jameskcoleman Jul 11, 2014
aeb77ad
Implemented user profile page, People I Follow page, ability to follo…
Jameskcoleman Jul 14, 2014
d139ad6
Merge pull request #7 from Jameskcoleman/week_4_part_1
Jameskcoleman Jul 14, 2014
26c035d
Implemented welcome email sending and added tests to email sending
Jameskcoleman Jul 15, 2014
294336e
Implemented sending welcome email, added tests to email sending, impl…
Jameskcoleman Jul 16, 2014
9cf1cd5
Merge pull request #8 from Jameskcoleman/week_4_part_2
Jameskcoleman Jul 16, 2014
2195494
Deleted superfluous file.
Jameskcoleman Jul 16, 2014
94cf991
Wrote integration test for resetting password and implemented invitin…
Jameskcoleman Jul 19, 2014
2eb4e45
Refactored with concerns
Jameskcoleman Jul 21, 2014
a595be2
Merge pull request #9 from Jameskcoleman/week_5_part_1
Jameskcoleman Jul 21, 2014
5f90182
Changed email configuration
Jameskcoleman Jul 21, 2014
81e8a93
Changed email configuration
Jameskcoleman Jul 21, 2014
2edbd1d
Changed email configuration
Jameskcoleman Jul 21, 2014
43ab794
Changed email configuration
Jameskcoleman Jul 21, 2014
7d2ba13
Changed email configuration
Jameskcoleman Jul 21, 2014
6516620
Set up Sidekiq and Unicorn
Jameskcoleman Jul 28, 2014
0580974
Merge pull request #10 from Jameskcoleman/week_5_part_2
Jameskcoleman Jul 28, 2014
0b12bb8
Changed Unicorn config
Jameskcoleman Jul 28, 2014
7e8bfb8
Changed procfile
Jameskcoleman Jul 28, 2014
b8cd20c
Added Sentry
Jameskcoleman Jul 28, 2014
cbf2f7e
Gem update
Jameskcoleman Jul 28, 2014
1570e44
Added paratrooper gem
Jameskcoleman Jul 28, 2014
e8ce385
Added deployment rake task
Jameskcoleman Jul 28, 2014
73eb8da
Modified deploy.rake
Jameskcoleman Jul 28, 2014
c6e4051
Modified deploy.rake
Jameskcoleman Jul 28, 2014
3822f37
Modified deploy.rake
Jameskcoleman Jul 28, 2014
a91c02d
Implemented admin sign in
Jameskcoleman Jul 29, 2014
428c65e
Implemented admin signs in, admin adds a video
Jameskcoleman Aug 4, 2014
735bd67
Implemented watch video and feature test for adding video.
Jameskcoleman Aug 5, 2014
5685425
Merge pull request #11 from Jameskcoleman/week_6_part_1
Jameskcoleman Aug 5, 2014
1e9a6b9
Implemented using Stripe custom form to charge credit card
Jameskcoleman Aug 5, 2014
1b39aec
Improved description of tokenable
Jameskcoleman Aug 5, 2014
775c38e
Merge pull request #12 from Jameskcoleman/week_6_part_2
Jameskcoleman Aug 6, 2014
1d04683
Removed config file
Jameskcoleman Aug 6, 2014
a243c15
Built API wrapper for Stripe
Jameskcoleman Aug 6, 2014
b7db515
Implemented charge credit card on registration
Jameskcoleman Aug 6, 2014
91576aa
Implemented charge credit card on registration
Jameskcoleman Aug 6, 2014
536f1e2
Implemented feature test for registration with credit card
Jameskcoleman Aug 7, 2014
85f0d27
Merge pull request #13 from Jameskcoleman/week_7_part_1
Jameskcoleman Aug 7, 2014
f79956b
Wrote videos decorator
Jameskcoleman Aug 7, 2014
f0ce62d
Wrote a sign up service
Jameskcoleman Aug 7, 2014
c5b5936
Modified .gitignore
Jameskcoleman Aug 9, 2014
f6ec4b2
Modified .gitignore
Jameskcoleman Aug 9, 2014
d46c20d
Modified gitignore
Jameskcoleman Aug 9, 2014
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
Prev Previous commit
Next Next commit
Completed Week 3
  • Loading branch information
Jameskcoleman committed Jul 11, 2014
commit e9b76e92e384c805c6117c7061a9efc8d51071e2
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ group :test do
gem 'database_cleaner', '1.2.0'
gem 'shoulda-matchers'
gem 'capybara'
gem 'launchy'
end

group :production do
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
arel (5.0.1.20140414130214)
bcrypt-ruby (3.1.0)
better_errors (1.0.1)
@@ -75,6 +76,8 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
launchy (2.4.2)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
@@ -185,6 +188,7 @@ DEPENDENCIES
faker
haml-rails
jquery-rails
launchy
pg
pry
pry-nav
4 changes: 4 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -13,4 +13,8 @@ def normalize_queue_item_positions
end
end

def queued_video?(video)
queue_items.map(&:video).include?(video)
end

end
2 changes: 1 addition & 1 deletion app/views/queue_items/index.html.haml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
- @queue_items.each do |queue_item|
%tr
= hidden_field_tag("queue_items[][id]", queue_item.id)
%td= text_field_tag("queue_items[][position]", queue_item.position)
%td= text_field_tag("queue_items[][position]", queue_item.position, data: {video_id: queue_item.video.id})
%td
= link_to queue_item.video_title, queue_item.video
%td
2 changes: 1 addition & 1 deletion app/views/videos/show.html.haml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
%span Rating: 4.5/5.0
%p= @video.description
.actions
= link_to "+ My Queue", queue_items_path(video_id: @video.id), method: :post, class: 'btn'
= link_to "+ My Queue", queue_items_path(video_id: @video.id), method: :post, class: 'btn' unless current_user.queued_video?(@video)
%section.reviews.container
.row
.col-sm-10.col-sm-offset-1
2 changes: 1 addition & 1 deletion spec/fabricators/category_fabricator.rb
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
61 changes: 61 additions & 0 deletions spec/features/user_interacts_with_queue_spec.rb
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
5 changes: 1 addition & 4 deletions spec/features/user_sign_in_spec.rb
Original file line number Diff line number Diff line change
@@ -3,10 +3,7 @@
feature "user signs in" do
scenario "with valid user email and password" do
alice = Fabricate(:user)
visit sign_in_path
fill_in "Email Address", with: alice.email
fill_in "Password", with: alice.password
click_button "Sign In"
sign_in(alice)
page.should have_content alice.full_name
end
end
14 changes: 14 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -6,4 +6,18 @@
it { should validate_presence_of(:full_name) }
it { should validate_uniqueness_of(:email) }
it { should have_many(:queue_items).order(:position)}

describe "#queued_video?" do
it "returns true when the user queued the video" do
user = Fabricate(:user)
video = Fabricate(:video)
Fabricate(:queue_item, user: user, video: video)
user.queued_video?(video).should be true
end
it "returns false when the user has not queued the video" do
user = Fabricate(:user)
video = Fabricate(:video)
user.queued_video?(video).should be false
end
end
end
9 changes: 9 additions & 0 deletions spec/support/macros.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
def set_current_user(user=nil)
session[:user_id] = (user || Fabricate(:user)).id
end

def sign_in(a_user=nil)
user = a_user || Fabricate(:user)
visit sign_in_path
fill_in "Email Address", with: user.email
fill_in "Password", with: user.password
click_button "Sign In"

end