parent
							
								
									fd426936bb
								
							
						
					
					
						commit
						02a03f7c54
					
				@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					one:
 | 
				
			||||||
 | 
					  parent_id: 1
 | 
				
			||||||
 | 
					  forum_id: 1
 | 
				
			||||||
 | 
					  subject: MyString
 | 
				
			||||||
 | 
					  content: MyText
 | 
				
			||||||
 | 
					  author_id: 1
 | 
				
			||||||
 | 
					  replies_count: 1
 | 
				
			||||||
 | 
					  last_reply_id: 1
 | 
				
			||||||
 | 
					  lock: false
 | 
				
			||||||
 | 
					  sticky: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					two:
 | 
				
			||||||
 | 
					  parent_id: 1
 | 
				
			||||||
 | 
					  forum_id: 1
 | 
				
			||||||
 | 
					  subject: MyString
 | 
				
			||||||
 | 
					  content: MyText
 | 
				
			||||||
 | 
					  author_id: 1
 | 
				
			||||||
 | 
					  replies_count: 1
 | 
				
			||||||
 | 
					  last_reply_id: 1
 | 
				
			||||||
 | 
					  lock: false
 | 
				
			||||||
 | 
					  sticky: false
 | 
				
			||||||
@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					person_one_extra:
 | 
				
			||||||
 | 
					  id: 44
 | 
				
			||||||
 | 
					  user_id: 29
 | 
				
			||||||
 | 
					  birthday: "2013-09-30 21:19:25"
 | 
				
			||||||
 | 
					  brief_introduction: nil
 | 
				
			||||||
 | 
					  gender: 1
 | 
				
			||||||
 | 
					  location: "江苏"
 | 
				
			||||||
 | 
					  occupation: ""
 | 
				
			||||||
 | 
					  work_experience: nil
 | 
				
			||||||
 | 
					  zip_code: nil
 | 
				
			||||||
 | 
					  created_at: "2013-09-30 21:19:25"
 | 
				
			||||||
 | 
					  updated_at: "2013-10-09 19:00:06"
 | 
				
			||||||
 | 
					  technical_title: nil
 | 
				
			||||||
 | 
					  identity: 2
 | 
				
			||||||
 | 
					  student_id: nil
 | 
				
			||||||
 | 
					  teacher_realname: nil
 | 
				
			||||||
 | 
					  student_realname: nil
 | 
				
			||||||
 | 
					  location_city: "南京"
 | 
				
			||||||
@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					person_one:
 | 
				
			||||||
 | 
					  id: 29
 | 
				
			||||||
 | 
					  login: "yanxd"
 | 
				
			||||||
 | 
					  hashed_password: "432257ccaebe6b33158a88b2db2135796505762b"
 | 
				
			||||||
 | 
					  firstname: "Inc."
 | 
				
			||||||
 | 
					  lastname: "yan"
 | 
				
			||||||
 | 
					  mail: "test@hotmail.com"
 | 
				
			||||||
 | 
					  admin: 0
 | 
				
			||||||
 | 
					  status: 1
 | 
				
			||||||
 | 
					  last_login_on: "2014-02-17 08:27:52"
 | 
				
			||||||
 | 
					  language: "zh"
 | 
				
			||||||
 | 
					  auth_source_id: nil
 | 
				
			||||||
 | 
					  created_on: "2013-07-11 08:33:38"
 | 
				
			||||||
 | 
					  updated_on: "2013-10-25 09:37:40"
 | 
				
			||||||
 | 
					  type: "User"
 | 
				
			||||||
 | 
					  identity_url: nil
 | 
				
			||||||
 | 
					  mail_notification: "only_my_events"
 | 
				
			||||||
 | 
					  salt: "84dc6508506671255b120d28e348f3ad"
 | 
				
			||||||
@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class MemosControllerTest < ActionController::TestCase
 | 
				
			||||||
 | 
					  # test "the truth" do
 | 
				
			||||||
 | 
					  #   assert true
 | 
				
			||||||
 | 
					  # end
 | 
				
			||||||
 | 
					  def test_memo_create_fail
 | 
				
			||||||
 | 
					  	memo = Memo.create(:subject => nil)
 | 
				
			||||||
 | 
					  	assert true
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TestControllerTest < ActionController::TestCase
 | 
				
			||||||
 | 
					  # test "the truth" do
 | 
				
			||||||
 | 
					  #   assert true
 | 
				
			||||||
 | 
					  # end
 | 
				
			||||||
 | 
					  test "get test index error" do
 | 
				
			||||||
 | 
					  	@request.env["REQUEST_URI"] = ""
 | 
				
			||||||
 | 
					  	get :index
 | 
				
			||||||
 | 
					  	assert_template :index
 | 
				
			||||||
 | 
					  	# assert_template layout: "layouts/base", partial: ["layouts/base_header","_base_header", 'layouts/base_footer', "_base_footer",]
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class UsersControllerTest < ActionController::TestCase
 | 
				
			||||||
 | 
					  def setup
 | 
				
			||||||
 | 
					  	initial_user_controller
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  def teardown
 | 
				
			||||||
 | 
					  	teardown_user_controller
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  test "test user valid" do
 | 
				
			||||||
 | 
					  	assert @user.valid?, "user valid."
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  test "get user_courses page" do
 | 
				
			||||||
 | 
					  	get :user_courses, {:id => @user.id}
 | 
				
			||||||
 | 
					  	assert_response :success
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def initial_user_controller
 | 
				
			||||||
 | 
					  	@user = users(:person_one)
 | 
				
			||||||
 | 
					  	# @user_extra = user_extensions(:person_one_extra)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def teardown_user_controller
 | 
				
			||||||
 | 
					  	@user = nil
 | 
				
			||||||
 | 
					  	# @user_extra = nil
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					require 'rails/performance_test_help'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class BrowsingTest < ActionDispatch::PerformanceTest
 | 
				
			||||||
 | 
					  # Refer to the documentation for all available options
 | 
				
			||||||
 | 
					  # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
 | 
				
			||||||
 | 
					  #                          :output => 'tmp/performance', :formats => [:flat] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_homepage
 | 
				
			||||||
 | 
					    get '/'
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					ENV["RAILS_ENV"] = "test"
 | 
				
			||||||
 | 
					require File.expand_path('../../config/environment', __FILE__)
 | 
				
			||||||
 | 
					require 'rails/test_help'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ActiveSupport::TestCase
 | 
				
			||||||
 | 
					  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
 | 
				
			||||||
 | 
					  #
 | 
				
			||||||
 | 
					  # Note: You'll currently still have to declare fixtures explicitly in integration tests
 | 
				
			||||||
 | 
					  # -- they do not yet inherit this setting
 | 
				
			||||||
 | 
					  fixtures :all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Add more helper methods to be used by all tests here...
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					require File.expand_path('../../../test_helper', __FILE__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class CoursesHelperTest < ActionView::TestCase
 | 
				
			||||||
 | 
						include CoursesHelper
 | 
				
			||||||
 | 
						# test "test truth" do
 | 
				
			||||||
 | 
						# 	@project = Project.find_by_id 6834
 | 
				
			||||||
 | 
						# 	teacherNum = teacherCount @project
 | 
				
			||||||
 | 
						# 	studentNum = studentCount @project
 | 
				
			||||||
 | 
						# 	assert_equal 1, teacherNum
 | 
				
			||||||
 | 
						# 	assert_equal 5, studentNum
 | 
				
			||||||
 | 
						# end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class MemosHelperTest < ActionView::TestCase
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class StoresHelperTest < ActionView::TestCase
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TestHelperTest < ActionView::TestCase
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					require 'test_helper'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class MemoTest < ActiveSupport::TestCase
 | 
				
			||||||
 | 
					  test "the truth" do
 | 
				
			||||||
 | 
					    assert true
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_the_truth
 | 
				
			||||||
 | 
					  	assert true
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  test "should not save memo without content" do
 | 
				
			||||||
 | 
					  	memo = Memo.new
 | 
				
			||||||
 | 
					  	assert !memo.save, "assert, save memo without content."
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue