Remove rce_enhancements flag from canvas - Phase 2
refs LS-2655 flag=none - this updates files under ./app test plan: - jenkins passes and canvas still works - spot check editing assignments, calendar_events, discussions legacy quizzes, wiki pages, and eportfolios Change-Id: I36cddffa5fd4453c63666ab9368c77a71eee90af Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275490 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Weston Dransfield <wdransfield@instructure.com> QA-Review: Weston Dransfield <wdransfield@instructure.com> Product-Review: Ed Schiebel <eschiebel@instructure.com>
This commit is contained in:
parent
9a28221bee
commit
cbaf3172b1
|
@ -163,7 +163,6 @@ class ApplicationController < ActionController::Base
|
|||
DOMAIN_ROOT_ACCOUNT_ID: @domain_root_account&.global_id,
|
||||
k12: k12?,
|
||||
use_responsive_layout: use_responsive_layout?,
|
||||
use_rce_enhancements: (@context.blank? || @context.is_a?(User) ? @domain_root_account : @context).try(:feature_enabled?, :rce_enhancements),
|
||||
rce_auto_save: @context.try(:feature_enabled?, :rce_auto_save),
|
||||
use_rce_a11y_checker_notifications: @context.try(:feature_enabled?, :rce_a11y_checker_notifications),
|
||||
help_link_name: help_link_name,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -321,17 +321,15 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @account.feature_allowed?(:rce_enhancements) %>
|
||||
<%= settings.fields_for :disable_rce_media_uploads do |r| %>
|
||||
<% hash = @account.disable_rce_media_uploads %>
|
||||
<% disabled = hash[:locked] && hash[:inherited] %>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<%= r.check_box :value, checked: hash[:value], disabled: disabled %>
|
||||
<%= r.label :value, t("Disable uploads to Canvas Media from the enhanced rich content editor") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<%= settings.fields_for :disable_rce_media_uploads do |r| %>
|
||||
<% hash = @account.disable_rce_media_uploads %>
|
||||
<% disabled = hash[:locked] && hash[:inherited] %>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<%= r.check_box :value, checked: hash[:value], disabled: disabled %>
|
||||
<%= r.label :value, t("Disable uploads to Canvas Media from the enhanced rich content editor") %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% if Account.site_admin.feature_enabled?(:gradebook_show_first_last_names) %>
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
<%= form_tag(context_url(@context, :controller => :submissions, :assignment_id => @assignment.id, :action => :create), {:id => "submit_online_text_entry_form", :class => "submit_assignment_form"}) do %>
|
||||
<%= hidden_field :submission, :submission_type, :value => "online_text_entry" %>
|
||||
<%= hidden_field :submission, :eula_agreement_timestamp, :id => "eula_agreement_timestamp" %>
|
||||
<!-- fixed layout works because I know there is only 1 column (look at turnitin and vericite too)
|
||||
<!-- fixed layout works because I know there is only 1 column (look at turnitin and vericite too)
|
||||
it is necessary to keep the RCE from overflowing its container in mobile -->
|
||||
|
||||
<table class="formtable" style="width: 100%; table-layout: fixed;">
|
||||
<table class="formtable" style="width: 100%; table-layout: fixed;">
|
||||
<tr>
|
||||
<td>
|
||||
<%= t 'instructions.online_text_entry', "Copy and paste or type your submission right here." %>
|
||||
|
@ -30,12 +30,6 @@
|
|||
</td>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<% unless @context.feature_enabled?(:rce_enhancements) %>
|
||||
<div style="text-align: <%= direction('right') %>; font-size: 0.8em;">
|
||||
<a class="switch_text_entry_submission_views" href="#"><%= t '#editor.switch_editor_html', "HTML Editor" %></a>
|
||||
<a class="switch_text_entry_submission_views" href="#" style="display:none"><%= t '#editor.switch_editor_rich_text', "Rich Content Editor" %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= text_area :submission, :body, :style => "width: 100%; height: 250px;" %>
|
||||
</td>
|
||||
</tr><tr>
|
||||
|
|
|
@ -63,12 +63,6 @@ To add some comments, click the "Edit" link at the top.
|
|||
<%= help_text %>
|
||||
</div>
|
||||
<%= form_for @context.class.to_s.underscore.to_sym, :url => context_url(@context, :context_url), :html => {:id => 'edit_course_syllabus_form', :style => 'display: none; margin-bottom: 10px;', :method => :put} do |f| %>
|
||||
<% unless @context.feature_enabled?(:rce_enhancements) %>
|
||||
<div style="float: <%= direction('right') %>;">
|
||||
<a href="#" class="toggle_views_link toggle_html_editor_link"><%= t '#editor.switch_editor_html', "HTML Editor" %></a>
|
||||
<a href="#" class="toggle_views_link toggle_rich_editor_link" style="display:none;"><%= t '#editor.switch_editor_rich_text', "Rich Content Editor" %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @context.elementary_enabled? %>
|
||||
<%= f.blabel :syllabus_body, :important_info_description, :en => "Important Info Description" %>
|
||||
<% else %>
|
||||
|
|
|
@ -35,4 +35,3 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render partial: 'shared/wiki_sidebar' %>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<% else %>
|
||||
<% provide :page_title, t("Edit Assignment") %>
|
||||
<% end %>
|
||||
<% provide :right_side, render(:partial => 'shared/wiki_sidebar') %>
|
||||
|
||||
<%
|
||||
js_env :assignment_attempts_enabled => !@assignment.quiz_lti?
|
||||
|
|
|
@ -32,5 +32,4 @@
|
|||
js_env CALENDAR: {}
|
||||
js_bundle :edit_calendar_event
|
||||
css_bundle :tinymce, :edit_calendar_event_full
|
||||
provide :right_side, render(:partial => 'shared/wiki_sidebar')
|
||||
%>
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
css_bundle :tinymce, :grading_standards, :assignments_edit, :discussions_edit, :conditional_release_editor
|
||||
%>
|
||||
|
||||
<% provide :right_side, render(:partial => 'shared/wiki_sidebar') %>
|
||||
|
||||
<% if @context.is_a?(Course) %>
|
||||
<div id="edit_letter_grades_form" style="display: none;">
|
||||
<%= render partial: "shared/grading_standard", object: @topic.grading_standard_or_default, locals: {read_only: false} %>
|
||||
|
|
|
@ -22,14 +22,13 @@
|
|||
@no_reply = @topic.homeroom_announcement?(@context)
|
||||
%>
|
||||
|
||||
<% if (@headers || !@locked) && ((show_crs_graphs = can_do(@context, @current_user, :view_all_grades) && ConditionalRelease::Service.triggers_mastery_paths?(@topic.assignment, @current_user, session)) || !@context.try(:feature_enabled?, :rce_enhancements)) %>
|
||||
<% if (@headers || !@locked) && (show_crs_graphs = can_do(@context, @current_user, :view_all_grades) && ConditionalRelease::Service.triggers_mastery_paths?(@topic.assignment, @current_user, session)) %>
|
||||
<% provide :right_side do %>
|
||||
<div id="sidebar_content" class="rs-margin-bottom">
|
||||
<% if show_crs_graphs %>
|
||||
<div id="crs-graphs"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => "shared/wiki_sidebar" %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% provide_blank :right_side %>
|
||||
|
|
|
@ -64,9 +64,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: none">
|
||||
<%= render :partial => "shared/wiki_sidebar" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -125,13 +125,6 @@
|
|||
<%= t('explanations.multi_answer_sets', "In the box below, every place you want to show an answer box, type a reference word (no spaces) surrounded by brackets") %><br/>
|
||||
(<%= t(:multi_answer_sets_example, 'i.e. "Roses are [color1], violets are [color2]"') %>)
|
||||
</div>
|
||||
<% unless @context.feature_enabled?(:rce_enhancements) %>
|
||||
<div style="float: <%= direction('right') %>; margin-<%= direction('right') %>: 10%; font-size: 0.8em;">
|
||||
<a href="#" class="toggle_question_content_views_link"><%= t '#editor.switch_editor_html', "HTML Editor" %></a>
|
||||
<a href="#" class="toggle_question_content_views_link" style="display:none;"><%= t '#editor.switch_editor_rich_text', "Rich Content Editor" %></a>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<% end %>
|
||||
<div style="text-align: center;">
|
||||
<textarea style="width: 90%; height: 120px;" class="question_content" name="question_text"></textarea>
|
||||
</div>
|
||||
|
|
|
@ -42,12 +42,6 @@ content_is_locked = !!js_env.dig(:MASTER_COURSE_DATA, "is_master_course_child_co
|
|||
<input type="hidden" name="description" value="<%=@quiz.description%>"/>
|
||||
<% else %>
|
||||
<%= before_label(:quiz_instructions, "Quiz Instructions") %>
|
||||
<% unless @context.feature_enabled?(:rce_enhancements) %>
|
||||
<div class="pull-right" style="font-size: 0.8em; cursor: pointer;">
|
||||
<a href="#" class="toggle_description_views_link"><%= t "HTML Editor" %></a>
|
||||
<a href="#" class="toggle_description_views_link" style="display:none;"><%= t "Rich Content Editor" %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<textarea id="quiz_description" style="display: none;width: 100%;margin: 0px auto;height: 125px"><%= @quiz.description %></textarea>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -41,13 +41,6 @@
|
|||
aria-label="<%= label_for_question_type(question_type) %>"
|
||||
/>
|
||||
<% elsif question_type.entry_type == "textarea" %>
|
||||
<% unless @context.feature_enabled?(:rce_enhancements) %>
|
||||
<div class="rce_links">
|
||||
<a href="#" class="toggle_question_content_views_link"><%= t "HTML Editor" %></a>
|
||||
<a href="#" class="toggle_question_content_views_link" style="display:none;"><%= t "Rich Content Editor" %></a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<% end %>
|
||||
<textarea name="question_<%= hash_get(question, :id) %>" class="question_input" autocomplete='off' <%= 'readonly="readonly"' unless editable %>><%= value %></textarea>
|
||||
<% elsif question_type.entry_type == "file" %>
|
||||
<% if !editable%>
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
<% if editing_restricted?(@quiz, :content) %>
|
||||
<% provide_blank :right_side %>
|
||||
<% else %>
|
||||
<% provide :right_side, render(:partial => 'shared/wiki_sidebar') %>
|
||||
<% end %>
|
||||
|
||||
<h1 class="screenreader-only"><%= @quiz.quiz_title %></h1>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<%
|
||||
# Copyright (C) 2011 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
unless @context.try(:feature_enabled?, :rce_enhancements) %>
|
||||
<div id="editor_tabs" style="display: none;">
|
||||
<!-- this is just here so canvas-rce knows where to render the sidebar into -->
|
||||
</div>
|
||||
<% end %>
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
<%
|
||||
provide :page_title, join_title(@page.title.to_s, @context.name)
|
||||
provide :right_side, render(:partial => "shared/wiki_sidebar")
|
||||
css_bundle :tinymce
|
||||
js_bundle :wiki_page_edit
|
||||
%>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
<%
|
||||
provide :page_title, join_title(@context.name, t('titles.pages', 'Pages'))
|
||||
provide :right_side, render(:partial => "shared/wiki_sidebar")
|
||||
css_bundle :wiki_page, :tinymce
|
||||
js_bundle :wiki_page_index
|
||||
%>
|
||||
|
|
|
@ -23,14 +23,19 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|||
describe CalendarEventsController do
|
||||
def stub_conference_plugins
|
||||
allow(WebConference).to receive(:plugins).and_return(
|
||||
[web_conference_plugin_mock("big_blue_button", { :domain => "bbb.instructure.com", :secret_dec => "secret" })]
|
||||
[
|
||||
web_conference_plugin_mock(
|
||||
'big_blue_button',
|
||||
{ domain: 'bbb.instructure.com', secret_dec: 'secret' }
|
||||
)
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
let_once(:teacher_enrollment) { course_with_teacher(active_all: true) }
|
||||
let_once(:course) { teacher_enrollment.course }
|
||||
let_once(:student_enrollment) { student_in_course(course: course) }
|
||||
let_once(:course_event) { course.calendar_events.create(:title => "some assignment") }
|
||||
let_once(:course_event) { course.calendar_events.create(title: 'some assignment') }
|
||||
let_once(:other_teacher_enrollment) { course_with_teacher(active_all: true) }
|
||||
|
||||
before do
|
||||
|
@ -43,17 +48,22 @@ describe CalendarEventsController do
|
|||
let(:conference_params) do
|
||||
{ conference_type: 'BigBlueButton', title: 'a conference', user: teacher_enrollment.user }
|
||||
end
|
||||
let(:other_teacher_conference) { other_teacher_enrollment.course.web_conferences.create!(**conference_params, user: other_teacher_enrollment.user) }
|
||||
let(:other_teacher_conference) do
|
||||
other_teacher_enrollment.course.web_conferences.create!(
|
||||
**conference_params,
|
||||
user: other_teacher_enrollment.user
|
||||
)
|
||||
end
|
||||
|
||||
shared_examples "accepts web_conference" do
|
||||
it "accepts a new conference" do
|
||||
shared_examples 'accepts web_conference' do
|
||||
it 'accepts a new conference' do
|
||||
user_session(@teacher)
|
||||
make_request.call(conference_params)
|
||||
expect(response.status).to be < 400
|
||||
expect(get_event.call.web_conference).not_to be nil
|
||||
end
|
||||
|
||||
it "accepts an existing conference" do
|
||||
it 'accepts an existing conference' do
|
||||
user_session(@teacher)
|
||||
conference = @course.web_conferences.create!(conference_params)
|
||||
make_request.call(id: conference.id, **conference_params)
|
||||
|
@ -69,30 +79,32 @@ describe CalendarEventsController do
|
|||
end
|
||||
|
||||
describe "GET 'show'" do
|
||||
it "requires authorization" do
|
||||
get 'show', params: { :course_id => @course.id, :id => @event.id }
|
||||
it 'requires authorization' do
|
||||
get 'show', params: { course_id: @course.id, id: @event.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "assigns variables" do
|
||||
it 'assigns variables' do
|
||||
user_session(@student)
|
||||
get 'show', params: { :course_id => @course.id, :id => @event.id }, :format => :json
|
||||
get 'show', params: { course_id: @course.id, id: @event.id }, format: :json
|
||||
|
||||
# response.should be_successful
|
||||
expect(assigns[:event]).not_to be_nil
|
||||
expect(assigns[:event]).to eql(@event)
|
||||
end
|
||||
|
||||
it "renders show page" do
|
||||
it 'renders show page' do
|
||||
user_session(@student)
|
||||
get 'show', params: { :course_id => @course.id, :id => @event.id }
|
||||
get 'show', params: { course_id: @course.id, id: @event.id }
|
||||
expect(assigns[:event]).not_to be_nil
|
||||
|
||||
# make sure that the show.html.erb template is rendered
|
||||
expect(response).to render_template('calendar_events/show')
|
||||
end
|
||||
|
||||
it "redirects for course section events" do
|
||||
it 'redirects for course section events' do
|
||||
section = @course.default_section
|
||||
section_event = section.calendar_events.create!(title: "Sub event")
|
||||
section_event = section.calendar_events.create!(title: 'Sub event')
|
||||
user_session(@student)
|
||||
get 'show', params: { course_section_id: section.id, id: section_event.id }
|
||||
expect(response).to be_redirect
|
||||
|
@ -100,33 +112,26 @@ describe CalendarEventsController do
|
|||
end
|
||||
|
||||
describe "GET 'new'" do
|
||||
it "requires authorization" do
|
||||
get 'new', params: { :course_id => @course.id }
|
||||
it 'requires authorization' do
|
||||
get 'new', params: { course_id: @course.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "does not allow students to create" do
|
||||
it 'does not allow students to create' do
|
||||
user_session(@student)
|
||||
get 'new', params: { :course_id => @course.id }
|
||||
get 'new', params: { course_id: @course.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "doesn't create an event" do
|
||||
initial_count = @course.calendar_events.count
|
||||
user_session(@teacher)
|
||||
get 'new', params: { :course_id => @course.id }
|
||||
get 'new', params: { course_id: @course.id }
|
||||
expect(@course.reload.calendar_events.count).to eq initial_count
|
||||
end
|
||||
|
||||
it "allows usingrce enhancements on a user's calendar if the account allows them to" do
|
||||
Account.default.enable_feature!(:rce_enhancements)
|
||||
user_session(@teacher)
|
||||
get 'new', params: { user_id: @teacher.id }
|
||||
expect(@controller.js_env[:use_rce_enhancements]).to be(true)
|
||||
end
|
||||
|
||||
context "with web conferences" do
|
||||
it "includes conference environment" do
|
||||
context 'with web conferences' do
|
||||
it 'includes conference environment' do
|
||||
user_session(@teacher)
|
||||
get 'new', params: { course_id: @course.id }
|
||||
expect(@controller.js_env.dig(:conferences, :conference_types).length).to eq 1
|
||||
|
@ -136,70 +141,75 @@ describe CalendarEventsController do
|
|||
let(:make_request) do
|
||||
->(params) { get 'new', params: { course_id: @course.id, web_conference: params } }
|
||||
end
|
||||
let(:get_event) do
|
||||
-> { @controller.instance_variable_get(:@event) }
|
||||
end
|
||||
let(:get_event) { -> { @controller.instance_variable_get(:@event) } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST 'create'" do
|
||||
it "requires authorization" do
|
||||
post 'create', params: { :course_id => @course.id, :calendar_event => { :title => "some event" } }
|
||||
it 'requires authorization' do
|
||||
post 'create', params: { course_id: @course.id, calendar_event: { title: 'some event' } }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "does not allow students to create" do
|
||||
it 'does not allow students to create' do
|
||||
user_session(@student)
|
||||
post 'create', params: { :course_id => @course.id, :calendar_event => { :title => "some event" } }
|
||||
post 'create', params: { course_id: @course.id, calendar_event: { title: 'some event' } }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "creates a new event" do
|
||||
it 'creates a new event' do
|
||||
user_session(@teacher)
|
||||
post 'create', params: { :course_id => @course.id, :calendar_event => { :title => "some event" } }
|
||||
post 'create', params: { course_id: @course.id, calendar_event: { title: 'some event' } }
|
||||
expect(response).to be_redirect
|
||||
expect(assigns[:event]).not_to be_nil
|
||||
expect(assigns[:event].title).to eql("some event")
|
||||
expect(assigns[:event].title).to eql('some event')
|
||||
end
|
||||
|
||||
include_examples 'accepts web_conference' do
|
||||
let(:make_request) do
|
||||
->(params) { post 'create', params: { course_id: @course.id, calendar_event: { title: 'some event', web_conference: params } } }
|
||||
end
|
||||
let(:get_event) do
|
||||
-> { assigns[:event] }
|
||||
->(params) do
|
||||
post 'create',
|
||||
params: {
|
||||
course_id: @course.id,
|
||||
calendar_event: {
|
||||
title: 'some event',
|
||||
web_conference: params
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
let(:get_event) { -> { assigns[:event] } }
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET 'edit'" do
|
||||
it "requires authorization" do
|
||||
get 'edit', params: { :course_id => @course.id, :id => @event.id }
|
||||
it 'requires authorization' do
|
||||
get 'edit', params: { course_id: @course.id, id: @event.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "does not allow students to update" do
|
||||
it 'does not allow students to update' do
|
||||
user_session(@student)
|
||||
get 'edit', params: { :course_id => @course.id, :id => @event.id }
|
||||
get 'edit', params: { course_id: @course.id, id: @event.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
include_examples 'accepts web_conference' do
|
||||
let(:make_request) do
|
||||
->(params) { get 'edit', params: { course_id: @course.id, id: @event.id, web_conference: params } }
|
||||
end
|
||||
let(:get_event) do
|
||||
-> { @event.reload }
|
||||
->(params) do
|
||||
get 'edit', params: { course_id: @course.id, id: @event.id, web_conference: params }
|
||||
end
|
||||
end
|
||||
let(:get_event) { -> { @event.reload } }
|
||||
end
|
||||
|
||||
it 'allows editing of event assigned to section' do
|
||||
course_with_teacher
|
||||
section = add_section('Section 01', course: @course)
|
||||
section_event = section.calendar_events.create(:title => "some assignment")
|
||||
section_event = section.calendar_events.create(title: 'some assignment')
|
||||
user_session(@teacher)
|
||||
get 'edit', params: { :course_id => @course.id, :id => section_event.id }
|
||||
get 'edit', params: { course_id: @course.id, id: section_event.id }
|
||||
assert_status(200)
|
||||
end
|
||||
|
||||
|
@ -227,60 +237,81 @@ describe CalendarEventsController do
|
|||
end
|
||||
|
||||
describe "PUT 'update'" do
|
||||
it "requires authorization" do
|
||||
put 'update', params: { :course_id => @course.id, :id => @event.id }
|
||||
it 'requires authorization' do
|
||||
put 'update', params: { course_id: @course.id, id: @event.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "does not allow students to update" do
|
||||
it 'does not allow students to update' do
|
||||
user_session(@student)
|
||||
put 'update', params: { :course_id => @course.id, :id => @event.id }
|
||||
put 'update', params: { course_id: @course.id, id: @event.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "updates the event" do
|
||||
it 'updates the event' do
|
||||
user_session(@teacher)
|
||||
put 'update', params: { :course_id => @course.id, :id => @event.id, :calendar_event => { :title => "new title" } }
|
||||
put 'update',
|
||||
params: {
|
||||
course_id: @course.id,
|
||||
id: @event.id,
|
||||
calendar_event: {
|
||||
title: 'new title'
|
||||
}
|
||||
}
|
||||
expect(response).to be_redirect
|
||||
expect(assigns[:event]).not_to be_nil
|
||||
expect(assigns[:event]).to eql(@event)
|
||||
expect(assigns[:event].title).to eql("new title")
|
||||
expect(assigns[:event].title).to eql('new title')
|
||||
end
|
||||
|
||||
it 'allows updating of event assigned to section' do
|
||||
course_with_teacher
|
||||
section = add_section('Section 01', course: @course)
|
||||
section_event = section.calendar_events.create(:title => "some assignment")
|
||||
section_event = section.calendar_events.create(title: 'some assignment')
|
||||
user_session(@teacher)
|
||||
put 'update', params: { :course_id => @course.id, :id => section_event.id, :calendar_event => { :title => "new title" } }
|
||||
put 'update',
|
||||
params: {
|
||||
course_id: @course.id,
|
||||
id: section_event.id,
|
||||
calendar_event: {
|
||||
title: 'new title'
|
||||
}
|
||||
}
|
||||
assert_status(302)
|
||||
end
|
||||
|
||||
include_examples 'accepts web_conference' do
|
||||
let(:make_request) do
|
||||
->(params) { put 'update', params: { course_id: @course.id, id: @event.id, calendar_event: { web_conference: params } } }
|
||||
end
|
||||
let(:get_event) do
|
||||
-> { assigns[:event] }
|
||||
->(params) do
|
||||
put 'update',
|
||||
params: {
|
||||
course_id: @course.id,
|
||||
id: @event.id,
|
||||
calendar_event: {
|
||||
web_conference: params
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
let(:get_event) { -> { assigns[:event] } }
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE 'destroy'" do
|
||||
it "requires authorization" do
|
||||
delete 'destroy', params: { :course_id => @course.id, :id => @event.id }
|
||||
it 'requires authorization' do
|
||||
delete 'destroy', params: { course_id: @course.id, id: @event.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "does not allow students to delete" do
|
||||
it 'does not allow students to delete' do
|
||||
user_session(@student)
|
||||
delete 'destroy', params: { :course_id => @course.id, :id => @event.id }
|
||||
delete 'destroy', params: { course_id: @course.id, id: @event.id }
|
||||
assert_unauthorized
|
||||
end
|
||||
|
||||
it "deletes the event" do
|
||||
it 'deletes the event' do
|
||||
user_session(@teacher)
|
||||
delete 'destroy', params: { :course_id => @course.id, :id => @event.id }
|
||||
delete 'destroy', params: { course_id: @course.id, id: @event.id }
|
||||
expect(response).to be_redirect
|
||||
expect(assigns[:event]).not_to be_nil
|
||||
expect(assigns[:event]).to eql(@event)
|
||||
|
|
Loading…
Reference in New Issue