kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
3.5 KiB
98 lines
3.5 KiB
13 years ago
|
#-- encoding: UTF-8
|
||
14 years ago
|
#-- copyright
|
||
12 years ago
|
# OpenProject is a project management system.
|
||
10 years ago
|
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
|
||
14 years ago
|
#
|
||
17 years ago
|
# This program is free software; you can redistribute it and/or
|
||
12 years ago
|
# modify it under the terms of the GNU General Public License version 3.
|
||
14 years ago
|
#
|
||
11 years ago
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
#
|
||
14 years ago
|
# See doc/COPYRIGHT.rdoc for more details.
|
||
|
#++
|
||
10 years ago
|
require 'legacy_spec_helper'
|
||
17 years ago
|
require 'journals_controller'
|
||
|
|
||
11 years ago
|
describe JournalsController, type: :controller do
|
||
9 years ago
|
include PrototypeRails::SelectorAssertions
|
||
|
|
||
11 years ago
|
render_views
|
||
|
|
||
12 years ago
|
fixtures :all
|
||
14 years ago
|
|
||
11 years ago
|
before do
|
||
17 years ago
|
User.current = nil
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should get edit' do
|
||
11 years ago
|
issue = WorkPackage.find(1)
|
||
11 years ago
|
journal = FactoryGirl.create :work_package_journal,
|
||
|
journable_id: issue.id
|
||
|
identifier = "journal-#{journal.id}"
|
||
|
|
||
10 years ago
|
session[:user_id] = 1
|
||
10 years ago
|
xhr :get, :edit, id: journal.id
|
||
17 years ago
|
assert_response :success
|
||
9 years ago
|
assert_select_rjs :insert, :after, "#{identifier}-notes" do |matches|
|
||
|
# workaround for assert_select_rjs incompatibility with Rails DOM Testing.
|
||
|
rjs_content = Nokogiri::HTML(matches.map(&:to_s).join)
|
||
|
refute_empty css_select(rjs_content, "form[id=#{identifier}-form]")
|
||
|
refute_empty css_select(rjs_content, 'textarea')
|
||
17 years ago
|
end
|
||
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should post edit' do
|
||
11 years ago
|
issue = WorkPackage.find(1)
|
||
11 years ago
|
journal = FactoryGirl.create :work_package_journal,
|
||
|
journable_id: issue.id,
|
||
|
data: FactoryGirl.build(:journal_work_package_journal)
|
||
|
identifier = "journal-#{journal.id}-notes"
|
||
|
|
||
10 years ago
|
session[:user_id] = 1
|
||
10 years ago
|
xhr :post, :update, id: journal.id, notes: 'Updated notes'
|
||
17 years ago
|
assert_response :success
|
||
11 years ago
|
assert_select_rjs :replace, identifier
|
||
|
assert_equal 'Updated notes', Journal.find(journal.id).notes
|
||
17 years ago
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should post edit with empty notes' do
|
||
11 years ago
|
issue = WorkPackage.find(1)
|
||
11 years ago
|
FactoryGirl.create :work_package_journal,
|
||
|
journable_id: issue.id,
|
||
|
data: FactoryGirl.build(:journal_work_package_journal)
|
||
|
journal = FactoryGirl.create :work_package_journal,
|
||
|
journable_id: issue.id,
|
||
|
data: FactoryGirl.build(:journal_work_package_journal)
|
||
|
identifier = "change-#{journal.id}"
|
||
|
|
||
10 years ago
|
session[:user_id] = 1
|
||
10 years ago
|
xhr :post, :update, id: journal.id, notes: ''
|
||
17 years ago
|
assert_response :success
|
||
11 years ago
|
assert_select_rjs :remove, identifier
|
||
10 years ago
|
assert_nil Journal.find_by(id: journal.id)
|
||
17 years ago
|
end
|
||
14 years ago
|
|
||
11 years ago
|
it 'should index' do
|
||
10 years ago
|
get :index, project_id: 1, format: :atom
|
||
14 years ago
|
assert_response :success
|
||
9 years ago
|
refute_nil assigns(:journals)
|
||
10 years ago
|
assert_equal 'application/atom+xml', response.content_type
|
||
14 years ago
|
end
|
||
17 years ago
|
end
|