kinney 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +2 -2
- data/Rakefile +4 -0
- data/app/admin/clips.rb +40 -1
- data/app/assets/javascripts/kinney/admin/video_preview.js +1 -1
- data/app/controllers/kinney/tracker_controller.rb +0 -34
- data/app/helpers/kinney/general_helper.rb +1 -1
- data/app/models/kinney/clip.rb +5 -2
- data/app/models/kinney/person.rb +11 -11
- data/app/views/{kinney/tracker → admin/kinney_clips}/_video_engagement_chart.html.erb +15 -0
- data/app/views/{kinney/tracker/analyze.html.erb → admin/kinney_clips/analyze_tracker.html.erb} +5 -3
- data/app/views/kinney/clips/show.html.erb +1 -1
- data/app/views/kinney/people/index.html.erb +4 -3
- data/app/views/kinney/sitemap/index.xml.builder +1 -1
- data/config/routes.rb +1 -1
- data/lib/kinney/version.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +33694 -0
- data/test/dummy/log/test.log +29895 -0
- data/test/dummy/tmp/cache/assets/CBF/9B0/sprockets%2Fe283548d3ef4505c82279198e09b53fa +0 -0
- data/test/dummy/tmp/cache/assets/D0B/560/sprockets%2F33db47d8bb65ee7457b03336420a55fd +0 -0
- data/test/functional/kinney/admin_clips_controller_test.rb +24 -0
- data/test/functional/kinney/clips_controller_test.rb +5 -3
- data/test/functional/kinney/people_controller_test.rb +5 -3
- data/test/functional/kinney/tracker_controller_test.rb +0 -6
- data/test/integration/admin_clip_test.rb +14 -11
- data/test/integration/admin_images_test.rb +8 -7
- data/test/integration/clips_index_test.rb +9 -6
- data/test/integration/clips_show_test.rb +11 -8
- data/test/integration/microdata_test.rb +40 -0
- data/test/integration/navigation_test.rb +7 -5
- data/test/integration/people_index_test.rb +7 -4
- data/test/integration/people_show_test.rb +14 -12
- data/test/support/test_with_cassette.rb +38 -0
- data/test/test_helper.rb +18 -2
- data/test/unit/clip_test.rb +5 -0
- data/test/vcr_cassettes/admin_clip/add_a_description_for_a_clip.yml +272 -0
- data/test/vcr_cassettes/admin_clip/admin_user_can_create_new_clip.yml +114 -0
- data/test/vcr_cassettes/admin_clip/display_whether_there_is_a_VTT_file_for_a_clip.yml +613 -0
- data/test/vcr_cassettes/admin_clip/do_not_allow_submission_of_clip_if_there_is_no_webvtt_file.yml +567 -0
- data/test/vcr_cassettes/admin_images/user_should_not_be_able_to_create_slug.yml +967 -0
- data/test/vcr_cassettes/admin_images/user_should_see_associated_name_for_image_on_index_view.yml +561 -0
- data/test/vcr_cassettes/admin_images/user_should_see_associated_name_for_image_on_show_view.yml +162 -0
- data/test/vcr_cassettes/admin_images/user_should_see_image_for_valid_image_on_edit_page.yml +186 -0
- data/test/vcr_cassettes/admin_images/user_should_see_image_for_valid_image_on_new_image_page.yml +374 -0
- data/test/vcr_cassettes/admin_images/user_should_see_image_for_valid_image_on_show_page.yml +193 -0
- data/test/vcr_cassettes/clips_controller/should_assign_a_webvtt_variable.yml +154 -0
- data/test/vcr_cassettes/clips_controller/should_assign_title_for_a_show_view.yml +136 -0
- data/test/vcr_cassettes/clips_controller/should_get_show.yml +136 -0
- data/test/vcr_cassettes/clips_index/clicking_on_a_video_thumbnail_should_go_to_a_video_clip.yml +154 -0
- data/test/vcr_cassettes/clips_show/should_expand/collapse_the_transcript.yml +154 -0
- data/test/vcr_cassettes/clips_show/should_have_link_to_other_videos_by_the_same_person.yml +136 -0
- data/test/vcr_cassettes/clips_show/should_have_link_to_profile.yml +136 -0
- data/test/vcr_cassettes/clips_show/should_not_see_More_videos_on_topics_with_link_under_video.yml +136 -0
- data/test/vcr_cassettes/clips_show/should_not_see_Video_Topics_section_on_page.yml +136 -0
- data/test/vcr_cassettes/clips_show/should_show_basic_information_about_a_clip.yml +136 -0
- data/test/vcr_cassettes/clips_show/should_show_other_clips_related_by_topic.yml +136 -0
- data/test/vcr_cassettes/clips_show/should_show_the_transcript.yml +154 -0
- data/test/vcr_cassettes/microdata/clip_show_view_should_have_microdata.yml +136 -0
- data/test/vcr_cassettes/microdata/person_show_view_should_have_microdata.yml +399 -0
- data/test/vcr_cassettes/navigation/there_should_be_a_link_to_People_in_the_global_navigation.yml +267 -0
- data/test/vcr_cassettes/people_controller/should_get_index.yml +267 -0
- data/test/vcr_cassettes/people_controller/should_get_show.yml +399 -0
- data/test/vcr_cassettes/people_controller/show_view_should_have_a_title.yml +399 -0
- data/test/vcr_cassettes/people_index/links_to_show_view_for_person_with_video.yml +663 -0
- data/test/vcr_cassettes/people_index/links_to_show_view_for_person_without_video.yml +267 -0
- data/test/vcr_cassettes/people_index/shows_people.yml +267 -0
- data/test/vcr_cassettes/people_index/sort_profile_images.yml +267 -0
- data/test/vcr_cassettes/people_show/if_there_is_only_one_image_and_it_is_a_top_pick_then_do_not_show_the_image_section_of_the_page.yml +135 -0
- data/test/vcr_cassettes/people_show/should_display_a_map_if_the_location_the_person_grew_up_is_known.yml +399 -0
- data/test/vcr_cassettes/people_show/should_display_the_information_like_description__interview_date_and_time_below_video_clip.yml +136 -0
- data/test/vcr_cassettes/people_show/should_give_a_link_to_other_videos_with_the_same_person.yml +534 -0
- data/test/vcr_cassettes/people_show/should_not_display_a_map_if_the_location_the_person_grew_up_is_not_known.yml +135 -0
- data/test/vcr_cassettes/people_show/should_not_see_the_top_pick_image_with_the_other_images.yml +399 -0
- data/test/vcr_cassettes/people_show/should_provide_a_link_to_a_video_as_an_image_and_make_it_a_top_pick.yml +399 -0
- data/test/vcr_cassettes/people_show/should_provide_a_link_to_other_videos_as_text_links.yml +399 -0
- data/test/vcr_cassettes/people_show/should_show_a_top_pick_image_near_the_biography.yml +399 -0
- data/test/vcr_cassettes/people_show/should_show_name_suffix_if_present.yml +135 -0
- data/test/vcr_cassettes/people_show/shows_person_content.yml +399 -0
- metadata +180 -59
- checksums.yaml +0 -7
- data/test/dummy/tmp/cache/assets/D36/B10/sprockets%2F3a3013990e54d3e944c21c6a9ed0b5de +0 -0
- data/test/dummy/tmp/cache/assets/D55/830/sprockets%2Fbd750c0ba01430d321ae77fbc2b238f9 +0 -0
- data/test/dummy/tmp/capybara/capybara-201209271510033933274391.html +0 -13
- data/test/dummy/tmp/capybara/capybara-201209271512386994415403.html +0 -13
- data/test/dummy/tmp/capybara/capybara-201209271515157873796042.html +0 -165
- data/test/dummy/tmp/capybara/capybara-201209271517053504547394.html +0 -165
- data/test/dummy/tmp/capybara/capybara-201209271520578220954785.html +0 -165
- data/test/dummy/tmp/capybara/capybara-201209271522457231789910.html +0 -165
- data/test/dummy/tmp/capybara/capybara-201209271524374294425819.html +0 -165
- data/test/dummy/tmp/capybara/capybara-201209271526597280429369.html +0 -165
- data/test/dummy/tmp/capybara/capybara-201209271529595570902080.html +0 -165
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class Kinney::AdminClipsControllerTest < ActionController::TestCase
|
|
4
|
+
# set_fixture_class :admin_users => Kinney::AdminUser
|
|
5
|
+
# fixtures :admin_users
|
|
6
|
+
|
|
7
|
+
include Devise::TestHelpers
|
|
8
|
+
|
|
9
|
+
setup do
|
|
10
|
+
@controller = ::Admin::KinneyClipsController.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# test "should get track" do
|
|
14
|
+
# get :track
|
|
15
|
+
# assert_response :success
|
|
16
|
+
# end
|
|
17
|
+
|
|
18
|
+
test "should get analyze" do
|
|
19
|
+
sign_in kinney_admin_users(:first)
|
|
20
|
+
get :analyze_tracker, :use_route => :kinney, :id => 'tolson-roots'
|
|
21
|
+
assert_response :success
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class Kinney::ClipsControllerTest < ActionController::TestCase
|
|
4
|
+
extend TestWithCassette
|
|
5
|
+
|
|
4
6
|
test "should get index" do
|
|
5
7
|
get :index, :use_route => :kinney
|
|
6
8
|
assert_response :success
|
|
7
9
|
assert assigns(:people)
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
test_with_cassette "should get show", 'clips_controller' do
|
|
11
13
|
get :show, :id => kinney_clips(:tolson_roots), :use_route => :kinney
|
|
12
14
|
assert_response :success
|
|
13
15
|
assert assigns(:clip)
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
test_with_cassette "should assign a webvtt variable", 'clips_controller' do
|
|
17
19
|
get :show, :id => kinney_clips(:atkins_fire), :use_route => :kinney
|
|
18
20
|
assert assigns(:webvtt)
|
|
19
21
|
assert assigns(:webvtt).respond_to?(:cues)
|
|
20
22
|
end
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
test_with_cassette 'should assign title for a show view', 'clips_controller' do
|
|
23
25
|
get :show, :id => kinney_clips(:tolson_roots), :use_route => :kinney
|
|
24
26
|
assert_equal "This is a description of the Roots clip.", assigns(:meta_description)
|
|
25
27
|
end
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class Kinney::PeopleControllerTest < ActionController::TestCase
|
|
4
|
-
|
|
4
|
+
extend TestWithCassette
|
|
5
|
+
|
|
6
|
+
test "should get index", :people_controller do
|
|
5
7
|
get :index, :use_route => :kinney
|
|
6
8
|
assert_response :success
|
|
7
9
|
end
|
|
8
10
|
|
|
9
|
-
test "should get show" do
|
|
11
|
+
test "should get show", :people_controller do
|
|
10
12
|
get :show, :id => kinney_people(:tolson), :use_route => :kinney
|
|
11
13
|
assert_response :success
|
|
12
14
|
end
|
|
13
15
|
|
|
14
|
-
test "show view should have a title" do
|
|
16
|
+
test "show view should have a title", :people_controller do
|
|
15
17
|
get :show, :id => kinney_people(:tolson), :use_route => :kinney
|
|
16
18
|
assert_equal "Norris Tolson grew up in Edgecombe County.", assigns(:meta_description)
|
|
17
19
|
end
|
|
@@ -15,10 +15,4 @@ class Kinney::TrackerControllerTest < ActionController::TestCase
|
|
|
15
15
|
# assert_response :success
|
|
16
16
|
# end
|
|
17
17
|
|
|
18
|
-
test "should get analyze" do
|
|
19
|
-
sign_in kinney_admin_users(:first)
|
|
20
|
-
get :analyze, :use_route => :kinney, :video => 'tolson-roots'
|
|
21
|
-
assert_response :success
|
|
22
|
-
end
|
|
23
|
-
|
|
24
18
|
end
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class AdminClipTest < ActionDispatch::IntegrationTest
|
|
4
|
-
|
|
4
|
+
extend TestWithCassette
|
|
5
|
+
|
|
5
6
|
setup do
|
|
6
7
|
browser_start
|
|
7
8
|
admin_login
|
|
@@ -11,7 +12,7 @@ class AdminClipTest < ActionDispatch::IntegrationTest
|
|
|
11
12
|
browser_end
|
|
12
13
|
end
|
|
13
14
|
|
|
14
|
-
test "admin user can create new clip" do
|
|
15
|
+
test "admin user can create new clip", :admin_clip do
|
|
15
16
|
visit('/admin/kinney_clips')
|
|
16
17
|
click_link('New Kinney Clip')
|
|
17
18
|
end
|
|
@@ -28,22 +29,24 @@ class AdminClipTest < ActionDispatch::IntegrationTest
|
|
|
28
29
|
# # assert_equal '44', page.find_field('clip_duration').value
|
|
29
30
|
# end
|
|
30
31
|
|
|
31
|
-
test "add a description for a clip" do
|
|
32
|
+
test "add a description for a clip", :admin_clip do
|
|
32
33
|
visit(new_admin_kinney_clip_path)
|
|
33
34
|
assert page.find_field('kinney_clip_description')
|
|
34
35
|
fill_in 'Description', :with => 'This is a description of a new clip.'
|
|
35
36
|
end
|
|
36
37
|
|
|
37
|
-
test "display whether there is a VTT file for a clip" do
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
assert page.has_content?('WEBVTT
|
|
38
|
+
test "display whether there is a VTT file for a clip", :admin_clip do
|
|
39
|
+
pending
|
|
40
|
+
# How to use something like VCR for ajax requests?
|
|
41
|
+
# visit(new_admin_kinney_clip_path)
|
|
42
|
+
# fill_in 'Filename', :with => 'atkins-campuslife_fire'
|
|
43
|
+
# page.execute_script("$('#kinney_clip_filename').trigger('focus')") # to make sure focus is triggered
|
|
44
|
+
# assert page.has_content?('WEBVTT Found')
|
|
45
|
+
# fill_in 'Filename', :with => 'some-garbage'
|
|
46
|
+
# assert page.has_content?('WEBVTT Not Found')
|
|
44
47
|
end
|
|
45
48
|
|
|
46
|
-
test "do not allow submission of clip if there is no webvtt file" do
|
|
49
|
+
test "do not allow submission of clip if there is no webvtt file", :admin_clip do
|
|
47
50
|
visit(new_admin_kinney_clip_path)
|
|
48
51
|
assert page.has_selector?("#kinney_clip_submit_action input[@disabled='disabled']")
|
|
49
52
|
fill_in 'Filename', :with => 'atkins-campuslife_fire'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class AdminImagesTest < ActionDispatch::IntegrationTest
|
|
4
|
-
|
|
4
|
+
extend TestWithCassette
|
|
5
|
+
|
|
5
6
|
setup do
|
|
6
7
|
browser_start
|
|
7
8
|
admin_login
|
|
@@ -11,38 +12,38 @@ class AdminImagesTest < ActionDispatch::IntegrationTest
|
|
|
11
12
|
browser_end
|
|
12
13
|
end
|
|
13
14
|
|
|
14
|
-
test "user should not be able to create slug" do
|
|
15
|
+
test "user should not be able to create slug", :admin_images do
|
|
15
16
|
visit(admin_kinney_images_path)
|
|
16
17
|
click_link('New Kinney Image')
|
|
17
18
|
fill_in 'Filename', :with => '000001'
|
|
18
19
|
check 'Top Pick?'
|
|
19
20
|
end
|
|
20
21
|
|
|
21
|
-
test "user should see image for valid image on show page" do
|
|
22
|
+
test "user should see image for valid image on show page", :admin_images do
|
|
22
23
|
visit admin_kinney_image_path(kinney_images(:tolson1))
|
|
23
24
|
assert page.has_selector?("div img")
|
|
24
25
|
assert page.find("div img")[:src].include?(kinney_images(:tolson1).filename)
|
|
25
26
|
end
|
|
26
27
|
|
|
27
|
-
test "user should see image for valid image on edit page" do
|
|
28
|
+
test "user should see image for valid image on edit page", :admin_images do
|
|
28
29
|
visit edit_admin_kinney_image_path(kinney_images(:tolson1))
|
|
29
30
|
assert page.find("#preview_image").has_selector?('img')
|
|
30
31
|
assert page.find("#preview_image img")[:src].include?(kinney_images(:tolson1).filename)
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
test "user should see image for valid image on new image page" do
|
|
34
|
+
test "user should see image for valid image on new image page", :admin_images do
|
|
34
35
|
visit new_admin_kinney_image_path
|
|
35
36
|
fill_in 'Filename', :with => '0000001'
|
|
36
37
|
assert page.find("#preview_image").has_selector?('img')
|
|
37
38
|
assert page.find("#preview_image img")[:src].include?('0000001')
|
|
38
39
|
end
|
|
39
40
|
|
|
40
|
-
test "user should see associated name for image on show view" do
|
|
41
|
+
test "user should see associated name for image on show view", :admin_images do
|
|
41
42
|
visit admin_kinney_image_path(kinney_images(:tolson1))
|
|
42
43
|
assert page.has_content?('Edward Norris Tolson')
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
test "user should see associated name for image on index view" do
|
|
46
|
+
test "user should see associated name for image on index view", :admin_images do
|
|
46
47
|
visit admin_kinney_images_path
|
|
47
48
|
assert page.has_content?('Edward Norris Tolson')
|
|
48
49
|
end
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
|
-
class ClipsIndexTest < ActionDispatch::IntegrationTest
|
|
4
|
-
|
|
3
|
+
class ClipsIndexTest < ActionDispatch::IntegrationTest
|
|
4
|
+
|
|
5
|
+
extend TestWithCassette
|
|
6
|
+
|
|
7
|
+
test "clip index page should list all of the people with videos and the titles of their videos", :clips_index do
|
|
5
8
|
visit(kinney.clips_path)
|
|
6
9
|
assert page.has_content?('Tolson')
|
|
7
10
|
assert page.has_content?('Growing Up in Edgecombe County')
|
|
@@ -10,23 +13,23 @@ class ClipsIndexTest < ActionDispatch::IntegrationTest
|
|
|
10
13
|
assert page.has_content?('Pullen Fire')
|
|
11
14
|
end
|
|
12
15
|
|
|
13
|
-
test "clip index page should list the name_suffix of a person" do
|
|
16
|
+
test "clip index page should list the name_suffix of a person", :clips_index do
|
|
14
17
|
visit(kinney.clips_path)
|
|
15
18
|
assert page.has_content?('John Leslie Atkins, III')
|
|
16
19
|
end
|
|
17
20
|
|
|
18
|
-
test "clip index page should list the graduating class of a person next to the name" do
|
|
21
|
+
test "clip index page should list the graduating class of a person next to the name", :clips_index do
|
|
19
22
|
visit(kinney.clips_path)
|
|
20
23
|
assert page.has_content?('John Leslie Atkins, III (1965)')
|
|
21
24
|
end
|
|
22
25
|
|
|
23
|
-
test "clicking on a video thumbnail should go to a video clip" do
|
|
26
|
+
test "clicking on a video thumbnail should go to a video clip", :clips_index do
|
|
24
27
|
visit(kinney.clips_path)
|
|
25
28
|
page.first('.thumbnail_video').click
|
|
26
29
|
assert page.has_selector?('body.kinney_clips video')
|
|
27
30
|
end
|
|
28
31
|
|
|
29
|
-
test "the first text link should be the same as the video thumbnail link" do
|
|
32
|
+
test "the first text link should be the same as the video thumbnail link", :clips_index do
|
|
30
33
|
visit(kinney.clips_path)
|
|
31
34
|
atkins_section = page.first('#clip_profiles li')
|
|
32
35
|
image_link = atkins_section.find('.thumbnail_video')[:href]
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class ClipsShowTest < ActionDispatch::IntegrationTest
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
extend TestWithCassette
|
|
6
|
+
|
|
7
|
+
test "should show basic information about a clip", :clips_show do
|
|
5
8
|
visit(kinney.clip_path(kinney_clips(:tolson_roots)))
|
|
6
9
|
assert page.has_selector?('h1', :text => 'Tolson')
|
|
7
10
|
assert page.has_selector?('h1', :text => 'Growing Up in Edgecombe County')
|
|
8
11
|
assert page.has_selector?('video')
|
|
9
12
|
end
|
|
10
13
|
|
|
11
|
-
test "should have link to other videos by the same person" do
|
|
14
|
+
test "should have link to other videos by the same person", :clips_show do
|
|
12
15
|
visit(kinney.clip_path(kinney_clips(:tolson_roots)))
|
|
13
16
|
assert page.has_selector?('#person_videos a', :text => 'Mentors')
|
|
14
17
|
end
|
|
15
18
|
|
|
16
|
-
test "should have link to profile" do
|
|
19
|
+
test "should have link to profile", :clips_show do
|
|
17
20
|
visit(kinney.clip_path(kinney_clips(:tolson_roots)))
|
|
18
21
|
assert page.has_selector?('#related_people a', :text => 'Edward Norris Tolson')
|
|
19
22
|
assert page.has_selector?('#related_people a img')
|
|
20
23
|
end
|
|
21
24
|
|
|
22
|
-
test "should show the transcript" do
|
|
25
|
+
test "should show the transcript", :clips_show do
|
|
23
26
|
visit(kinney.clip_path(kinney_clips(:atkins_fire)))
|
|
24
27
|
assert page.has_selector?('h2', :text => 'Transcript')
|
|
25
28
|
assert page.has_content?('It was a frightening time')
|
|
26
29
|
end
|
|
27
30
|
|
|
28
|
-
test "should expand/collapse the transcript" do
|
|
31
|
+
test "should expand/collapse the transcript", :clips_show do
|
|
29
32
|
browser_start
|
|
30
33
|
# stubs out saving the tracker to work around a sqlite database locking issue
|
|
31
34
|
Kinney::Tracker.any_instance.stubs(:save).returns(true)
|
|
@@ -41,17 +44,17 @@ class ClipsShowTest < ActionDispatch::IntegrationTest
|
|
|
41
44
|
browser_end
|
|
42
45
|
end
|
|
43
46
|
|
|
44
|
-
test "should show other clips related by topic" do
|
|
47
|
+
test "should show other clips related by topic", :clips_show do
|
|
45
48
|
visit(kinney.clip_path(kinney_clips(:tolson_roots)))
|
|
46
49
|
assert page.has_selector?('#topic_clips a', :text => 'Applying to NC State')
|
|
47
50
|
end
|
|
48
51
|
|
|
49
|
-
test "should not see Video Topics section on page" do
|
|
52
|
+
test "should not see Video Topics section on page", :clips_show do
|
|
50
53
|
visit(kinney.clip_path(kinney_clips(:tolson_roots)))
|
|
51
54
|
assert page.has_no_content?('Video Topics')
|
|
52
55
|
end
|
|
53
56
|
|
|
54
|
-
test "should not see More videos on topics with link under video" do
|
|
57
|
+
test "should not see More videos on topics with link under video", :clips_show do
|
|
55
58
|
visit(kinney.clip_path(kinney_clips(:tolson_roots)))
|
|
56
59
|
assert page.has_no_content?('More videos on Roots')
|
|
57
60
|
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class MicrodataTest < ActionDispatch::IntegrationTest
|
|
4
|
+
|
|
5
|
+
extend TestWithCassette
|
|
6
|
+
|
|
7
|
+
test "clip show view should have microdata", :microdata do
|
|
8
|
+
path = kinney.clip_path(kinney_clips(:tolson_roots))
|
|
9
|
+
visit(path)
|
|
10
|
+
items = Microdata::Document.new(page.body, path).extract_items
|
|
11
|
+
item = items[0]
|
|
12
|
+
assert_equal(['http://schema.org/VideoObject'], item.type)
|
|
13
|
+
assert_equal(['http://siskel.lib.ncsu.edu/SLI/tolson/tolson-roots/tolson-roots.mp4'], item.properties['contentUrl'])
|
|
14
|
+
assert_equal(["T44S"], item.properties['duration'])
|
|
15
|
+
assert_equal(["http://siskel.lib.ncsu.edu/SLI/tolson/tolson-roots/tolson-roots.png"], item.properties['thumbnailUrl'])
|
|
16
|
+
assert item.properties['uploadDate']
|
|
17
|
+
assert item.properties['image']
|
|
18
|
+
assert item.properties['image'].first.include?('scrc.lib.ncsu.edu')
|
|
19
|
+
assert_equal(["272"], item.properties['height'])
|
|
20
|
+
assert_equal(["480"], item.properties['width'])
|
|
21
|
+
assert_equal(["This is a description of the Roots clip. Interview on June 4, 2011. (0:44)"], item.properties['description'])
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
test "person show view should have microdata", :microdata do
|
|
25
|
+
path = kinney.person_path(kinney_people(:tolson))
|
|
26
|
+
visit(path)
|
|
27
|
+
items = Microdata::Document.new(page.body, path).extract_items
|
|
28
|
+
item = items[0]
|
|
29
|
+
assert_equal(['http://schema.org/Person'], item.type)
|
|
30
|
+
assert_equal(['Edward Norris Tolson'], item.properties['name'])
|
|
31
|
+
assert_equal(2, item.properties['description'].length)
|
|
32
|
+
assert item.properties['description'].include?("Norris Tolson grew up in Edgecombe County.")
|
|
33
|
+
assert_equal(3, item.properties['image'].length)
|
|
34
|
+
assert item.properties['image'].first.include?('scrc.lib.ncsu.edu')
|
|
35
|
+
assert item.properties['alumniOf']
|
|
36
|
+
assert_equal ['http://schema.org/EducationalOrganization'], item.properties['alumniOf'].first.type
|
|
37
|
+
assert_equal(['North Carolina State University'], item.properties['alumniOf'].first.properties['name'])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
@@ -2,30 +2,32 @@ require 'test_helper'
|
|
|
2
2
|
|
|
3
3
|
class NavigationTest < ActionDispatch::IntegrationTest
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
extend TestWithCassette
|
|
6
|
+
|
|
7
|
+
test "there should be a global nav", :navigation do
|
|
6
8
|
visit(kinney.root_path)
|
|
7
9
|
assert page.has_selector?('#global_nav')
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
test "there should be a Videos link in the global navigation" do
|
|
12
|
+
test "there should be a Videos link in the global navigation", :navigation do
|
|
11
13
|
visit(kinney.root_path)
|
|
12
14
|
assert page.has_selector?('a', :text => 'Videos')
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
test "topics navigation in navbar should only include topics with clips" do
|
|
17
|
+
test "topics navigation in navbar should only include topics with clips", :navigation do
|
|
16
18
|
visit(kinney.root_path)
|
|
17
19
|
assert page.has_selector?('#global_nav #topics_nav li a', :text => 'Mentors')
|
|
18
20
|
assert page.has_no_selector?('#global_nav #topics_nav li', :text => 'Academics')
|
|
19
21
|
end
|
|
20
22
|
|
|
21
|
-
test "topics navigation should highlight the current page in the dropdown menu if on a topic page" do
|
|
23
|
+
test "topics navigation should highlight the current page in the dropdown menu if on a topic page", :navigation do
|
|
22
24
|
visit(kinney.topic_path(kinney_topics(:mentors)))
|
|
23
25
|
assert page.has_selector?('#topics_nav li.active a', :text => 'Mentors')
|
|
24
26
|
assert page.has_selector?('#topics_nav li a', :text => 'Roots')
|
|
25
27
|
assert page.has_no_selector?('#topics_nav li.active a', :text => 'Roots')
|
|
26
28
|
end
|
|
27
29
|
|
|
28
|
-
test "there should be a link to People in the global navigation" do
|
|
30
|
+
test "there should be a link to People in the global navigation", :navigation do
|
|
29
31
|
visit(kinney.root_path)
|
|
30
32
|
assert page.has_selector?('#global_nav ul li a', :text => 'People')
|
|
31
33
|
page.find('#global_nav ul li a', :text => 'People').click
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class PeopleIndexTest < ActionDispatch::IntegrationTest
|
|
4
|
+
|
|
5
|
+
extend TestWithCassette
|
|
6
|
+
|
|
4
7
|
setup do
|
|
5
8
|
|
|
6
9
|
end
|
|
7
10
|
|
|
8
|
-
test 'shows people' do
|
|
11
|
+
test 'shows people', :people_index do
|
|
9
12
|
visit(kinney.people_path)
|
|
10
13
|
assert page.has_content?('People')
|
|
11
14
|
assert page.has_content?('Tolson')
|
|
@@ -13,19 +16,19 @@ class PeopleIndexTest < ActionDispatch::IntegrationTest
|
|
|
13
16
|
assert page.has_content?('Atkins, III')
|
|
14
17
|
end
|
|
15
18
|
|
|
16
|
-
test 'links to show view for person with video' do
|
|
19
|
+
test 'links to show view for person with video', :people_index do
|
|
17
20
|
visit(kinney.people_path)
|
|
18
21
|
click_link('Edward Norris Tolson')
|
|
19
22
|
assert current_path == kinney.person_path(kinney_people(:tolson))
|
|
20
23
|
end
|
|
21
24
|
|
|
22
|
-
test 'links to show view for person without video' do
|
|
25
|
+
test 'links to show view for person without video', :people_index do
|
|
23
26
|
visit(kinney.people_path)
|
|
24
27
|
page.find('#people_no_clips').click_link('William Williams')
|
|
25
28
|
assert current_path == kinney.person_path(kinney_people(:williams))
|
|
26
29
|
end
|
|
27
30
|
|
|
28
|
-
test 'sort profile images' do
|
|
31
|
+
test 'sort profile images', :people_index do
|
|
29
32
|
browser_start
|
|
30
33
|
visit(kinney.people_path)
|
|
31
34
|
assert page.find('.thumbnails li:first').has_content?('Atkins')
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
3
|
class PeopleShowTest < ActionDispatch::IntegrationTest
|
|
4
|
+
extend TestWithCassette
|
|
5
|
+
|
|
4
6
|
setup do
|
|
5
7
|
#Capybara.current_driver = Capybara.javascript_driver # :selenium by default
|
|
6
8
|
end
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
test_with_cassette 'shows person content', :people_show do
|
|
9
11
|
visit(kinney.person_path(kinney_people(:tolson)))
|
|
10
12
|
assert page.has_content?('Edward Norris Tolson')
|
|
11
13
|
|
|
@@ -32,7 +34,7 @@ class PeopleShowTest < ActionDispatch::IntegrationTest
|
|
|
32
34
|
assert page.has_content?("This is a citation.")
|
|
33
35
|
end
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
test_with_cassette 'does not show headings for content fields when content is not present', :people_show do
|
|
36
38
|
visit(kinney.person_path(kinney_people(:williams)))
|
|
37
39
|
assert page.has_content?('William Williams')
|
|
38
40
|
assert page.has_no_selector?('h2', :text => 'Years at State')
|
|
@@ -43,61 +45,61 @@ class PeopleShowTest < ActionDispatch::IntegrationTest
|
|
|
43
45
|
assert page.has_no_selector?('h2', :text => 'Citations')
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
test_with_cassette 'if there is only one image and it is a top pick then do not show the image section of the page', :people_show do
|
|
47
49
|
visit(kinney.person_path(kinney_people(:atkins)))
|
|
48
50
|
assert page.has_no_selector?('h2', :text => 'Images of Jonh Leslie Atkins')
|
|
49
51
|
end
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
test_with_cassette 'should give a link to other videos with the same person', :people_show do
|
|
52
54
|
visit(kinney.person_path(kinney_people(:tolson)))
|
|
53
55
|
assert page.has_selector?('#person_videos a', :text => 'Growing Up in Edgecombe County')
|
|
54
56
|
page.find('#person_videos a', :text => 'Mentors').click
|
|
55
57
|
assert page.has_selector?('h1', :text => 'Mentors')
|
|
56
58
|
end
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
test_with_cassette "should show a top pick image near the biography", :people_show do
|
|
59
61
|
visit(kinney.person_path(kinney_people(:tolson)))
|
|
60
62
|
assert page.find('#image_top_pick img')[:src].include?('si-ag1962-p408-tolson')
|
|
61
63
|
end
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
test_with_cassette "should not see the top pick image with the other images", :people_show do
|
|
64
66
|
visit(kinney.person_path(kinney_people(:tolson)))
|
|
65
67
|
page.all('#other_images img').each do |image|
|
|
66
68
|
assert_false image[:src].include?('si-ag1962-p408-tolson')
|
|
67
69
|
end
|
|
68
70
|
end
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
test_with_cassette "should show name_suffix if present", :people_show do
|
|
71
73
|
visit(kinney.person_path(kinney_people(:atkins)))
|
|
72
74
|
assert page.has_selector?('h1', :text => 'John Leslie Atkins, III')
|
|
73
75
|
end
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
test_with_cassette "should provide a link to a video as an image and make it a top pick", :people_show do
|
|
76
78
|
visit(kinney.person_path(kinney_people(:tolson)))
|
|
77
79
|
image_link = page.find('.thumbnail_video:first')[:href]
|
|
78
80
|
assert_equal kinney.clip_path(kinney_clips(:tolson_roots)), image_link
|
|
79
81
|
end
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
test_with_cassette "should provide a link to other videos as text links", :people_show do
|
|
82
84
|
visit(kinney.person_path(kinney_people(:tolson)))
|
|
83
85
|
assert page.has_selector?('#person_videos a', :text => 'Growing Up in Edgecombe County')
|
|
84
86
|
assert page.has_selector?('#person_videos a', :text => '0:44')
|
|
85
87
|
assert page.has_selector?('#person_videos a', :text => 'Mentors')
|
|
86
88
|
end
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
test_with_cassette "should display the information like description, interview date and time below video clip", :people_show do
|
|
89
91
|
visit(kinney.clip_path(kinney_clips(:tolson_roots)))
|
|
90
92
|
assert page.has_content?('This is a description of the Roots clip. Interview on June 4, 2011. (0:44)')
|
|
91
93
|
end
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
test_with_cassette "should display a map if the location the person grew up is known", :people_show do
|
|
94
96
|
visit(kinney.person_path(kinney_people(:tolson)))
|
|
95
97
|
assert page.has_selector?('#static_map')
|
|
96
98
|
assert page.has_content?('Grew up in')
|
|
97
99
|
assert page.has_content?('Edgecombe County, NC')
|
|
98
100
|
end
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
test_with_cassette "should not display a map if the location the person grew up is not known", :people_show do
|
|
101
103
|
visit(kinney.person_path(kinney_people(:atkins)))
|
|
102
104
|
assert page.has_no_content?('Grew up in')
|
|
103
105
|
assert page.has_no_selector?('#static_map')
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Copied from jrochkind's bento search.
|
|
2
|
+
# TODO: Investigate a DRYer way to copy from jrochkind's bento search.
|
|
3
|
+
module TestWithCassette
|
|
4
|
+
def test_with_cassette(name, group = nil, vcr_options ={}, &block)
|
|
5
|
+
# cribbed from Rails and modified for VCR
|
|
6
|
+
# https://github.com/rails/rails/blob/b451de0d6de4df6bc66b274cec73b919f823d5ae/activesupport/lib/active_support/testing/declarative.rb#L25
|
|
7
|
+
|
|
8
|
+
test_name_safe = name.gsub(/\s+/,'_')
|
|
9
|
+
|
|
10
|
+
test_method_name = "test_#{test_name_safe}".to_sym
|
|
11
|
+
|
|
12
|
+
raise "#{test_method_name} is already defined in #{self}" if methods.include?(test_method_name)
|
|
13
|
+
|
|
14
|
+
cassette_name = vcr_options.delete(:cassette)
|
|
15
|
+
unless cassette_name
|
|
16
|
+
# calculate default cassette name from test name
|
|
17
|
+
cassette_name = test_name_safe
|
|
18
|
+
# put in group subdir if group
|
|
19
|
+
cassette_name = "#{group}/#{cassette_name}" if group
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# default tag with groupname, can be over-ridden.
|
|
23
|
+
vcr_options = {:tag => group}.merge(vcr_options) if group
|
|
24
|
+
# vcr_options.merge!(:serialize_with => :json)
|
|
25
|
+
if block_given?
|
|
26
|
+
define_method(test_method_name) do
|
|
27
|
+
VCR.use_cassette(cassette_name , vcr_options) do
|
|
28
|
+
instance_eval &block
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
define_method(test_method_name) do
|
|
33
|
+
flunk "No implementation provided for #{name}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
alias_method :test, :test_with_cassette
|
|
38
|
+
end
|
data/test/test_helper.rb
CHANGED
|
@@ -5,9 +5,22 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
|
5
5
|
require "rails/test_help"
|
|
6
6
|
require 'capybara/rails'
|
|
7
7
|
#require 'capybara/webkit'
|
|
8
|
-
require 'mocha'
|
|
8
|
+
require 'mocha/setup'
|
|
9
9
|
require 'selenium-webdriver'
|
|
10
10
|
require 'pry'
|
|
11
|
+
require 'microdata'
|
|
12
|
+
|
|
13
|
+
require 'vcr'
|
|
14
|
+
VCR.configure do |c|
|
|
15
|
+
c.hook_into :webmock
|
|
16
|
+
c.cassette_library_dir = 'test/vcr_cassettes'
|
|
17
|
+
c.ignore_request do |request|
|
|
18
|
+
URI(request.uri).path.include?('__identify__') or
|
|
19
|
+
URI(request.uri).path.include?('hub/session')
|
|
20
|
+
end
|
|
21
|
+
c.allow_http_connections_when_no_cassette = true
|
|
22
|
+
c.ignore_localhost = false
|
|
23
|
+
end
|
|
11
24
|
|
|
12
25
|
|
|
13
26
|
Rails.backtrace_cleaner.remove_silencers!
|
|
@@ -63,7 +76,10 @@ DatabaseCleaner.strategy = :truncation
|
|
|
63
76
|
class ActionDispatch::IntegrationTest
|
|
64
77
|
# Make the Capybara DSL available in all integration tests
|
|
65
78
|
include Capybara::DSL
|
|
66
|
-
|
|
79
|
+
|
|
80
|
+
if File.exist? "/opt/firefox17/firefox"
|
|
81
|
+
Selenium::WebDriver::Firefox.path= "/opt/firefox17/firefox"
|
|
82
|
+
end
|
|
67
83
|
# Stop ActiveRecord from wrapping tests in transactions
|
|
68
84
|
#self.use_transactional_fixtures = false
|
|
69
85
|
|
data/test/unit/clip_test.rb
CHANGED
|
@@ -56,6 +56,11 @@ class ClipTest < ActiveSupport::TestCase
|
|
|
56
56
|
clip.reload
|
|
57
57
|
assert_equal "Third Man, Edward Norris Tolson, and William Williams", clip.full_people_names
|
|
58
58
|
end
|
|
59
|
+
|
|
60
|
+
test "clip should return title with full people names" do
|
|
61
|
+
clip = kinney_clips(:tolson_roots)
|
|
62
|
+
assert_equal "Growing Up in Edgecombe County with Edward Norris Tolson", clip.title_with_full_people_names
|
|
63
|
+
end
|
|
59
64
|
|
|
60
65
|
test "clip should return the full URL for the poster image" do
|
|
61
66
|
assert_equal "http://siskel.lib.ncsu.edu/SLI/tolson/tolson-roots/tolson-roots.png",
|