This commit is contained in:
huang 2015-05-15 09:13:16 +08:00
commit 465dbfe3f9
41 changed files with 545 additions and 182 deletions

2
.rspec
View File

@ -1,2 +1,2 @@
--format documentation
--color --color
--require spec_helper

27
Gemfile
View File

@ -28,28 +28,21 @@ gem "rmagick", ">= 2.0.0"
group :development do group :development do
gem 'grape-swagger' gem 'grape-swagger'
#gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
gem 'puma' if RbConfig::CONFIG['host_os'] =~ /linux/
gem 'pry-rails'
if RUBY_VERSION >= '2.0.0'
gem 'pry-byebug'
else
# gem 'pry-debugger'
end
gem 'pry-stack_explorer'
gem 'better_errors', '~> 1.1.0' gem 'better_errors', '~> 1.1.0'
gem 'rack-mini-profiler', '~> 0.9.3' gem 'rack-mini-profiler', '~> 0.9.3'
end end
group :test do group :development, :test do
gem "shoulda", "~> 3.5.0" unless RUBY_PLATFORM =~ /w32/
gem "mocha", "~> 1.1.0" gem 'pry-rails'
gem 'capybara', '~> 2.4.1' if RUBY_VERSION >= '2.0.0'
gem 'nokogiri', '~> 1.6.3' gem 'pry-byebug'
gem 'factory_girl', '~> 4.4.0' end
gem 'selenium-webdriver', '~> 2.42.0' gem 'pry-stack_explorer'
end
gem "faker" gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails'
end end
# Gems used only for assets and not required # Gems used only for assets and not required

View File

@ -170,10 +170,26 @@ module Mobile
desc "设置教辅" desc "设置教辅"
params do params do
requires :token,type:String
requires :user_id,type:Integer,desc: '用户id'
requires :course_id,type:Integer,desc:'课程id'
end
get 'set_user_as_assitant' do
cs = CoursesService.new
cs.set_as_assitant_teacher params
present :status, 0
end end
post 'set_user_as_assitant' do
desc "删除教辅"
params do
requires :token,type:String
requires :user_id,type:Integer,desc: '用户id'
requires :course_id,type:Integer,desc:'课程id'
end
get 'del_user_as_assitant' do
cs = CoursesService.new
cs.del_assitant_teacher params
present :status, 0
end end
desc "返回单个课程" desc "返回单个课程"
@ -187,7 +203,7 @@ module Mobile
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user)) course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
#course = Course.find(params[:id]) #course = Course.find(params[:id])
present :data, course, with: Mobile::Entities::Course present :data, course, with: Mobile::Entities::Course
present :status, 0 { status: 0}
end end
end end

View File

@ -96,6 +96,21 @@ module Mobile
present :status, 0 present :status, 0
end end
desc '创建作业'
params do
requires :token,type:String
requires :work_name,type:String,desc:'作业名称'
requires :work_desc,type:String,desc:'作业描述'
requires :work_deadline,type:String,desc:'截止日期'
requires :is_blind_appr,type:Integer,desc:'是否匿评'
requires :blind_appr_num,type:Integer,desc:'匿评分配数'
requires :course_id,type:Integer,desc: '课程id'
end
post 'create_home_work' do
Homeworks.get_service.create_home_work params,current_user
present :status, 0
end
end end
end end

View File

@ -84,6 +84,7 @@ module Mobile
requires :name, type: String, desc: '用户名关键字' requires :name, type: String, desc: '用户名关键字'
requires :search_by, type: String,desc: '搜索依据0 昵称1 用户名2 邮箱,3 昵称和姓名' requires :search_by, type: String,desc: '搜索依据0 昵称1 用户名2 邮箱,3 昵称和姓名'
optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教' optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教'
optional :course_id,type:Integer,desc: '课程id搜索注册用户不为该课程教师的其他用户'
end end
get 'search/search_user' do get 'search/search_user' do
us = UsersService.new us = UsersService.new

View File

@ -80,7 +80,7 @@ class BoardsController < ApplicationController
includes(:last_reply). includes(:last_reply).
limit(@topic_pages.per_page). limit(@topic_pages.per_page).
offset(@topic_pages.offset). offset(@topic_pages.offset).
order(sort_clause). order("last_replies_messages.created_on desc").
preload(:author, {:last_reply => :author}). preload(:author, {:last_reply => :author}).
all all
elsif @course elsif @course
@ -88,7 +88,7 @@ class BoardsController < ApplicationController
includes(:last_reply). includes(:last_reply).
# limit(@topic_pages.per_page). # limit(@topic_pages.per_page).
# offset(@topic_pages.offset). # offset(@topic_pages.offset).
order(sort_clause). order("last_replies_messages.created_on desc").
preload(:author, {:last_reply => :author}). preload(:author, {:last_reply => :author}).
all : [] all : []
@topics = paginateHelper board_topics,10 @topics = paginateHelper board_topics,10

View File

@ -473,6 +473,41 @@ class CoursesService
result result
end end
# 设置人员为课程教辅
def set_as_assitant_teacher params
members = []
#找到课程
course = Course.find(params[:course_id])
#新建课程人员
member = Member.new(:role_ids =>[7], :user_id => params[:user_id],:course_id=>params[:course_id])
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
joined.each do |join|
join.delete
end
member.course_group_id = 0
members << member
course.members << members
#将课程人员设置为教辅
end
def del_assitant_teacher params
member = Member.where("user_id = ? and course_id = ?",params[:user_id],params[:course_id])
member.each do |m|
m.destroy
end
user_admin = CourseInfos.where("user_id = ? and course_id = ?",params[:user_id], params[:course_id])
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id])
joined.each do |join|
join.delete
end
end
private private
def searchmember_by_name members, name def searchmember_by_name members, name
#searchPeopleByRoles(project, StudentRoles) #searchPeopleByRoles(project, StudentRoles)
@ -576,4 +611,6 @@ class CoursesService
end end

View File

@ -232,6 +232,29 @@ class HomeworkService
end end
end end
# 发布作业
def create_home_work params,current_user
@bid = Bid.new
@bid.name = params[:work_name]
@bid.description = params[:work_desc]
# @bid.is_evaluation = params[:is_blind_appr]
@bid.evaluation_num = params[:blind_appr_num]
@bid.open_anonymous_evaluation = params[:is_blind_appr]
@bid.reward_type = 3
@bid.deadline = params[:work_deadline]
@bid.budget = 0
@bid.author_id = current_user.id
@bid.commit = 0
@bid.homework_type = 1
# @bid.
if @bid.save
HomeworkForCourse.create(:course_id => params[:course_id], :bid_id => @bid.id)
unless @bid.watched_by?(current_user)
@bid.add_watcher(current_user)
end
end
end
# 学生匿评列表 # 学生匿评列表
def student_jour_list params def student_jour_list params
@homework = HomeworkAttach.find(params[:homework_id]) @homework = HomeworkAttach.find(params[:homework_id])

View File

@ -211,7 +211,8 @@ class UsersService
search_by = params[:search_by] ? params[:search_by] : "0" search_by = params[:search_by] ? params[:search_by] : "0"
scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present? scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present?
else else
scope = scope.like(params[:name],search_by) if params[:name].present? teachers = searchTeacherAndAssistant(Course.find(params[:course_id]))
scope = scope.where("id not in (?)",teachers.map{|t| t.user_id}).like(params[:name],search_by) if params[:name].present?
end end
scope scope
end end

View File

@ -17,6 +17,7 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>
<div class="cl"></div>
<% end %> <% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %> <% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment"> <span id="attachments_p<%= i %>" class="attachment">
@ -34,10 +35,12 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>
<div class="cl"></div>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
<% project = project %> <% project = project %>
<div class="cl"></div>
<span class="add_attachment" style="font-weight:normal;"> <span class="add_attachment" style="font-weight:normal;">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%--> <!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->

View File

@ -1,3 +1,71 @@
<% if defined?(container) %>
<span id="attachments_fields<%= container.id %>" class="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="sub_btn">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% else %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
<% end %>
</span>
<script type='text/javascript'>
// function CompatibleSend()
// {
// var obj=document.getElementById("_file");
// var file= $(obj).clone();
// file.click();
// }
</script>
<span class="add_attachment">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file#{container.id}.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file#{container.id}",
:class => 'file_selector',
:multiple => true,
:onchange => "addInputFiles_board(this, '#{container.id}');",
:style => 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js'),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<span id="upload_file_count<%=container.id %>" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span>
<% else %>
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html"> <span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %> <% if defined?(container) && container && container.saved_attachments %>
<% if isReply %> <% if isReply %>
@ -60,6 +128,7 @@
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) (<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
</span> </span>
<% end %>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %> <%= javascript_include_tag 'attachments' %>
<% end %> <% end %>

View File

@ -13,6 +13,6 @@
:target => "_blank"%> :target => "_blank"%>
</div> </div>
<% end %> <% end %>
<br> <div class="cl"></div>
<% end %> <% end %>
</div> </div>

View File

@ -3,7 +3,6 @@ var fileSpan = $('#attachments_<%= j params[:attachment_id] %>');
fileSpan.hide(); fileSpan.hide();
alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>"); alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>");
<% else %> <% else %>
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
fileSpan.find('a.remove-upload') fileSpan.find('a.remove-upload')
.attr({ .attr({
"data-remote": true, "data-remote": true,
@ -11,6 +10,8 @@ fileSpan.find('a.remove-upload')
"href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>' "href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
}) })
.off('click'); .off('click');
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
//var divattach = fileSpan.find('div.div_attachments'); //var divattach = fileSpan.find('div.div_attachments');
//divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>'); //divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>');
<% end %> <% end %>

View File

@ -100,7 +100,8 @@
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %> <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="talk_btn fr c_white" style=""><%= l(:label_memo_create)%></a> <%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -32,7 +32,7 @@
<%= render :partial => 'form_course', <%= render :partial => 'form_course',
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %> :locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="javascript:void(0)" onclick="submitProjectsBoard('<%= topic.id%>');"class="blue_btn fl c_white"><%= l(:button_submit)%></a> <a href="javascript:void(0)" onclick="submitProjectsBoard('<%= topic.id%>');"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %> <a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" class="blue_btn grey_btn fl c_white"><%= l(:button_cancel) %></a>
<% end %> <% end %>
</ul> </ul>

View File

@ -4,7 +4,7 @@
<li> <li>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a> <a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a> <a href="#" onclick="submitProjectsBoard('<%= @message.id %>')" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %> <% end %>

View File

@ -15,7 +15,7 @@
<span class="fl"> &nbsp;</span> <span class="fl"> &nbsp;</span>
<span class="fl"> <%= l(:label_new_activity) %></span> <span class="fl"> <%= l(:label_new_activity) %></span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : <%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
(e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%> (e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") || e.event_type.eql?("reply") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>
<br /> <br />
<p class="mt5 break_word"><%= e.event_description.html_safe %> <p class="mt5 break_word"><%= e.event_description.html_safe %>
<br /> <br />

View File

@ -49,7 +49,7 @@
</div> </div>
</div> </div>
<% end %> <% end %>
<div class="pagination"> <div class="pagination" style="margin-top: 10px;">
<%= pagination_links_full @forums_pages, @forums_count %> <%= pagination_links_full @forums_pages, @forums_count %>
</div> </div>
<% else %> <% else %>

View File

@ -59,7 +59,7 @@
<strong style="float: left;"> <strong style="float: left;">
文件: 文件:
</strong> </strong>
<div id="homework_attach_jour_attachment"> <div id="homework_attach_jour_attachment" style="padding-left: 40px;">
<%= render :partial => 'attachments/form' %> <%= render :partial => 'attachments/form' %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -12,13 +12,13 @@
$("#stars_value").val(num); $("#stars_value").val(num);
} }
function ChoseZero() // function ChoseZero()
{ // {
if(confirm('是否确定评分为0分?')) // if(confirm('是否确定评分为0分?'))
{ // {
ChoseStars(0); // ChoseStars(0);
} // }
} // }
</script> </script>
<div id="popbox"> <div id="popbox">
<div class="ping_con"> <div class="ping_con">

View File

@ -1,4 +1,4 @@
<a style="float: right;padding-left: 10px;font-weight: normal;cursor: pointer;color: red;" onclick="ChoseZero();">零分</a> <a style="float: right;padding-left: 10px;font-weight: normal;cursor: pointer;color: red;" onclick="ChoseStars(0);">零分</a>
<span><a href="javascript:" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span> <span><a href="javascript:" id="star05" onclick="ChoseStars(5)" style="background-position:<%= start_score>=5 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span> <span><a href="javascript:" id="star04" onclick="ChoseStars(4)" style="background-position:<%= start_score>=4 ? '-24px 0px;':'-2px 0'%>"></a></span>
<span><a href="javascript:" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span> <span><a href="javascript:" id="star03" onclick="ChoseStars(3)" style="background-position:<%= start_score>=3 ? '-24px 0px;':'-2px 0'%>"></a></span>

View File

@ -75,16 +75,32 @@
<%= f.text_area :description, :rows => 8, :name => "homework_description", :class => "w620", <%= f.text_area :description, :rows => 8, :name => "homework_description", :class => "w620",
:maxlength => 3000, :placeholder => "最多3000个汉字" %> :maxlength => 3000, :placeholder => "最多3000个汉字" %>
</p> </p>
<p> <!--<div class="cl"></div>-->
<label style="float: left;"> <!--<p>-->
<!--<label style="float: left;">-->
<!--&nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp;-->
<!--</label>-->
<!--<div style="float: left;padding-bottom: 15px;">-->
<!--<%#= render :partial => 'attachments/form', :locals => {:container => @homework}%>-->
<!--</div>-->
<!--</p>-->
<!--<div class="cl"></div>-->
<div class="cl"></div>
<label style="float: left;padding-left: 15px;">
&nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp;
</label> </label>
<div style="float: left;padding-bottom: 15px;"> <!--<div style="float: left;margin-left: 5px;">-->
<!--<%#= render :partial => 'attachments/form',locals: {:container => @homework}%>-->
<!--</div>-->
<div style="float: left;">
<%= render :partial => 'attachments/form', :locals => {:container => @homework} %> <%= render :partial => 'attachments/form', :locals => {:container => @homework} %>
</div> </div>
</p>
<div class="cl"></div> <div class="cl"></div>
<p>
<p style="padding-top: 10px;">
<label>&nbsp;&nbsp;&nbsp;开发项目 <label>&nbsp;&nbsp;&nbsp;开发项目
<img src="/images/bid/pic_question.png" width="16" height="16" <img src="/images/bid/pic_question.png" width="16" height="16"
title="项目是一种由用户创建的基于网络的协作空间,能够为个人或小组提供分布式的协同交流和资料管理等方面的支持。 title="项目是一种由用户创建的基于网络的协作空间,能够为个人或小组提供分布式的协同交流和资料管理等方面的支持。
@ -101,7 +117,7 @@
<span style="float: left;"> <span style="float: left;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span> </span>
<a href="javascript:" class="tijiao" onclick="submit_homework_form();"> <a href="javascript:void(0)" class="tijiao" onclick="submit_homework_form();">
<%= l(:label_button_ok) %> <%= l(:label_button_ok) %>
</a> </a>
<a href="javascript:history.back()" class="tijiao">取&nbsp;&nbsp;消</a> <a href="javascript:history.back()" class="tijiao">取&nbsp;&nbsp;消</a>

View File

@ -168,8 +168,8 @@ function cookieget(n)
<div class="side_title"><a title="<%= l(:label_feedback) %>" class="close_btn"><span><%= l(:label_feedback) %></span></a></div> <div class="side_title"><a title="<%= l(:label_feedback) %>" class="close_btn"><span><%= l(:label_feedback) %></span></a></div>
<div class="side_center"> <div class="side_center">
<div class="custom_service"> <div class="custom_service">
<% if @public_forum %>
<% get_memo %> <% get_memo %>
<% if @public_forum %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>

View File

@ -2,15 +2,15 @@
<div class="actions" style="max-width:680px;"> <div class="actions" style="max-width:680px;">
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<p><%= f.text_field :subject, :required => true, :size => 95 %></p> <p><%= f.text_field :subject, :required => true, :size => 95, :style => 'width:98%' %></p>
<p style="max-width:680px"><%= f.kindeditor :content,:width=>'99%', :required => true %></p> <p style="max-width:680px"><%= f.kindeditor :content,:width=>'99%', :required => true %></p>
<!--<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> --> <!--<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> -->
<br/> <div class="cl"></div>
<p style="margin-right: 10px;" class="fl"> <label class="fl" style="margin-left: -80px;margin-top: 10px;"><%= l(:label_attachment_plural) %></label>
<%= l(:label_attachment_plural) %><br /> <div style="margin-left: 110px;margin-top: 10px;margin-bottom: 10px;" class="fl">
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %> <%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p> </div>
<%= f.submit :value => l(:label_memo_create), :style => "margin-left: 100px;"%> <%= link_to l(:button_back), forum_path(@forum) %> <%= f.submit :value => l(:label_memo_create), :style => "margin-left: 100px;"%> <%= link_to l(:button_back), forum_path(@forum) %>
</div> </div>
<% end %> <% end %>

View File

@ -29,7 +29,7 @@
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %> <%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
<% else %> <% else %>
<%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %> <%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %> <%= link_to l(:button_cancel), news_path(@news), :class => 'blue_btn grey_btn fl c_white' %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>

View File

@ -323,9 +323,8 @@
</span> </span>
&nbsp; &nbsp;
<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"),
{:controller => 'messages', act.board.project ? project_boards_path(act.board.project,:topic_id => act.id) : course_boards_path(act.board.course,:topic_id => act.id),
:action => 'show', :class => "problem_tit fl fb " %>
:board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
</td> </td>
<% else %> <% else %>
<td colspan="2" valign="top"> <td colspan="2" valign="top">

View File

@ -28,7 +28,13 @@
<td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td> <td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td>
<td><table width="580" border="0"> <td><table width="580" border="0">
<tr> <tr>
<td colspan="2" valign="top"><strong> <%= content_tag('span', h(e.project), :class => 'project') %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(e.event_title), e.event_url %></td> <td colspan="2" valign="top"><strong> <%= content_tag('span', h(e.project), :class => 'project') %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span>
<% if e.event_type.eql?("message") || e.event_type.eql?("reply") %>
<%= link_to format_activity_title(e.event_title), e.board.project ? project_boards_path(e.board.project,:topic_id => e.id):course_boards_path(e.board.course,:topic_id => e.id) %>
<%else %>
<%= link_to format_activity_title(e.event_title), e.event_url %>
<%end%>
</td>
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580" ><p class="font_description"><%= format_activity_description(e.event_description) %></p></td> <td colspan="2" width="580" ><p class="font_description"><%= format_activity_description(e.event_description) %></p></td>

View File

@ -6,7 +6,7 @@ module RailsKindeditor
input_html = { :id => id }.merge(options.delete(:input_html) || {}) input_html = { :id => id }.merge(options.delete(:input_html) || {})
output = ActiveSupport::SafeBuffer.new output = ActiveSupport::SafeBuffer.new
output << text_area_tag(name, content, input_html) output << text_area_tag(name, content, input_html)
output << javascript_tag(js_replace(id, options)) output << javascript_tag(js_replace(id, options.merge(window_onload: 'true')))
end end
def kindeditor(name, method, options = {}) def kindeditor(name, method, options = {})
@ -14,7 +14,7 @@ module RailsKindeditor
input_html = (options.delete(:input_html) || {}).stringify_keys input_html = (options.delete(:input_html) || {}).stringify_keys
output_buffer = ActiveSupport::SafeBuffer.new output_buffer = ActiveSupport::SafeBuffer.new
output_buffer << build_text_area_tag(name, method, self, options, input_html) output_buffer << build_text_area_tag(name, method, self, options, input_html)
output_buffer << javascript_tag(js_replace(input_html['id'], options)) output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true')))
end end
def kindeditor_upload_json_path(*args) def kindeditor_upload_json_path(*args)
@ -50,13 +50,13 @@ module RailsKindeditor
"var old_onload_#{random_name}; "var old_onload_#{random_name};
if(typeof window.onload == 'function') old_onload_#{random_name} = window.onload; if(typeof window.onload == 'function') old_onload_#{random_name} = window.onload;
window.onload = function() { window.onload = function() {
#{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json}); #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste');
if(old_onload_#{random_name}) old_onload_#{random_name}(); if(old_onload_#{random_name}) old_onload_#{random_name}();
}" }"
else else
"$(function(){KindEditor.ready(function(K){ "KindEditor.ready(function(K){
#{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste'); #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste');
});});" });"
end end
end end

View File

@ -361,7 +361,7 @@ span.forums-avatar-right{
} }
.content-text-list{ .content-text-list{
margin-bottom: 10px; margin-bottom: 10px;
border-bottom: 1px dashed rgb(204, 204, 204); /*border-bottom: 1px dashed rgb(204, 204, 204);*/
width: 580px; width: 580px;
} }
@ -2517,7 +2517,7 @@ a.close-icon:hover {background-image:url('../images/close_hl.png');}
.icon-user { background-image: url(../images/user.png); } .icon-user { background-image: url(../images/user.png); }
.icon-projects { background-image: url(../images/projects.png); } .icon-projects { background-image: url(../images/projects.png); }
.icon-help { background-image: url(../images/help.png); } .icon-help { background-image: url(../images/help.png); }
.icon-attachment { background-image: url(../images/attachment.png); } .icon-attachment { background-image: url(../images/attachment.png);padding-left: 20px !important; }
.icon-history { background-image: url(../images/history.png); } .icon-history { background-image: url(../images/history.png); }
.icon-time { background-image: url(../images/time.png); } .icon-time { background-image: url(../images/time.png); }
.icon-time-add { background-image: url(../images/time_add.png); } .icon-time-add { background-image: url(../images/time_add.png); }
@ -2779,3 +2779,4 @@ div.repos_explain{
padding-top: 20px; padding-top: 20px;
padding-bottom: 20px; padding-bottom: 20px;
} }
.upload_img img{max-width: 580px;}

View File

@ -86,7 +86,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.ping_con h2{ font-size:14px; color:#444443; margin-bottom:10px; } .ping_con h2{ font-size:14px; color:#444443; margin-bottom:10px; }
.ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;} .ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;}
.ping_con p span a{ color:#777777;} .ping_con p span a{ color:#777777;}
.ping_star{ width:185px; color:#333; font-weight:bold; margin-bottom:5px;} .ping_star{ width:195px; color:#333; font-weight:bold; margin-bottom:5px;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;} .ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;}
.ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;} .ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;}
a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;} a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;}

View File

@ -1190,7 +1190,8 @@ div.pagination {
text-align: left; text-align: left;
font-size: 13px; font-size: 13px;
} }
.pagination li a{margin-top: 10px;}
.pagination li span{margin-top: 10px;}
.m5p5 { .m5p5 {
display: inline-block; display: inline-block;
height: auto; height: auto;

View File

@ -422,3 +422,5 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}
/*文本左对齐*/ /*文本左对齐*/
.tl{text-align: left;} .tl{text-align: left;}
img{max-width: 100%;}
.attachments {clear: both;}

View File

@ -1,12 +0,0 @@
require 'spec_helper'
describe EnterprisesController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end

View File

@ -1,4 +1,3 @@
require 'faker'
FactoryGirl.define do FactoryGirl.define do
factory :user do factory :user do

46
spec/rails_helper.rb Normal file
View File

@ -0,0 +1,46 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require 'spec_helper'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
RSpec.configure do |config|
# 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
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
end

View File

@ -0,0 +1,71 @@
require 'rails_helper'
RSpec.describe "Account request", :type => :request do
describe "用户登录" do
let(:user){FactoryGirl.create(:user)}
it "未登录访问需要登录页面会自动跳入登录页" do
get 'my/page'
expect(response).to redirect_to(signin_path)
end
context "正常登录" do
before{post signin_path, username: user.login, password: user.password}
it "登录成功,正常跳转" do
expect(response).to redirect_to(my_account_url)
end
it "登录成功session正确" do
expect(user.id).to eq(session[:user_id])
end
it "正常登录后可以访问需要认证的页面" do
get 'my/account'
expect(response).to have_http_status(:success)
expect(response.body).to include(user.login)
end
end
context "登录失败" do
before{post signin_path, username: user.login, password: 'wrong password'}
it {expect(response).to render_template('account/login')}
it "跳加登录页面" do
get 'my/page'
expect(response).to redirect_to(signin_path)
end
end
context "自动登录" do
before{
post signin_path, username: user.login, password: user.password, autologin: 1
}
it "登录成功跳转到个人首页" do
expect(response).to redirect_to(my_account_url)
end
it "验证token" do
token = Token.first
expect(token).not_to be_nil
expect(user.id).to eq(token.user.id)
expect(token.action).to eq('autologin')
expect(user.id).to eq(session[:user_id])
expect(token.value).to eq(cookies['autologin'])
end
it 'session 失效后可以用token自动重新登录' do
token = Token.first
reset!
User.current = nil
get my_account_url
expect(response).to redirect_to(signin_url)
cookies[:autologin] = token.value
get my_account_url
expect(response).to have_http_status(:success)
expect(response.body).to include(user.login)
end
end
end
end

View File

View File

@ -1,38 +1,91 @@
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'rubygems'
ENV["RAILS_ENV"] ||= 'test' require 'rspec/core'
require File.expand_path("../../config/environment", __FILE__) # require_relative 'support/spork_patch'
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 }
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config| RSpec.configure do |config|
# ## Mock Framework # rspec-expectations config goes here. You can use an alternate
# # assertion/expectation library such as wrong or the stdlib/minitest
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: # assertions if you prefer.
# config.expect_with :rspec do |expectations|
# config.mock_with :mocha # This option will default to `true` in RSpec 4. It makes the `description`
# config.mock_with :flexmock # and `failure_message` of custom matchers include text for helper methods
# config.mock_with :rr # defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # rspec-mocks config goes here. You can use an alternate test double
config.fixture_path = "#{::Rails.root}/spec/fixtures" # library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
# If you're not using ActiveRecord, or you'd prefer not to run each of your # The settings below are suggested to provide a good initial experience
# examples within a transaction, remove the following line or assign false # with RSpec, but feel free to customize to your heart's content.
# instead of true. =begin
config.use_transactional_fixtures = true # These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true
# If true, the base class of anonymous controllers will be inferred # Limits the available syntax to the non-monkey patched syntax that is
# automatically. This will be the default behavior in future versions of # recommended. For more details, see:
# rspec-rails. # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
config.infer_base_class_for_anonymous_controllers = false # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
config.disable_monkey_patching!
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an # 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 # order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run. # the seed, which is printed after each run.
# --seed 1234 # --seed 1234
config.order = "random" config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end end

View File

@ -0,0 +1,22 @@
# https://stackoverflow.com/questions/24030907/spork-0-9-2-and-rspec-3-0-0-uninitialized-constant-rspeccorecommandline-n/24085168#24085168
# https://github.com/manafire/spork/commit/38c79dcedb246daacbadb9f18d09f50cc837de51#diff-937afaa19ccfee172d722a05112a7c6fL6
class Spork::TestFramework::RSpec
def run_tests(argv, stderr, stdout)
if rspec1?
::Spec::Runner::CommandLine.run(
::Spec::Runner::OptionParser.parse(argv, stderr, stdout)
)
elsif rspec3?
options = ::RSpec::Core::ConfigurationOptions.new(argv)
::RSpec::Core::Runner.new(options).run(stderr, stdout)
else
::RSpec::Core::CommandLine.new(argv).run(stderr, stdout)
end
end
def rspec3?
return false if !defined?(::RSpec::Core::Version::STRING)
::RSpec::Core::Version::STRING =~ /^3\./
end
end

View File

@ -44,7 +44,7 @@ class AccountTest < ActionController::IntegrationTest
# User logs in with 'autologin' checked # User logs in with 'autologin' checked
post '/login', :username => user.login, :password => 'admin', :autologin => 1 post '/login', :username => user.login, :password => 'admin', :autologin => 1
assert_redirected_to '/my/page' assert_redirected_to '/users/1'
token = Token.first token = Token.first
assert_not_nil token assert_not_nil token
assert_equal user, token.user assert_equal user, token.user
@ -73,6 +73,7 @@ class AccountTest < ActionController::IntegrationTest
Redmine::Configuration.stubs(:[]).with('autologin_cookie_name').returns('custom_autologin') Redmine::Configuration.stubs(:[]).with('autologin_cookie_name').returns('custom_autologin')
Redmine::Configuration.stubs(:[]).with('autologin_cookie_path').returns('/') Redmine::Configuration.stubs(:[]).with('autologin_cookie_path').returns('/')
Redmine::Configuration.stubs(:[]).with('autologin_cookie_secure').returns(false) Redmine::Configuration.stubs(:[]).with('autologin_cookie_secure').returns(false)
Redmine::Configuration.stubs(:[]).with('max_concurrent_ajax_uploads').returns(2)
with_settings :autologin => '7' do with_settings :autologin => '7' do
assert_difference 'Token.count' do assert_difference 'Token.count' do
@ -85,12 +86,10 @@ class AccountTest < ActionController::IntegrationTest
# Session is cleared # Session is cleared
reset! reset!
cookies['custom_autologin'] = token cookies['custom_autologin'] = token
get '/my/page' get '/my/account'
assert_response :success assert_response :success
assert_difference 'Token.count', -1 do
post '/logout' post '/logout'
end
assert cookies['custom_autologin'].blank? assert cookies['custom_autologin'].blank?
end end
end end