|
19 | 19 | require File.expand_path(File.dirname(__FILE__) + '/api_spec_helper') |
20 | 20 |
|
21 | 21 | describe UserContent, type: :request do |
22 | | - it "should translate course file download links to directly-downloadable urls" do |
23 | | - course_with_teacher_logged_in(:active_all => true) |
| 22 | + before :once do |
| 23 | + course_with_teacher(:active_all => true) |
24 | 24 | attachment_model |
| 25 | + end |
| 26 | + |
| 27 | + it "should translate course file download links to directly-downloadable urls" do |
25 | 28 | @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) |
26 | 29 | <p> |
27 | 30 | Hello, students.<br> |
|
39 | 42 | end |
40 | 43 |
|
41 | 44 | it "should translate group file download links to directly-downloadable urls" do |
42 | | - course_with_teacher_logged_in(:active_all => true) |
43 | 45 | @group = @course.groups.create!(:name => "course group") |
44 | 46 | attachment_model(:context => @group) |
45 | 47 | @group.add_user(@teacher) |
|
60 | 62 | end |
61 | 63 |
|
62 | 64 | it "should translate file download links to directly-downloadable urls for deleted and replaced files" do |
63 | | - course_with_teacher_logged_in(:active_all => true) |
64 | | - attachment_model |
65 | 65 | @attachment.destroy |
66 | 66 | attachment2 = Attachment.create!(:folder => @attachment.folder, :context => @attachment.context, :filename => @attachment.filename, :uploaded_data => StringIO.new("first")) |
67 | 67 | @context.attachments.find(@attachment.id).id.should == attachment2.id |
|
83 | 83 | end |
84 | 84 |
|
85 | 85 | it "should not corrupt absolute links" do |
86 | | - course_with_teacher_logged_in |
87 | 86 | attachment_model(:context => @course) |
88 | 87 | @topic = @course.discussion_topics.create!(:title => "course topic", :user => @teacher, :message => <<-HTML) |
89 | 88 | <p> |
|
100 | 99 | end |
101 | 100 |
|
102 | 101 | it "should translate file preview links to directly-downloadable preview urls" do |
103 | | - course_with_teacher_logged_in(:active_all => true) |
104 | | - attachment_model |
105 | 102 | @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) |
106 | 103 | <p> |
107 | 104 | Hello, students.<br> |
|
119 | 116 | end |
120 | 117 |
|
121 | 118 | it "should translate media comment links to embedded video tags" do |
122 | | - course_with_teacher_logged_in(:active_all => true) |
123 | | - attachment_model |
124 | 119 | @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) |
125 | 120 | <p> |
126 | 121 | Hello, students.<br> |
|
149 | 144 | end |
150 | 145 |
|
151 | 146 | it "should translate media comment audio tags" do |
152 | | - course_with_teacher_logged_in(:active_all => true) |
153 | | - attachment_model |
154 | 147 | @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) |
155 | 148 | <p> |
156 | 149 | Hello, students.<br> |
|
175 | 168 | end |
176 | 169 |
|
177 | 170 | it "should not translate links in content not viewable by user" do |
178 | | - course_with_teacher_logged_in(:active_all => true) |
179 | | - attachment_model |
180 | 171 | @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) |
181 | 172 | <p> |
182 | 173 | Hello, students.<br> |
|
201 | 192 | end |
202 | 193 |
|
203 | 194 | it "should prepend the hostname to all absolute-path links" do |
204 | | - course_with_teacher_logged_in(:active_all => true) |
205 | 195 | @assignment = @course.assignments.create!(:title => "first assignment", :description => <<-HTML) |
206 | 196 | <p> |
207 | 197 | Hello, students.<br> |
|
229 | 219 | end |
230 | 220 |
|
231 | 221 | it "should not choke on funny email addresses" do |
232 | | - course_with_teacher_logged_in(:active_all => true) |
233 | 222 | @wiki_page = @course.wiki.front_page |
234 | 223 | @wiki_page.body = "<a href='mailto:djmankiewicz@homestarrunner,com'>e-nail</a>" |
235 | 224 | @wiki_page.workflow_state = 'active' |
|
242 | 231 | context "data api endpoints" do |
243 | 232 | context "course context" do |
244 | 233 | it "should process links to each type of object" do |
245 | | - course_with_teacher_logged_in(:active_all => true) |
246 | 234 | @wiki_page = @course.wiki.front_page |
247 | 235 | @wiki_page.body = <<-HTML |
248 | 236 | <p> |
|
322 | 310 |
|
323 | 311 | context "user context" do |
324 | 312 | it "should process links to each type of object" do |
325 | | - course_with_teacher_logged_in(:active_all => true) |
326 | 313 | @topic = @course.discussion_topics.create!(:message => <<-HTML) |
327 | 314 | <a href='/users/#{@teacher.id}/files'>file index</a> |
328 | 315 | <a href='/users/#{@teacher.id}/files/789/preview'>file</a> |
@@ -409,7 +396,6 @@ class Tester |
409 | 396 |
|
410 | 397 | describe ".api_bulk_load_user_content_attachments" do |
411 | 398 | it "returns a hash of assignment_id => assignment" do |
412 | | - course_with_teacher_logged_in(:active_all => true) |
413 | 399 | a1, a2, a3 = attachment_model, attachment_model, attachment_model |
414 | 400 | html1, html2 = <<-HTML1, <<-HTML2 |
415 | 401 | <a href="/courses/#{@course.id}/files/#{a1.id}/download">uh...</a> |
|
0 commit comments