diff --git a/app/coffeescripts/bundles/calendar_event.coffee b/app/coffeescripts/bundles/calendar_event.coffee deleted file mode 100644 index 359d6d885a0..00000000000 --- a/app/coffeescripts/bundles/calendar_event.coffee +++ /dev/null @@ -1,2 +0,0 @@ -require ['calendar_event'] - diff --git a/app/controllers/calendar_events_controller.rb b/app/controllers/calendar_events_controller.rb index e392e78c489..15a818cc584 100644 --- a/app/controllers/calendar_events_controller.rb +++ b/app/controllers/calendar_events_controller.rb @@ -48,7 +48,6 @@ class CalendarEventsController < ApplicationController @event = @context.calendar_events.build add_crumb(t('crumbs.new', "New Calendar Event"), named_context_url(@context, :new_context_calendar_event_url)) @event.update_attributes!(params.slice(:title, :start_at, :end_at, :location_name, :location_address)) - @editing = true js_env(:DIFFERENTIATED_ASSIGNMENTS_ENABLED => @context.feature_enabled?(:differentiated_assignments)) authorized_action(@event, @current_user, :create) end @@ -76,7 +75,6 @@ class CalendarEventsController < ApplicationController if @event.grants_right?(@current_user, session, :update) @event.update_attributes!(params.slice(:title, :start_at, :end_at, :location_name, :location_address)) end - @editing = true js_env(:DIFFERENTIATED_ASSIGNMENTS_ENABLED => @context.feature_enabled?(:differentiated_assignments)) if authorized_action(@event, @current_user, :update_content) render :action => 'new' diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 988f4f8963e..8fc13ae0d95 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -18,53 +18,6 @@ class CalendarsController < ApplicationController before_filter :require_user, :except => [ :public_feed ] - before_filter :check_preferred_calendar, :only => [ :show, :show2 ] - - def show - get_context - if @context != @current_user - # we used to have calendar pages under contexts, like - # /courses/X/calendar, but these all redirect to /calendar now. - # we shouldn't have any of these URLs anymore, but let's leave in this - # fail-safe in case somebody has a bookmark or something. - return redirect_to(calendar_url_for([@context])) - end - get_all_pertinent_contexts(include_groups: true) - # somewhere there's a bad link that doesn't separate parameters properly. - # make sure we don't do a find on a non-numeric id. - if params[:event_id] && params[:event_id] =~ Api::ID_REGEX - event = CalendarEvent.where(id: params[:event_id]).first - event = nil if event && event.start_at.nil? - @active_event_id = event.id if event - end - build_calendar_dates(event) - - respond_to do |format| - format.html do - @events = [] - @undated_events = [] - @show_left_side = false - @calendar_event = @contexts[0].calendar_events.new - @contexts.each do |context| - log_asset_access("dashboard_calendar:#{context.asset_string}", "calendar", 'other') - end - calendarManagementContexts = @contexts.select{|c| can_do(c, @current_user, :manage_calendar) }.map(&:asset_string) - canCreateEvent = calendarManagementContexts.length > 0 - js_env(calendarManagementContexts: calendarManagementContexts, - canCreateEvent: canCreateEvent) - render :action => "show" - end - # this unless @dont_render_again stuff is ugly but I wanted to send back a 304 but it started giving me "Double Render errors" - format.json do - events = calendar_events_for_request_format - render :json => events unless @dont_render_again - end - format.ics { - events = calendar_events_for_request_format - render :text => events unless @dont_render_again - } - end - end def show2 get_context @@ -217,34 +170,4 @@ class CalendarsController < ApplicationController end protected :build_calendar_dates - def switch_calendar - if @domain_root_account.enable_scheduler? - if params[:preferred_calendar] == '2' - @current_user.preferences.delete(:use_calendar1) - else - @current_user.preferences[:use_calendar1] = true - end - @current_user.save! - end - check_preferred_calendar(true) - end - - def check_preferred_calendar(always_redirect=false) - preferred_calendar = 'show' - if (@domain_root_account.enable_scheduler? && - !@current_user.preferences[:use_calendar1]) || - @domain_root_account.calendar2_only? - preferred_calendar = 'show2' - end - if always_redirect || params[:action] != preferred_calendar - redirect_to({ :action => preferred_calendar, :anchor => ' ' }.merge(params.slice(:include_contexts, :event_id))) - return false - end - if @domain_root_account.enable_scheduler? - if preferred_calendar == 'show' - add_crumb view_context.link_to(t(:use_new_calendar, "Try out the new calendar"), switch_calendar_url('2'), :method => :post), nil, :id => 'change_calendar_version_link_holder' - end - end - end - protected :check_preferred_calendar end diff --git a/app/models/account.rb b/app/models/account.rb index aeb1114dc12..de28fabfaff 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1533,14 +1533,6 @@ class Account < ActiveRecord::Base false end - def calendar2_only? - true - end - - def enable_scheduler? - true - end - def change_root_account_setting!(setting_name, new_value) root_account.settings[setting_name] = new_value root_account.save! diff --git a/app/views/calendar_events/_full_calendar_event.html.erb b/app/views/calendar_events/_full_calendar_event.html.erb index a41d56c3f22..88962445a05 100644 --- a/app/views/calendar_events/_full_calendar_event.html.erb +++ b/app/views/calendar_events/_full_calendar_event.html.erb @@ -1,10 +1,5 @@ -<% - js_bundle :calendar_event - jammit_css :tinymce -%> - <% calendar_event = full_calendar_event %> -
+
@@ -29,69 +24,4 @@
<%= calendar_event && calendar_event.description && !calendar_event.description.empty? ? user_content(calendar_event.description) : t(:no_content, "No Content") %>
- <% if can_do(calendar_event, @current_user, :update_content) %> - <% url = calendar_event.new_record? ? context_url(@context, :context_calendar_events_url) : context_url(@context, :context_calendar_event_url, calendar_event.id) %> - <%= form_for calendar_event, :url => url, :html => {:method => (calendar_event.new_record? ? 'POST' : 'PUT'), :style => 'display: none;', :id => 'edit_calendar_event_form', :class => (calendar_event.new_record? ? 'new_event' : '')} do |f| %> - - <% if can_do(calendar_event, @current_user, :update) %> - - - - - - - - - - - <% end %> - - - -
<%= f.blabel :title, :en => "Title" %><%= f.text_field :title, :size => 20 %>
<%= before_label :date, "Date" %> - -
<%= before_label :from, "From" %> - <% ot(:timespan, "%{start_time} *to* %{end_time}", :start_time => capture { %> -
- -
- <% }, :end_time => capture { %> -
- -
- <% }, :wrapper => '
 \1 
') %> -
- -
- <%= before_label :event_description, "Event Description" %> -
-
<%= f.text_area :description, :style => 'width: 100%;' %>
-
-
- - - - - - - - - -
- - -
- - -
-
-
- - -
- <% end %> - <% end %>
diff --git a/app/views/calendar_events/new.html.erb b/app/views/calendar_events/new.html.erb index 01f649792aa..cc492e137f2 100644 --- a/app/views/calendar_events/new.html.erb +++ b/app/views/calendar_events/new.html.erb @@ -2,37 +2,17 @@ content_for :page_title, @event.title || t(:page_title, "New Calendar Event") return_to_url = return_to_calendar(:context => @context, :event => @event) - if @domain_root_account.enable_scheduler? - event_attrs = { - :id => @event.id, - :context_code => @context.asset_string, - :return_to_url => return_to_url - } - if @context.is_a? Course - event_attrs[:sections_url] = context_url(@context, :api_v1_context_sections_url) - end - js_env :CALENDAR_EVENT => event_attrs + event_attrs = { + :id => @event.id, + :context_code => @context.asset_string, + :return_to_url => return_to_url + } + if @context.is_a? Course + event_attrs[:sections_url] = context_url(@context, :api_v1_context_sections_url) + end + js_env :CALENDAR_EVENT => event_attrs - js_bundle :edit_calendar_event - jammit_css :tinymce, :edit_calendar_event_full - content_for :right_side, render(:partial => 'shared/wiki_sidebar') - else - content_for :right_side do + js_bundle :edit_calendar_event + jammit_css :tinymce, :edit_calendar_event_full + content_for :right_side, render(:partial => 'shared/wiki_sidebar') %> - - <%= render :partial => 'shared/wiki_sidebar' %> -<% end %> - -<%= render :partial => 'full_calendar_event', :object => @event %> -<% end %> \ No newline at end of file diff --git a/app/views/calendars/_calendar.html.erb b/app/views/calendars/_calendar.html.erb deleted file mode 100644 index 39120ed6dc3..00000000000 --- a/app/views/calendars/_calendar.html.erb +++ /dev/null @@ -1,245 +0,0 @@ -<% - js_env :CALENDAR => { :ACTIVE_EVENT => @active_event_id } - js_bundle :calendar - jammit_css :calendar - @body_classes << "full-width" -%> -<% content_for :stylesheets do %> - -<% end %> -<% content_for :right_side do %> - -<% end %> - -
- - - - - - - - <% I18n.t('date.day_names').each do |d| %> - - <% end %> - - <% day = first_day %> - <% cache(['calendar_render', day.to_s].cache_key) do %> - <% 6.times do %> - - <% 7.times do %> - - <% day = day.next %> - <% end %> - <% end %> - <% end %> -
- - <%= image_tag "arrow_left.png", :alt => t('alts.previous', "Previous") %> - - <%= I18n.t('date.month_names')[current.month] %> - <%= @current.year %> - - <%= image_tag "arrow_right.png", :alt => t('alts.next', "Next") %> - <%= image_tag "ajax-reload.gif", :class => "static" %><%= image_tag "ajax-reload-animated.gif", :class => "animated", :style => "display: none;" %> -
<%= d %>
" tabindex="0" class="calendar_day_holder <%= day <= last_day ? 'visible' : '' %>">
-
"><%= day.day %>
-
-
-<%= render :partial => 'event', :object => nil %> - - - - - - - -
-
-<%= render :partial => "shared/add_assignment_group" %> - diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb deleted file mode 100644 index 6e42e09b593..00000000000 --- a/app/views/calendars/show.html.erb +++ /dev/null @@ -1,76 +0,0 @@ -<% content_for :page_title do %><%= join_title t(:page_title, "Calendar"), @context.name %><% end %> -<% add_crumb t('crumbs.my_calendar', "My Calendar"), calendar_url %> - -<% content_for :auto_discovery do %> - <% if @context_enrollment %> - <%= auto_discovery_link_tag(:atom, feeds_calendar_format_url(@context_enrollment.feed_code, :atom), {:title => t(:feed_title, "Course Calendar Atom Feed")}) %> - <% elsif @context.available? %> - <%= auto_discovery_link_tag(:atom, feeds_calendar_format_url(@context.feed_code, :atom), {:title => t(:feed_title, "Course Calendar Atom Feed")}) %> - <% end %> -<% end %> - -<%= render :partial => "calendar", :object => @events, :locals => { :first_day => @first_day, :last_day => @last_day, :current => @current } %> - -<% content_for :wizard_box do %> - <%= render :partial => "calendars/wizard_box" %> -<% end %> - -<% content_for :keyboard_navigation do %> - -<% end %> diff --git a/app/views/calendars/show2.html.erb b/app/views/calendars/show2.html.erb index cac0e6e3196..53e30c21cb3 100644 --- a/app/views/calendars/show2.html.erb +++ b/app/views/calendars/show2.html.erb @@ -6,7 +6,7 @@ :SELECTED_CONTEXTS => @selected_contexts, :ACTIVE_EVENT => @active_event_id, :VIEW_START => @view_start, - :CAL2_ONLY => @domain_root_account.calendar2_only?, + :CAL2_ONLY => true, :SHOW_SCHEDULER => @domain_root_account.show_scheduler? } js_bundle :calendar2 diff --git a/config/routes.rb b/config/routes.rb index a92a4854c50..23cfb75856f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -209,7 +209,7 @@ CanvasRails::Application.routes.draw do get 'grading_rubrics' => 'gradebooks#grading_rubrics' get 'grades/:id' => 'gradebooks#grade_summary', as: :student_grades concerns :announcements - get 'calendar' => 'calendars#show', as: :old_calendar + get 'calendar' => 'calendars#show2', as: :old_calendar get :locks concerns :discussions resources :assignments do @@ -460,7 +460,7 @@ CanvasRails::Application.routes.draw do concerns :media resources :collaborations - get 'calendar' => 'calendars#show', as: :old_calendar + get 'calendar' => 'calendars#show2', as: :old_calendar end resources :accounts do @@ -683,10 +683,9 @@ CanvasRails::Application.routes.draw do resources :plugins, only: [:index, :show, :update] - get 'calendar' => 'calendars#show' + get 'calendar' => 'calendars#show2' get 'calendar2' => 'calendars#show2' get 'course_sections/:course_section_id/calendar_events/:id' => 'calendar_events#show', as: :course_section_calendar_event - post 'switch_calendar/:preferred_calendar' => 'calendars#switch_calendar', as: :switch_calendar get 'files' => 'files#index' get "files/folder#{full_path_glob}", controller: 'files', action: 'react_files', format: false get "files/search", controller: 'files', action: 'react_files', format: false diff --git a/public/javascripts/calendar_event.js b/public/javascripts/calendar_event.js deleted file mode 100644 index 791e0c500e3..00000000000 --- a/public/javascripts/calendar_event.js +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright (C) 2011 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 . - */ - -define([ - 'timezone', - 'i18n!calendar_events', - 'jquery' /* jQuery, $ */, - 'wikiSidebar', - 'jquery.instructure_date_and_time' /* dateString, timeString, date_field, time_field, /\$\.datetime/ */, - 'jquery.instructure_forms' /* formSubmit, fillFormData, formErrors */, - 'jquery.instructure_misc_helpers' /* encodeToHex, scrollSidebar */, - 'jquery.instructure_misc_plugins' /* confirmDelete, fragmentChange, showIf */, - 'jquery.loadingImg' /* loadingImg, loadingImage */, - 'jquery.templateData' /* fillTemplateData, getTemplateData */, - 'compiled/tinymce', - 'tinymce.editor_box' /* editorBox */, - 'vendor/date' /* Date.parse */ -], function(tz, I18n, $, wikiSidebar) { - - var noContentText = I18n.t('no_content', "No Content"); - -$(function($) { - var $full_calendar_event = $("#full_calendar_event"), - $edit_calendar_event_form = $("#edit_calendar_event_form"), - $full_calendar_event_holder = $("#full_calendar_event_holder"); - - - function hideEditCalendarEventForm(redirect) { - $full_calendar_event.show(); - $edit_calendar_event_form.hide() - .find("textarea").editorBox('destroy'); - if (wikiSidebar) { - wikiSidebar.hide(); - $("#sidebar_content").show(); - } - if (redirect && $edit_calendar_event_form.hasClass('new_event')) { - window.location.href = $(".calendar_url").attr('href'); - } - }; - function editCalendarEventForm() { - $full_calendar_event.hide(); - var data = $full_calendar_event.getTemplateData({ - textValues: ['start_at_date_string', 'start_at_time_string', 'end_at_time_string', 'title', 'all_day', 'all_day_date'] - }); - if (data.description == noContentText) { - data.description = ""; - } - data.start_date = data.start_at_date_string; - data.start_time = data.start_at_time_string; - data.end_time = data.end_at_time_string; - if (data.all_day == 'true') { - if (data.all_day_date) { - data.start_date = data.all_day_date; - } - data.start_time = ''; - data.end_time = ''; - } - $edit_calendar_event_form - .fillFormData(data, {object_name: 'calendar_event'}) - .show() - .find("textarea").editorBox(); - if (wikiSidebar) { - wikiSidebar.attachToEditor($edit_calendar_event_form.find("textarea:first")); - wikiSidebar.show(); - $("#sidebar_content").hide(); - } - }; - - if (wikiSidebar) { - wikiSidebar.init(); - } - $(".date_field").date_field(); - $(".time_field").time_field(); - $(".delete_event_link").click(function(event) { - event.preventDefault(); - $("#full_calendar_event_holder").confirmDelete({ - message: "Are you sure you want to delete this event?", - url: $(this).attr('href'), - success: function() { - $(this).fadeOut('slow'); - window.location.href = $(".calendar_url").attr('href'); - } - }); - }); - $(".switch_full_calendar_event_view").click(function() { - $("#calendar_event_description").editorBox('toggle'); - // todo: replace .andSelf with .addBack when JQuery is upgraded. - $(this).siblings(".switch_full_calendar_event_view").andSelf().toggle(); - return false; - }); - $(".edit_calendar_event_link").click(function() { - editCalendarEventForm(); - return false; - }); - $edit_calendar_event_form.find(".cancel_button").click(function() { - hideEditCalendarEventForm(true); - return false; - }); - $edit_calendar_event_form.formSubmit({ - object_name: 'calendar_event', - processData: function(data) { - data['calendar_event[start_at]'] = $.datetime.process(data.start_date + " " + data.start_time); - data['calendar_event[end_at]'] = $.datetime.process(data.start_date + " " + data.end_time); - data['calendar_event[description]'] = $(this).find("textarea").editorBox('get_code'); - $full_calendar_event_holder.fillTemplateData({ - data: data, - except: ['description'] - }); - return data; - }, - beforeSubmit: function(data) { - hideEditCalendarEventForm(); - $full_calendar_event_holder.loadingImage(); - }, - success: function(data) { - var calendar_event = data.calendar_event, - start_at = tz.parse(calendar_event.start_at); - - - calendar_event.start_at_date_string = $.dateString(start_at); - calendar_event.start_at_time_string = $.timeString(start_at); - calendar_event.end_at_time_string = $.timeString(calendar_event.end_at); - calendar_event.all_day_date = $.dateString(calendar_event.all_day_date); - - $full_calendar_event_holder.find(".from_string,.to_string,.end_at_time_string").showIf(calendar_event.end_at && calendar_event.end_at != calendar_event.start_at); - $full_calendar_event_holder.find(".at_string").showIf(!calendar_event.end_at || calendar_event.end_at == calendar_event.start_at); - $full_calendar_event_holder.find(".not_all_day").showIf(!calendar_event.all_day); - $full_calendar_event_holder - .loadingImage('remove') - .fillTemplateData({ - data: calendar_event, - htmlValues: ['description'] - }); - $(this).find("textarea").editorBox('set_code', calendar_event.description); - var month = null, year = null; - if (calendar_event.start_at) { - year = calendar_event.start_at.substring(0, 4); - month = calendar_event.start_at.substring(5, 7); - } - var calendar_url = $(".base_calendar_url").attr('href'), - split = calendar_url.split(/#/), - anchor = split[1], - base_url = split[0], - json = {}; - - try{ - json = $.parseJSON(anchor) || {}; - } catch(e) { - json = {}; - } - if (month && year) { - json.month = month; - json.year = year; - } - $(".calendar_url").attr('href', base_url + "#" + $.encodeToHex(JSON.stringify(json))); - - window.location.href = $(".calendar_url").attr('href'); - }, - error: function(data) { - $full_calendar_event_holder.loadingImage('remove'); - $(".edit_calendar_event_link:first").click(); - $edit_calendar_event_form.formErrors(data); - } - }); - setTimeout(function() { - if ($full_calendar_event_holder.hasClass('editing')) { - $(".edit_calendar_event_link:first").click(); - } - }, 500); - $(document).fragmentChange(function(event, hash) { - if (hash == "#edit") { - $(".edit_calendar_event_link:first").click(); - } - }); - $.scrollSidebar(); - -}); -}); diff --git a/spec/controllers/calendars_controller_spec.rb b/spec/controllers/calendars_controller_spec.rb index 5962bcb9f00..a3300badaab 100644 --- a/spec/controllers/calendars_controller_spec.rb +++ b/spec/controllers/calendars_controller_spec.rb @@ -62,41 +62,6 @@ describe CalendarsController do end end - describe "POST 'switch_calendar'" do - it "should not switch to the old calendar anymore" do - expect(@user.preferences[:use_calendar1]).to be_nil - - post 'switch_calendar', {:preferred_calendar => '1'} - expect(response).to redirect_to(calendar2_url(anchor: ' ')) - expect(@user.reload.preferences[:use_calendar1]).to be_truthy - end - - it "should not switch to the old calendar if not allowed" do - expect(@user.preferences[:use_calendar1]).to be_nil - post 'switch_calendar', {:preferred_calendar => '1'} - expect(response).to redirect_to(calendar2_url(anchor: ' ')) - - # not messing with their preference in case they prefer cal1 in a - # different account - expect(@user.reload.preferences[:use_calendar1]).to be_truthy - end - - it "should redirect to new calendar regardless of old preference settings" do - expect(@user.preferences[:use_calendar1]).to be_nil - - post 'switch_calendar', {:preferred_calendar => '2'} - expect(response).to redirect_to(calendar2_url(anchor: ' ')) - expect(@user.reload.preferences[:use_calendar1]).to be_nil - end - - it "should switch to the new calendar if allowed" do - @user.update_attribute(:preferences, {:use_calendar1 => true}) - - post 'switch_calendar', {:preferred_calendar => '2'} - expect(response).to redirect_to(calendar2_url(anchor: ' ')) - expect(@user.reload.preferences[:use_calendar1]).to be_nil - end - end end describe CalendarEventsApiController do diff --git a/spec/views/calendars/_calendar.html.erb_spec.rb b/spec/views/calendars/_calendar.html.erb_spec.rb deleted file mode 100644 index 1827ce7640c..00000000000 --- a/spec/views/calendars/_calendar.html.erb_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (C) 2011 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 . -# - -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') -require File.expand_path(File.dirname(__FILE__) + '/../views_helper') - -describe "/calendars/_calendar" do - it "should render" do - today = Time.zone.today - course_with_student - view_context(@course, @user) - assigns[:contexts] = [@course] - assigns[:first_day] = today - assigns[:last_day] = today + 30 - assigns[:current] = today + 2 - assigns[:events] = [@course.calendar_events.create!(:title => "some event", :start_at => Time.now)] - assigns[:assignment_groups_for] = {} - assigns[:body_classes] = [] - render :partial => 'calendars/calendar', :object => assigns[:events], :locals => {:current => today, :first_day => today - 3, :last_day => today + 30, :request => OpenObject.new(:path_parameters => {:controller => 'calendars', :action => 'show'}, :query_parameters => {})} - end -end - diff --git a/spec/views/calendars/show.html.erb_spec.rb b/spec/views/calendars/show.html.erb_spec.rb deleted file mode 100644 index 27f7b1bef7d..00000000000 --- a/spec/views/calendars/show.html.erb_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (C) 2011 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 . -# - -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') -require File.expand_path(File.dirname(__FILE__) + '/../views_helper') - -describe "/calendars/show" do - it "should render" do - today = Time.zone.today - course_with_student - view_context(@course, @user) - assigns[:events] = [] - assigns[:events] << @course.calendar_events.create!(:title => "some event", :start_at => Time.now, :end_at => Time.now) - assigns[:events] << @course.assignments.create!(:title => "some assignment", :due_at => Time.now + 1000) - assigns[:contexts] = [@course] - assigns[:first_day] = today - assigns[:last_day] = today + 30 - assigns[:current] = today + 2 - assigns[:assignment_groups_for] = {} - assigns[:body_classes] = [] - render 'calendars/show' - expect(response).not_to be_nil - end -end -