fix Style/EmptyLineBetweenDefs issue

Change-Id: Ib7b824043a7ac9196f06020e2ca42fe983565f0d
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52919
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
This commit is contained in:
Strand McCutchen 2015-04-27 10:47:25 -07:00
parent 3a89521cda
commit d6597c107c
41 changed files with 94 additions and 0 deletions

View File

@ -34,6 +34,7 @@ class ContentImportsController < ApplicationController
def index
redirect_to course_content_migrations_url(@context)
end
def intro
redirect_to course_content_migrations_url(@context)
end

View File

@ -25,6 +25,7 @@ class EportfolioCategoriesController < ApplicationController
@portfolio = Eportfolio.find(params[:eportfolio_id])
redirect_to eportfolio_url(@portfolio)
end
def create
@portfolio = Eportfolio.find(params[:eportfolio_id])
if authorized_action(@portfolio, @current_user, :update)

View File

@ -175,7 +175,9 @@ module ApplicationHelper
:contents => capture(&block)
)
end
def js_blocks; @js_blocks ||= []; end
def render_js_blocks
output = js_blocks.inject('') do |str, e|
# print file and line number for debugging in development mode.
@ -195,7 +197,9 @@ module ApplicationHelper
end
hidden_dialogs[id] = capture(&block)
end
def hidden_dialogs; @hidden_dialogs ||= {}; end
def render_hidden_dialogs
output = hidden_dialogs.keys.sort.inject('') do |str, id|
str << "<div id='#{id}' style='display: none;''>" << hidden_dialogs[id] << "</div>"

View File

@ -91,6 +91,7 @@ class AssignmentOverride < ActiveRecord::Base
private :touch_assignment
def assignment?; !!assignment_id; end
def quiz?; !!quiz_id; end
workflow do

View File

@ -1925,6 +1925,7 @@ class Course < ActiveRecord::Base
logger.debug text
@merge_results << text
end
def warn_merge_result(text)
log_merge_result(text)
end

View File

@ -901,6 +901,7 @@ class DiscussionTopic < ActiveRecord::Base
end
def delay_posting=(val); end
def set_assignment=(val); end
def participants(include_observers=false)

View File

@ -406,10 +406,12 @@ class Group < ActiveRecord::Base
def map_merge(*args)
end
def log_merge_result(text)
@merge_results ||= []
@merge_results << text
end
def warn_merge_result(text)
record_merge_result(text)
end
@ -437,6 +439,7 @@ class Group < ActiveRecord::Base
def account=(new_account)
self.account_id = new_account.id
end
def account_id=(new_account_id)
write_attribute(:account_id, new_account_id)
if self.account_id_changed?

View File

@ -54,6 +54,7 @@ module Polling
end
end
end
def poll_choices_belong_to_poll
if self.poll
unless self.poll.poll_choices.include?(poll_choice)

View File

@ -580,6 +580,7 @@ class User < ActiveRecord::Base
# These methods can be overridden by a plugin if you want to have an approval
# process or implement additional tracking for new users
def registration_approval_required?; false; end
def new_registration(form_params = {}); end
# DEPRECATED, override new_registration instead
def new_teacher_registration(form_params = {}); new_registration(form_params); end
@ -1577,10 +1578,12 @@ class User < ActiveRecord::Base
def map_merge(*args)
end
def log_merge_result(text)
@merge_results ||= []
@merge_results << text
end
def warn_merge_result(text)
record_merge_result(text)
end

View File

@ -197,9 +197,11 @@ class WebConference < ActiveRecord::Base
def add_initiator(user)
add_user(user, 'initiator')
end
def add_invitee(user)
add_user(user, 'invitee')
end
def add_attendee(user)
add_user(user, 'attendee')
end
@ -256,6 +258,7 @@ class WebConference < ActiveRecord::Base
def long_running?
duration.nil?
end
def long_running
long_running? ? 1 : 0
end
@ -363,6 +366,7 @@ class WebConference < ActiveRecord::Base
def has_advanced_settings?
respond_to?(:admin_settings_url)
end
def has_advanced_settings
has_advanced_settings? ? 1 : 0
end

View File

@ -86,6 +86,7 @@ class Quizzes::TakeQuizPresenter
def text_only?(q)
q['question_type'] == "text_only_question"
end
def answered_icon(q)
question_answered?(q) ? 'icon-check' : 'icon-question'
end

View File

@ -1197,6 +1197,7 @@ if defined?(ActiveRecord::ConnectionAdapters::SQLiteAdapter)
def quoted_true
'1'
end
def quoted_false
'0'
end

View File

@ -68,6 +68,7 @@ class ArgumentView < HashView
def remove_outer_square_brackets(str)
str.sub(/^\[/, '').sub(/\]$/, '')
end
def metadata_parts
remove_outer_square_brackets(@type).
split(/\s*[,\|]\s*/).map{ |t| t.force_encoding('UTF-8') }

View File

@ -28,7 +28,9 @@ describe ActiveSupport::Callbacks::Suspension do
include ActiveSupport::Callbacks::Suspension
def validate; end
def persist; end
def publish; end
if rails2

View File

@ -70,8 +70,11 @@ module CanvasColor
# Setters for individual channels - take 0-255 or '00'-'FF' values
def r=(val); @r = from_hex(val); end
def g=(val); @g = from_hex(val); end
def b=(val); @b = from_hex(val); end
def a=(val); @a = from_hex(val); end
# Attempt to read in a string and parse it into values

View File

@ -34,8 +34,11 @@ module Guard
module Formatter
class << self
def info(message, options = { }); ::Guard::UI.info(message, options); end
def error(message, options = { }); ::Guard::UI.error(color(message, ';31'), options); end
def success(message, options = { }); ::Guard::UI.info(color(message, ';32'), options); end
def notify(message, options = { }); ::Guard::Notifier.notify(message, options); end
private
def color(text, color_code); ::Guard::UI.send(:color_enabled?) ? "\e[0#{ color_code }m#{ text }\e[0m" : text; end

View File

@ -64,12 +64,15 @@ class ApiRouteSet
def get(path, opts = {})
route(:get, path, opts)
end
def put(path, opts = {})
route(:put, path, opts)
end
def post(path, opts = {})
route(:post, path, opts)
end
def delete(path, opts = {})
route(:delete, path, opts)
end

View File

@ -69,6 +69,7 @@ class CSVParser
end
def num_rows; trimmed_contents.size end
def num_cols; trimmed_contents.first.size end
end

View File

@ -25,6 +25,7 @@ class GradebookImporter
def generate
instance.next
end
def instance
@@inst ||= new
end

View File

@ -107,6 +107,7 @@ class HostUrl
def file_host=(val)
@@file_host = val
end
def default_host=(val)
@@default_host = val
end

View File

@ -56,7 +56,9 @@ module Stats
def size; @items.size; end
alias :count :size
def empty?; @items.size == 0; end
def sum_of_squares; @sum_of_squares; end
def mean; @items.empty? ? nil : (sum.to_f / @items.size); end
alias :avg :mean

View File

@ -105,16 +105,25 @@ class SyslogWrapper
def <<(msg); add(@level, msg); end
def debug(progname=nil, &block); add(Logger::DEBUG, nil, progname, &block); end
def info(progname=nil, &block); add(Logger::INFO, nil, progname, &block); end
def warn(progname=nil, &block); add(Logger::WARN, nil, progname, &block); end
def error(progname=nil, &block); add(Logger::ERROR, nil, progname, &block); end
def fatal(progname=nil, &block); add(Logger::FATAL, nil, progname, &block); end
def unknown(progname=nil, &block); add(Logger::UNKNOWN, nil, progname, &block); end
def debug?; @level <= Logger::DEBUG; end
def info?; @level <= Logger::INFO; end
def warn?; @level <= Logger::WARN; end
def error?; @level <= Logger::ERROR; end
def fatal?; @level <= Logger::FATAL; end
end

View File

@ -23,7 +23,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../file_uploads_spec_helper'
class TestCourseApi
include Api::V1::Course
def feeds_calendar_url(feed_code); "feed_calendar_url(#{feed_code.inspect})"; end
def course_url(course, opts = {}); return "course_url(Course.find(#{course.id}), :host => #{HostUrl.context_host(@course1)})"; end
def api_user_content(syllabus, course); return "api_user_content(#{syllabus}, #{course.id})"; end
end

View File

@ -25,7 +25,9 @@ class DiscussionTopicsTestCourseApi
include Api
include Api::V1::DiscussionTopics
def feeds_topic_format_path(topic_id, code, format); "feeds_topic_format_path(#{topic_id.inspect}, #{code.inspect}, #{format.inspect})"; end
def named_context_url(*args); "named_context_url(#{args.inspect[1..-2]})"; end
def course_assignment_url(*args); "course_assignment_url(#{args.inspect[1..-2]})"; end
end
@ -104,6 +106,7 @@ describe DiscussionTopicsController, type: :request do
def avatar_url_for_user(user, *a)
User.avatar_fallback_url
end
def blank_fallback
nil
end

View File

@ -23,6 +23,7 @@ describe "Pages API", type: :request do
def avatar_url_for_user(user, *a)
User.avatar_fallback_url
end
def blank_fallback
nil
end

View File

@ -32,6 +32,7 @@ describe 'Submissions Comment API', type: :request do
include_examples "file uploads api"
def has_query_exemption?; false; end
def preflight(preflight_params)
api_call :post,
"/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}/submissions/#{@student.id}/comments/files",

View File

@ -23,7 +23,9 @@ class TestUserApi
include Api::V1::UserProfile
attr_accessor :services_enabled, :context, :current_user
def service_enabled?(service); @services_enabled.include? service; end
def avatar_image_url(user_id); "avatar_image_url(#{user_id})"; end
def initialize
@domain_root_account = Account.default
end

View File

@ -24,9 +24,13 @@ class TestUserApi
include Api::V1::User
attr_accessor :services_enabled, :context, :current_user, :params, :request
def service_enabled?(service); @services_enabled.include? service; end
def avatar_image_url(*args); "avatar_image_url(#{args.first})"; end
def course_student_grades_url(course_id, user_id); ""; end
def course_user_url(course_id, user_id); ""; end
def initialize
@domain_root_account = Account.default
@params = {}

View File

@ -22,9 +22,11 @@ describe AssignmentGroupsController do
def course_assignment
@assignment = @course.assignments.create(:title => "some assignment")
end
def course_group
@group = @course.assignment_groups.create(:name => "some group")
end
def group_assignment
@assignment = @group.assignments.create(:name => "some group assignment")
end

View File

@ -22,6 +22,7 @@ describe EportfolioEntriesController do
def eportfolio_category
@category = @portfolio.eportfolio_categories.create
end
def eportfolio_entry(category=nil)
@entry = @portfolio.eportfolio_entries.new
@entry.eportfolio_category_id = category.id if category

View File

@ -23,9 +23,11 @@ describe FilesController do
def course_folder
@folder = @course.folders.create!(:name => "a folder", :workflow_state => "visible")
end
def io
fixture_file_upload('scribd_docs/doc.doc', 'application/msword', true)
end
def course_file
@file = factory_with_protected_attributes(@course.attachments, :uploaded_data => io)
end

View File

@ -3,6 +3,7 @@ require 'spec_helper'
module Canvas::Plugins::TicketingSystem
class FakePlugin < BasePlugin
def plugin_id; "fake_plugin"; end
def settings; {setting1: 1, setting2: 2}; end
def export_error(report, conf)

View File

@ -618,12 +618,14 @@ describe SIS::CSV::SectionImporter do
def with_section(&block)
CourseSection.where(root_account_id: @account, sis_source_id: 'S001').first.tap(&block)
end
def check_section_crosslisted(sis_id)
with_section do |s|
expect(s.course.sis_source_id).to eq sis_id
expect(s.nonxlist_course.sis_source_id).to eq 'C001'
end
end
def check_section_not_crosslisted
with_section do |s|
expect(s.course.sis_source_id).to eq 'C001'
@ -689,12 +691,14 @@ describe SIS::CSV::SectionImporter do
def with_section(&block)
CourseSection.where(root_account_id: @account, sis_source_id: 'S001').first.tap(&block)
end
def check_section_crosslisted(sis_id)
with_section do |s|
expect(s.course.sis_source_id).to eq sis_id
expect(s.nonxlist_course.sis_source_id).to eq 'C001'
end
end
def check_section_not_crosslisted
with_section do |s|
expect(s.course.sis_source_id).to eq 'C001'

View File

@ -43,10 +43,13 @@ describe Tour do
end
def self.before_filter(name); true; end
def controller_name; 'controller'; end
def action_name; 'action'; end
def session
{:dismissed_tours => {:dismissed => 1}}
end
def api_request?; false; end
include Tour
end

View File

@ -5,9 +5,11 @@ module MochaRspecAdapter
def setup_mocks_for_rspec
mocha_setup
end
def verify_mocks_for_rspec
mocha_verify
end
def teardown_mocks_for_rspec
mocha_teardown
end

View File

@ -31,7 +31,9 @@ describe ContentTag do
end
def published?; !!@published; end
def unpublished?; !@published; end
def deleted?; @deleted; end
end

View File

@ -23,6 +23,7 @@ class ProtectAttributes
@target = target
!(@target.accessible_attributes.nil? && @target.protected_attributes.nil?)
end
def failure_message
"expected #{@target} to protect attributes"
end

View File

@ -27,6 +27,7 @@ describe Quizzes::LogAuditing::EventAggregator do
end
@qs = @quiz.generate_submission(student_in_course.user)
end
def build_an_event(event_type, event_data, time_step=0)
Quizzes::QuizSubmissionEvent.create do |event|
event.quiz_submission_id = @qs.id
@ -36,6 +37,7 @@ describe Quizzes::LogAuditing::EventAggregator do
event.attempt = @qs.attempt
end
end
def build_out_database_events
event_types = [
Quizzes::QuizSubmissionEvent::EVT_QUESTION_ANSWERED,

View File

@ -8,12 +8,14 @@ describe "jquery ui" do
def active
driver.switch_to.active_element
end
def shift_tab
driver.action.key_down(:shift)
.send_keys(:tab)
.key_up(:shift)
.perform
end
def create_simple_modal
driver.execute_script(<<-JS)
return $('<div><select /><input /></div>')

View File

@ -1419,8 +1419,11 @@ RSpec.configure do |config|
@id = id
@settings = settings
end
def valid_settings?; true; end
def enabled?; true; end
def base; end
end
def web_conference_plugin_mock(id, settings)
@ -1602,12 +1605,19 @@ end
class String
def red; colorize(self, "\e[1m\e[31m"); end
def green; colorize(self, "\e[1m\e[32m"); end
def dark_green; colorize(self, "\e[32m"); end
def yellow; colorize(self, "\e[1m\e[33m"); end
def blue; colorize(self, "\e[1m\e[34m"); end
def dark_blue; colorize(self, "\e[34m"); end
def pur; colorize(self, "\e[1m\e[35m"); end
def colorize(text, color_code) "#{color_code}#{text}\e[0m" end
end

View File

@ -24,6 +24,7 @@ def view_context(context=@course, current_user=@user, real_current_user=nil)
assigns[:real_current_user] = real_current_user
assigns[:domain_root_account] = Account.default
end
def view_portfolio(portfolio=@portfolio, current_user=@user)
assigns[:portfolio] = portfolio
assigns[:current_user] = current_user