@@ -28,6 +28,14 @@ def dropdown_list_items(list)
28
28
end
29
29
end
30
30
31
+ # given a dropdown list, return the list items as an array of URL strings
32
+ def dropdown_list_items_urls ( list )
33
+ css_select ( list , "a" ) . map do |item |
34
+ item . attributes [ 'href' ] . try ( :value ) || ""
35
+ end
36
+ end
37
+
38
+
31
39
test "should create Jobs dropdown" do
32
40
get :index
33
41
@@ -37,10 +45,10 @@ def dropdown_list_items(list)
37
45
end
38
46
39
47
test "should create Files dropdown" do
40
- scratch_path = "test/fixtures/dummy_fs/scratch"
41
- project_path = "test/fixtures/dummy_fs/project"
42
- project_path2 = Pathname . new ( "test/fixtures/dummy_fs/project2" )
43
- missing_path = "test/fixtures/dummy_fs/missing"
48
+ scratch_path = File . expand_path "test/fixtures/dummy_fs/scratch"
49
+ project_path = File . expand_path "test/fixtures/dummy_fs/project"
50
+ project_path2 = Pathname . new ( "test/fixtures/dummy_fs/project2" ) . expand_path
51
+ missing_path = "/ test/fixtures/dummy_fs/missing"
44
52
OodFilesApp . stubs ( :candidate_favorite_paths ) . returns ( [ FavoritePath . new ( scratch_path , title : "Scratch" ) , project_path , project_path2 , missing_path ] )
45
53
46
54
get :index
@@ -52,7 +60,15 @@ def dropdown_list_items(list)
52
60
"Scratch #{ scratch_path } " ,
53
61
project_path ,
54
62
project_path2 . to_s
55
- ] , dditems . map { |e | e . gsub ( /\s +/ , ' ' ) }
63
+ ] , dditems . map { |e | e . gsub ( /\s +/ , ' ' ) } , "Files dropdown item text is incorrect"
64
+
65
+ dditemurls = dropdown_list_items_urls ( dropdown_list ( 'Files' ) )
66
+ assert_equal [
67
+ "/pun/sys/files/fs" + Dir . home ,
68
+ "/pun/sys/files/fs" + scratch_path ,
69
+ "/pun/sys/files/fs" + project_path ,
70
+ "/pun/sys/files/fs" + project_path2 . to_s
71
+ ] , dditemurls , "Files dropdown URLs are incorrect"
56
72
end
57
73
58
74
test "should create Clusters dropdown with valid clusters that are alphabetically ordered by title" do
0 commit comments