This commit is contained in:
sw 2015-01-21 11:58:55 +08:00
commit 0b2fa35a42
8 changed files with 72 additions and 5 deletions

2
.rspec Normal file
View File

@ -0,0 +1,2 @@
--format documentation
--color

View File

@ -111,6 +111,10 @@ module CoursesHelper
#garble count #garble count
# end # end
#获取课程所有成员
def course_member course
course.members
end
# 学生人数计算 # 学生人数计算
# add by nwb # add by nwb
def studentCount course def studentCount course

View File

@ -1,7 +1,9 @@
# Added by young # Added by young
class JournalsForMessageObserver < ActiveRecord::Observer class JournalsForMessageObserver < ActiveRecord::Observer
def after_create(journals_for_message) def after_create(journals_for_message)
thread1 = Thread.start do
Mailer.journals_for_message_add(User.current, journals_for_message).deliver Mailer.journals_for_message_add(User.current, journals_for_message).deliver
end
end end
end end

View File

@ -62,13 +62,13 @@ class Mailer < ActionMailer::Base
course = journals_for_message.jour course = journals_for_message.jour
@author = journals_for_message.user @author = journals_for_message.user
#课程的教师 #课程的教师
@teachers = searchTeacherAndAssistant journals_for_message.jour @members = course_member journals_for_message.jour
#收件人邮箱 #收件人邮箱
@recipients ||= [] @recipients ||= []
@teachers.each do |teacher| @members.each do |teacher|
if teacher.user.notify_about? journals_for_message
@recipients << teacher.user.mail @recipients << teacher.user.mail
end
end end
mail :to => @recipients, mail :to => @recipients,

View File

@ -21,6 +21,16 @@ module RedmineApp
config.verifier_email = "lizanle521@126.com" config.verifier_email = "lizanle521@126.com"
end end
config.generators do |g|
g.test_framework :rspec,
fixtures: true,
view_specs: false,
helper_specs: false,
routing_specs: false,
controller_specs: true,
request_specs: false
g.fixture_replacement :factory_girl, dir: "spec/factories"
end
# Custom directories with classes and modules you want to be autoloadable. # Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += %W(#{config.root}/lib)

View File

@ -0,0 +1,11 @@
class AddInitialProducts < ActiveRecord::Migration
def up
Forum.create(:name =>"new forum", :description => "", :topic_count => "0",
:memo_count => "0", :last_memo_id =>"0", :creator_id =>"2",
:sticky =>"0", :locked =>"0")
end
def down
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150114022710) do ActiveRecord::Schema.define(:version => 20150121030451) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false

38
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,38 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end