Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
	
		
	
				
					
				
			
						commit
						4494e5cd64
					
				@ -1,6 +1,6 @@
 | 
				
			||||
<!--added by huang-->
 | 
				
			||||
<%#= watcher_link_issue(@issue, User.current) %>
 | 
				
			||||
<%#= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %>
 | 
				
			||||
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %>
 | 
				
			||||
<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %>
 | 
				
			||||
<%= link_to l(:button_edit), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("all_attributes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project)  %>
 | 
				
			||||
<%= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project)  %>
 | 
				
			||||
 | 
				
			||||
@ -1,47 +0,0 @@
 | 
				
			||||
<% @nav_dispaly_project_label = 1
 | 
				
			||||
   @nav_dispaly_forum_label = 1 %>
 | 
				
			||||
<!DOCTYPE html>
 | 
				
			||||
<html lang="<%= current_language %>">
 | 
				
			||||
<head>
 | 
				
			||||
  <meta charset="utf-8" />
 | 
				
			||||
  <title><%=h html_title %></title>
 | 
				
			||||
  <meta name="description" content="<%= Redmine::Info.app_name %>" />
 | 
				
			||||
  <meta name="keywords" content="issue,bug,tracker" />
 | 
				
			||||
  <%= csrf_meta_tag %>
 | 
				
			||||
  <%= favicon %>
 | 
				
			||||
  <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
 | 
				
			||||
  <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
 | 
				
			||||
  <%= javascript_heads %>
 | 
				
			||||
  <%= javascript_include_tag "jquery.leanModal.min" %>
 | 
				
			||||
  <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
 | 
				
			||||
  <%= heads_for_theme %>
 | 
				
			||||
  <%= call_hook :view_layouts_base_html_head %>
 | 
				
			||||
  <!-- page specific tags -->
 | 
				
			||||
  <%= yield :header_tags -%>
 | 
				
			||||
</head>
 | 
				
			||||
<body class="<%=h body_css_classes %>">
 | 
				
			||||
<div id="wrapper">
 | 
				
			||||
  <div id="wrapper2">
 | 
				
			||||
    <div id="wrapper3">
 | 
				
			||||
      <%=render :partial => 'layouts/base_header'%>
 | 
				
			||||
      <div id="main" class="nosidebar">
 | 
				
			||||
        <div id="content_">
 | 
				
			||||
          <%= render_flash_messages %>
 | 
				
			||||
          <%= yield %>
 | 
				
			||||
          <%= call_hook :view_layouts_base_content %>
 | 
				
			||||
          <div style="clear:both;"></div>
 | 
				
			||||
          <%=render :partial => 'layouts/base_footer'%>
 | 
				
			||||
        </div>
 | 
				
			||||
 | 
				
			||||
      </div>
 | 
				
			||||
    </div>
 | 
				
			||||
 | 
				
			||||
    <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
 | 
				
			||||
    <div id="ajax-modal" style="display:none;"></div>
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
  </div>
 | 
				
			||||
</div>
 | 
				
			||||
<%= call_hook :view_layouts_base_body_bottom %>
 | 
				
			||||
</body>
 | 
				
			||||
</html>
 | 
				
			||||
@ -0,0 +1,135 @@
 | 
				
			||||
#
 | 
				
			||||
# OneApm RubyAgent Configuration
 | 
				
			||||
#
 | 
				
			||||
 | 
				
			||||
# Here are the settings that are common to all environments
 | 
				
			||||
common: &default_settings
 | 
				
			||||
  # ============================== LICENSE KEY ===============================
 | 
				
			||||
 | 
				
			||||
  #
 | 
				
			||||
  # Get your license key from oneapm.com
 | 
				
			||||
  #
 | 
				
			||||
  license_key: 'BAQMBw8FUwR2542UFFpDXFgVVk66e2dZWB4EBlQHSf846wgBGwICFQoD0498BAEfBgNIAlQ='
 | 
				
			||||
 | 
				
			||||
  # Agent Enabled (Ruby/Rails Only)
 | 
				
			||||
  # Valid values are true, false and auto.
 | 
				
			||||
  #
 | 
				
			||||
  # agent_enabled: auto
 | 
				
			||||
 | 
				
			||||
  # This app_name will be the application name in oneapm.com in your account.
 | 
				
			||||
  #
 | 
				
			||||
  # Caution: If you change this name, a new application will appear in the OneApm
 | 
				
			||||
  # user interface with the new name, and data will stop reporting to the
 | 
				
			||||
  # app with the old name.
 | 
				
			||||
  #
 | 
				
			||||
  app_name: trusite
 | 
				
			||||
 | 
				
			||||
  # When "true", the agent collects performance data about your
 | 
				
			||||
  # application and reports this data to the OneApm service at
 | 
				
			||||
  # oneapm.com. This global switch is normally overridden for each
 | 
				
			||||
  # environment below. (formerly called 'enabled')
 | 
				
			||||
  monitor_mode: true
 | 
				
			||||
 | 
				
			||||
  # Specify its log level here.
 | 
				
			||||
  log_level: info
 | 
				
			||||
 | 
				
			||||
  # log_file_path: 'log'
 | 
				
			||||
  # log_file_name: 'oneapm_agent.log'
 | 
				
			||||
 | 
				
			||||
  # The oneapm agent communicates with the service via https by default.
 | 
				
			||||
  # ssl: true
 | 
				
			||||
 | 
				
			||||
  # ======================== Browser Monitoring =============================
 | 
				
			||||
  browser_monitoring:
 | 
				
			||||
    # By default the agent automatically injects the monitoring JavaScript
 | 
				
			||||
    # into web pages. Set this attribute to false to turn off this behavior.
 | 
				
			||||
    auto_instrument: true
 | 
				
			||||
 | 
				
			||||
  # Proxy settings for connecting to the OneApm server.
 | 
				
			||||
  #
 | 
				
			||||
  # proxy_host: hostname
 | 
				
			||||
  # proxy_port: 8080
 | 
				
			||||
  # proxy_user:
 | 
				
			||||
  # proxy_pass:
 | 
				
			||||
 | 
				
			||||
  # Tells transaction tracer and error collector (when enabled)
 | 
				
			||||
  # whether or not to capture HTTP params.  When true, frameworks can
 | 
				
			||||
  # exclude HTTP parameters from being captured.
 | 
				
			||||
  # Rails: the RoR filter_parameter_logging excludes parameters
 | 
				
			||||
  capture_params: false
 | 
				
			||||
 | 
				
			||||
  # Transaction tracer captures deep information about slow
 | 
				
			||||
  # transactions and sends this to the OneApm service once a
 | 
				
			||||
  # minute. Included in the transaction is the exact call sequence of
 | 
				
			||||
  # the transactions including any SQL statements issued.
 | 
				
			||||
  transaction_tracer:
 | 
				
			||||
 | 
				
			||||
    # Transaction tracer is enabled by default.
 | 
				
			||||
    enabled: true
 | 
				
			||||
 | 
				
			||||
    # Threshold in seconds for when to collect a transaction
 | 
				
			||||
    # trace. When the response time of a controller action exceeds
 | 
				
			||||
    # this threshold, a transaction trace will be recorded and sent to
 | 
				
			||||
    # OneApm. Valid values are any float value, or (default) "apdex_f",
 | 
				
			||||
    # which will use the threshold for an dissatisfying Apdex
 | 
				
			||||
    # controller action - four times the Apdex T value.
 | 
				
			||||
    transaction_threshold: apdex_f
 | 
				
			||||
 | 
				
			||||
    # When transaction tracer is on, SQL statements can optionally be
 | 
				
			||||
    # recorded. The recorder has three modes, "off" which sends no
 | 
				
			||||
    # SQL, "raw" which sends the SQL statement in its original form,
 | 
				
			||||
    # and "obfuscated", which strips out numeric and string literals.
 | 
				
			||||
    record_sql: obfuscated
 | 
				
			||||
 | 
				
			||||
    # Threshold in seconds for when to collect stack trace for a SQL
 | 
				
			||||
    # call. In other words, when SQL statements exceed this threshold,
 | 
				
			||||
    # then capture and send to OneApm the current stack trace. This is
 | 
				
			||||
    # helpful for pinpointing where long SQL calls originate from.
 | 
				
			||||
    stack_trace_threshold: 0.500
 | 
				
			||||
 | 
				
			||||
    # Determines whether the agent will capture query plans for slow
 | 
				
			||||
    # SQL queries.  Only supported in mysql and postgres.  Should be
 | 
				
			||||
    # set to false when using other adapters.
 | 
				
			||||
    # explain_enabled: true
 | 
				
			||||
 | 
				
			||||
    # Threshold for query execution time below which query plans will
 | 
				
			||||
    # not be captured.  Relevant only when `explain_enabled` is true.
 | 
				
			||||
    # explain_threshold: 0.5
 | 
				
			||||
 | 
				
			||||
  # Error collector captures information about uncaught exceptions and
 | 
				
			||||
  # sends them to OneApm for viewing
 | 
				
			||||
  error_collector:
 | 
				
			||||
 | 
				
			||||
    # Error collector is enabled by default.
 | 
				
			||||
    enabled: true
 | 
				
			||||
 | 
				
			||||
    # Ignore the following errors, add your own.
 | 
				
			||||
    ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
 | 
				
			||||
 | 
				
			||||
# ===================== Application Environments ========================
 | 
				
			||||
# Environment-specific settings are in this section.
 | 
				
			||||
# For Rails applications, RAILS_ENV is used to determine the environment.
 | 
				
			||||
 | 
				
			||||
# NOTE if your application has other named environments, you should
 | 
				
			||||
# provide oneapm configuration settings for these environments here.
 | 
				
			||||
 | 
				
			||||
development:
 | 
				
			||||
  <<: *default_settings
 | 
				
			||||
  # Turn on communication to OneApm service in development mode
 | 
				
			||||
  monitor_mode: true
 | 
				
			||||
  app_name: My Application (Development)
 | 
				
			||||
 | 
				
			||||
test:
 | 
				
			||||
  <<: *default_settings
 | 
				
			||||
  monitor_mode: false
 | 
				
			||||
 | 
				
			||||
# Turn on the agent in production for 24x7 monitoring.
 | 
				
			||||
production:
 | 
				
			||||
  <<: *default_settings
 | 
				
			||||
  monitor_mode: true
 | 
				
			||||
 | 
				
			||||
# Staging environment which behaves identically to production.
 | 
				
			||||
staging:
 | 
				
			||||
  <<: *default_settings
 | 
				
			||||
  monitor_mode: true
 | 
				
			||||
  app_name: My Application (Staging)
 | 
				
			||||
@ -0,0 +1,15 @@
 | 
				
			||||
require 'rails_helper'
 | 
				
			||||
 | 
				
			||||
RSpec.describe "avatar request", type: :request do
 | 
				
			||||
  describe "上传头像" do
 | 
				
			||||
    let(:user){FactoryGirl.create(:user)}
 | 
				
			||||
 | 
				
			||||
    it "参数正确,可以成功上传头像" do
 | 
				
			||||
      data = File.open("#{Rails.root}/spec/fixtures/test.jpg").read
 | 
				
			||||
      binding.pry
 | 
				
			||||
      post upload_avatar_path(source_type: 'User', source_id: user.id, filename: 'test.jpg')
 | 
				
			||||
      expect(response).to have_http_status(:success)
 | 
				
			||||
      expect(response.body).to include(/\/images\/avatars\/User\//)
 | 
				
			||||
    end
 | 
				
			||||
  end
 | 
				
			||||
end
 | 
				
			||||
@ -0,0 +1,52 @@
 | 
				
			||||
require 'rails_helper'
 | 
				
			||||
require 'shared_account_spec'
 | 
				
			||||
 | 
				
			||||
RSpec.describe "homework", type: :request do
 | 
				
			||||
  include_context "create user"
 | 
				
			||||
  let(:course) {FactoryGirl.create(:course, teacher: current_user)}
 | 
				
			||||
  let(:homework){FactoryGirl.attributes_for(:homework)}
 | 
				
			||||
 | 
				
			||||
  before {
 | 
				
			||||
    shared_register
 | 
				
			||||
  }
 | 
				
			||||
  describe "创建作业" do
 | 
				
			||||
    before do 
 | 
				
			||||
      post calls_create_homework_path(course_id: course.id), {
 | 
				
			||||
                bid: homework
 | 
				
			||||
      }
 | 
				
			||||
      @homework = assigns(:bid) 
 | 
				
			||||
    end
 | 
				
			||||
    it "参数正确,可以成功创建作业" do
 | 
				
			||||
      expect(response).to redirect_to(course_homework_url(course.id))
 | 
				
			||||
    end
 | 
				
			||||
    it {expect(course.homeworks).to_not be_empty}
 | 
				
			||||
    it {expect(@homework.acts).to_not be_empty}
 | 
				
			||||
    it {expect(@homework.watchers).to_not be_empty}
 | 
				
			||||
    it {expect(@homework.attachments).to_not be_empty}
 | 
				
			||||
  end
 | 
				
			||||
 | 
				
			||||
  describe "删除作业" do
 | 
				
			||||
    before do
 | 
				
			||||
      shared_login
 | 
				
			||||
      post calls_create_homework_path(course_id: course.id), {
 | 
				
			||||
                bid: homework
 | 
				
			||||
      }
 | 
				
			||||
      @homework = assigns(:bid)
 | 
				
			||||
      delete bids_homework_path(id: @homework.id)
 | 
				
			||||
    end
 | 
				
			||||
    it{expect(response).to redirect_to(course_homework_path(course.id))}
 | 
				
			||||
    it "homework_for_courses应删除" do
 | 
				
			||||
      expect(course.homeworks).to be_empty
 | 
				
			||||
    end
 | 
				
			||||
    it "相关活动也删除" do
 | 
				
			||||
      expect(@homework.acts).to be_empty
 | 
				
			||||
    end
 | 
				
			||||
    it "watches 删除" do
 | 
				
			||||
      expect(@homework.watchers).to be_empty
 | 
				
			||||
    end
 | 
				
			||||
    it "附件 删除" do
 | 
				
			||||
      expect(@homework.attachments).to be_empty
 | 
				
			||||
    end
 | 
				
			||||
  end
 | 
				
			||||
 | 
				
			||||
end
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue