2025-01-21 15:38:34 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-02-21 15:26:50 +01:00
|
|
|
#-- copyright
|
2020-01-15 11:31:26 +01:00
|
|
|
# OpenProject is an open source project management software.
|
2024-07-30 13:42:36 +02:00
|
|
|
# Copyright (C) the OpenProject GmbH
|
2014-02-21 15:26:50 +01:00
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU General Public License version 3.
|
|
|
|
|
#
|
|
|
|
|
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
2021-01-13 17:47:45 +01:00
|
|
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
2014-02-21 15:26:50 +01:00
|
|
|
# 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.
|
|
|
|
|
#
|
2021-09-02 21:49:06 +02:00
|
|
|
# See COPYRIGHT and LICENSE files for more details.
|
2014-02-21 15:26:50 +01:00
|
|
|
#++
|
|
|
|
|
|
|
|
|
|
require "spec_helper"
|
|
|
|
|
|
2023-05-31 12:15:15 +02:00
|
|
|
RSpec.describe Changeset do
|
2014-11-03 23:43:33 +01:00
|
|
|
let(:email) { "bob@bobbit.org" }
|
2014-02-21 15:26:50 +01:00
|
|
|
|
2015-07-20 08:32:25 +02:00
|
|
|
with_virtual_subversion_repository do
|
2019-09-13 17:03:55 +02:00
|
|
|
let(:changeset) do
|
2022-01-24 19:22:35 +01:00
|
|
|
build(:changeset,
|
2022-02-02 21:48:06 +01:00
|
|
|
repository:,
|
|
|
|
|
revision: "1",
|
|
|
|
|
committer: email,
|
|
|
|
|
comments: "Initial commit")
|
2019-09-13 17:03:55 +02:00
|
|
|
end
|
2015-03-12 20:44:41 +01:00
|
|
|
end
|
2014-02-21 15:26:50 +01:00
|
|
|
|
|
|
|
|
shared_examples_for "valid changeset" do
|
|
|
|
|
it { expect(changeset.revision).to eq("1") }
|
|
|
|
|
|
|
|
|
|
it { expect(changeset.committer).to eq(email) }
|
|
|
|
|
|
2014-11-03 23:43:33 +01:00
|
|
|
it { expect(changeset.comments).to eq("Initial commit") }
|
2014-02-21 15:26:50 +01:00
|
|
|
|
|
|
|
|
describe "journal" do
|
|
|
|
|
let(:journal) { changeset.journals.first }
|
|
|
|
|
|
|
|
|
|
it { expect(journal.user).to eq(journal_user) }
|
|
|
|
|
|
|
|
|
|
it { expect(journal.notes).to eq(changeset.comments) }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2019-07-24 14:07:44 +02:00
|
|
|
describe "empty comment" do
|
|
|
|
|
it "commentses empty" do
|
|
|
|
|
changeset.comments = ""
|
|
|
|
|
expect(changeset.save).to be true
|
|
|
|
|
expect(changeset.comments).to eq ""
|
|
|
|
|
|
|
|
|
|
if changeset.comments.respond_to?(:force_encoding)
|
2023-03-09 10:25:57 +01:00
|
|
|
expect(changeset.comments.encoding.to_s).to eq("UTF-8")
|
2019-07-24 14:07:44 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "commentses nil" do
|
|
|
|
|
changeset.comments = nil
|
|
|
|
|
expect(changeset.save).to be true
|
|
|
|
|
expect(changeset.comments).to eq ""
|
|
|
|
|
|
|
|
|
|
if changeset.comments.respond_to?(:force_encoding)
|
2023-03-09 10:25:57 +01:00
|
|
|
expect(changeset.comments.encoding.to_s).to eq("UTF-8")
|
2019-07-24 14:07:44 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "stripping commit" do
|
2025-01-21 15:38:34 +01:00
|
|
|
let(:comment) { "This is a looooooooooooooong comment#{"#{' ' * 80}\n" * 5}" }
|
2022-05-31 11:55:27 +02:00
|
|
|
|
2019-07-24 14:07:44 +02:00
|
|
|
with_virtual_subversion_repository do
|
2019-09-13 17:03:55 +02:00
|
|
|
let(:changeset) do
|
2022-01-24 19:22:35 +01:00
|
|
|
build(:changeset,
|
2022-02-02 21:48:06 +01:00
|
|
|
repository:,
|
|
|
|
|
revision: "1",
|
|
|
|
|
committer: email,
|
|
|
|
|
comments: comment)
|
2019-09-13 17:03:55 +02:00
|
|
|
end
|
2019-07-24 14:07:44 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "fors changeset comments strip" do
|
|
|
|
|
expect(changeset.save).to be true
|
|
|
|
|
expect(comment).not_to eq changeset.comments
|
|
|
|
|
expect(changeset.comments).to eq "This is a looooooooooooooong comment"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "mapping" do
|
2023-03-07 15:04:32 +01:00
|
|
|
let!(:user) { create(:user, login: "jsmith", mail: "jsmith@somenet.foo") }
|
2022-01-24 19:22:35 +01:00
|
|
|
let!(:repository) { create(:repository_subversion) }
|
2019-07-24 14:07:44 +02:00
|
|
|
|
2023-03-07 16:41:58 +01:00
|
|
|
it "supports manual user mapping with repository.committer_ids" do
|
|
|
|
|
c = create(:changeset, repository:, committer: "foo")
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
expect(c.user).to be_nil
|
|
|
|
|
repository.committer_ids = { "foo" => user.id }
|
|
|
|
|
expect(c.reload.user).to eq user
|
|
|
|
|
|
|
|
|
|
# committer is now mapped
|
2023-03-07 16:41:58 +01:00
|
|
|
c = create(:changeset, repository:, committer: "foo")
|
2019-07-24 14:07:44 +02:00
|
|
|
expect(c.user).to eq user
|
|
|
|
|
end
|
|
|
|
|
|
2023-03-07 16:41:58 +01:00
|
|
|
it "maps user automatically when username matches" do
|
|
|
|
|
c = create(:changeset, repository:, committer: user.login)
|
2019-07-24 14:07:44 +02:00
|
|
|
expect(c.user).to eq user
|
|
|
|
|
end
|
|
|
|
|
|
2023-03-07 16:41:58 +01:00
|
|
|
it "maps user automatically when email matches" do
|
|
|
|
|
c = create(:changeset, repository:, committer: "john <#{user.mail}>")
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
expect(c.user).to eq user
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "#scan_comment_for_work_package_ids",
|
|
|
|
|
with_settings: {
|
|
|
|
|
commit_ref_keywords: "refs , references, IssueID",
|
|
|
|
|
commit_fix_keywords: "fixes , closes",
|
2024-04-09 17:46:23 +02:00
|
|
|
default_language: "en",
|
|
|
|
|
work_package_done_ratio: "status"
|
2019-07-24 14:07:44 +02:00
|
|
|
} do
|
2024-04-09 17:46:23 +02:00
|
|
|
let!(:user) do
|
|
|
|
|
create(:admin,
|
|
|
|
|
login: "dlopper",
|
|
|
|
|
member_with_roles: { repository.project => role })
|
|
|
|
|
end
|
2023-03-07 15:04:32 +01:00
|
|
|
let!(:open_status) { create(:status) }
|
2024-04-09 17:46:23 +02:00
|
|
|
let!(:closed_status) { create(:closed_status, default_done_ratio: 90) }
|
|
|
|
|
let!(:role) { create(:project_role, permissions: %i[view_work_packages edit_work_packages]) }
|
2019-07-24 14:07:44 +02:00
|
|
|
|
2023-03-07 15:04:32 +01:00
|
|
|
let!(:other_work_package) { create(:work_package, status: open_status) }
|
2024-04-09 17:46:23 +02:00
|
|
|
let!(:parent_work_package) { create(:work_package, subject: "Parent wp") }
|
|
|
|
|
let!(:workflow) do
|
|
|
|
|
create(:workflow,
|
|
|
|
|
old_status: open_status,
|
|
|
|
|
new_status: closed_status,
|
|
|
|
|
role:,
|
|
|
|
|
type: work_package.type)
|
|
|
|
|
end
|
2019-07-24 14:07:44 +02:00
|
|
|
let(:comments) { "Some fix made, fixes ##{work_package.id} and fixes ##{other_work_package.id}" }
|
|
|
|
|
|
|
|
|
|
with_virtual_subversion_repository do
|
2019-09-13 17:03:55 +02:00
|
|
|
let!(:work_package) do
|
2023-03-07 15:04:32 +01:00
|
|
|
create(:work_package,
|
2022-02-02 21:48:06 +01:00
|
|
|
project: repository.project,
|
2024-04-09 17:46:23 +02:00
|
|
|
status: open_status,
|
|
|
|
|
parent: parent_work_package,
|
|
|
|
|
estimated_hours: 100)
|
2019-09-13 17:03:55 +02:00
|
|
|
end
|
|
|
|
|
let(:changeset) do
|
2022-01-24 19:22:35 +01:00
|
|
|
create(:changeset,
|
2022-02-02 21:48:06 +01:00
|
|
|
repository:,
|
|
|
|
|
revision: "123",
|
|
|
|
|
committer: user.login,
|
|
|
|
|
comments:)
|
2019-09-13 17:03:55 +02:00
|
|
|
end
|
2019-07-24 14:07:44 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
# choosing a status to apply to fix issues
|
|
|
|
|
allow(Setting).to receive(:commit_fix_status_id).and_return closed_status.id
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "with any matching", with_settings: { commit_ref_keywords: "*" } do
|
|
|
|
|
describe "reference with brackets" do
|
|
|
|
|
let(:comments) { "[##{work_package.id}] Worked on this work_package" }
|
|
|
|
|
|
|
|
|
|
it "references" do
|
|
|
|
|
changeset.scan_comment_for_work_package_ids
|
|
|
|
|
work_package.reload
|
|
|
|
|
|
|
|
|
|
expect(work_package.changesets).to eq [changeset]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "reference at line start" do
|
|
|
|
|
let(:comments) { "##{work_package.id} Worked on this work_package" }
|
|
|
|
|
|
|
|
|
|
it "references" do
|
|
|
|
|
changeset.scan_comment_for_work_package_ids
|
|
|
|
|
work_package.reload
|
|
|
|
|
|
|
|
|
|
expect(work_package.changesets).to eq [changeset]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "non matching ref" do
|
|
|
|
|
let(:comments) { "Some fix ignores ##{work_package.id}" }
|
2022-05-31 11:55:27 +02:00
|
|
|
|
2019-07-24 14:07:44 +02:00
|
|
|
it "references the work package id" do
|
|
|
|
|
changeset.scan_comment_for_work_package_ids
|
|
|
|
|
work_package.reload
|
|
|
|
|
|
|
|
|
|
expect(work_package.changesets).to eq []
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "with timelogs" do
|
2023-03-07 15:04:32 +01:00
|
|
|
let!(:activity) { create(:activity, is_default: true) }
|
2022-05-31 11:55:27 +02:00
|
|
|
|
2019-07-24 14:07:44 +02:00
|
|
|
before do
|
2020-08-18 08:24:34 +02:00
|
|
|
repository.project.enabled_module_names += ["costs"]
|
2019-07-24 14:07:44 +02:00
|
|
|
repository.project.save!
|
|
|
|
|
end
|
|
|
|
|
|
2025-01-21 15:38:34 +01:00
|
|
|
it "refs keywords any with timelog" do # rubocop:disable RSpec/ExampleLength
|
|
|
|
|
allow(Setting).to receive_messages(
|
|
|
|
|
commit_ref_keywords: "*",
|
|
|
|
|
commit_logtime_enabled?: true
|
|
|
|
|
)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"2" => 2.0,
|
|
|
|
|
"2h" => 2.0,
|
|
|
|
|
"2hours" => 2.0,
|
|
|
|
|
"15m" => 0.25,
|
|
|
|
|
"15min" => 0.25,
|
|
|
|
|
"3h15" => 3.25,
|
2020-01-10 09:02:54 +01:00
|
|
|
"2h15m" => 2.25,
|
|
|
|
|
"2h15min" => 2.25,
|
|
|
|
|
"2:15" => 2.25,
|
|
|
|
|
"2.25" => 2.25,
|
|
|
|
|
"1.25h" => 1.25,
|
|
|
|
|
"0,75" => 0.75,
|
|
|
|
|
"1,25h" => 1.25
|
2019-07-24 14:07:44 +02:00
|
|
|
}.each do |syntax, expected_hours|
|
2023-03-07 16:41:58 +01:00
|
|
|
c = build(:changeset,
|
|
|
|
|
repository:,
|
|
|
|
|
committed_on: 24.hours.ago,
|
|
|
|
|
commit_date: Date.yesterday,
|
|
|
|
|
comments: "Worked on this work_package ##{work_package.id} @#{syntax}",
|
|
|
|
|
revision: "520",
|
|
|
|
|
user:)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
expect { c.scan_comment_for_work_package_ids }
|
2023-03-07 16:41:58 +01:00
|
|
|
.to change(TimeEntry, :count).by(1)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
expect(c.work_package_ids).to eq [work_package.id]
|
|
|
|
|
|
|
|
|
|
time = TimeEntry.order(Arel.sql("id DESC")).first
|
2023-03-09 10:25:57 +01:00
|
|
|
expect(work_package.id).to eq(time.work_package_id)
|
|
|
|
|
expect(work_package.project_id).to eq(time.project_id)
|
|
|
|
|
expect(user.id).to eq(time.user_id)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
expect(time.hours).to eq expected_hours
|
|
|
|
|
expect(time.spent_on).to eq Date.yesterday
|
|
|
|
|
|
2025-01-21 15:38:34 +01:00
|
|
|
expect(time.activity).to be_nil
|
2019-07-24 14:07:44 +02:00
|
|
|
expect(time.comments).to include "r520"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "with a second work package" do
|
2023-03-07 15:04:32 +01:00
|
|
|
let!(:work_package2) { create(:work_package, project: repository.project, status: open_status) }
|
2022-05-31 11:55:27 +02:00
|
|
|
|
2019-07-24 14:07:44 +02:00
|
|
|
it "refs keywords closing with timelog" do
|
2025-01-21 15:38:34 +01:00
|
|
|
allow(Setting).to receive_messages(
|
|
|
|
|
commit_fix_status_id: closed_status.id,
|
|
|
|
|
commit_ref_keywords: "*",
|
|
|
|
|
commit_fix_keywords: "fixes , closes",
|
|
|
|
|
commit_logtime_enabled?: true
|
|
|
|
|
)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
2023-03-07 16:41:58 +01:00
|
|
|
c = build(:changeset,
|
|
|
|
|
repository:,
|
|
|
|
|
comments: "This is a comment. Fixes ##{work_package.id} @4.5, ##{work_package2.id} @1",
|
|
|
|
|
revision: "520",
|
|
|
|
|
user:)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
expect { c.scan_comment_for_work_package_ids }
|
2023-03-07 16:41:58 +01:00
|
|
|
.to change(TimeEntry, :count).by(2)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
2023-09-27 17:53:04 +02:00
|
|
|
expect(c.work_package_ids).to contain_exactly(work_package.id, work_package2.id)
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
work_package.reload
|
|
|
|
|
work_package2.reload
|
|
|
|
|
expect(work_package).to be_closed
|
|
|
|
|
expect(work_package2).to be_closed
|
|
|
|
|
|
|
|
|
|
times = TimeEntry.order(Arel.sql("id desc")).limit(2)
|
2023-09-27 17:53:04 +02:00
|
|
|
expect(times.map(&:work_package_id)).to contain_exactly(work_package.id, work_package2.id)
|
2019-07-24 14:07:44 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "references the work package id" do
|
|
|
|
|
# make sure work package 1 is not already closed
|
|
|
|
|
expect(work_package.status.is_closed?).to be false
|
|
|
|
|
|
|
|
|
|
changeset.scan_comment_for_work_package_ids
|
|
|
|
|
work_package.reload
|
|
|
|
|
|
|
|
|
|
expect(work_package.changesets).to eq [changeset]
|
|
|
|
|
|
|
|
|
|
expect(work_package.status).to eq closed_status
|
|
|
|
|
expect(work_package.done_ratio).to eq 90
|
2024-04-09 17:46:23 +02:00
|
|
|
expect(work_package.remaining_hours).to eq 10
|
2019-07-24 14:07:44 +02:00
|
|
|
|
2024-04-09 17:46:23 +02:00
|
|
|
# journal updates
|
2019-07-24 14:07:44 +02:00
|
|
|
journal = work_package.journals.last
|
|
|
|
|
|
|
|
|
|
expect(journal.user).to eq user
|
|
|
|
|
expect(journal.notes).to eq "Applied in changeset r123."
|
|
|
|
|
|
|
|
|
|
# Expect other work package to be unchanged
|
|
|
|
|
# due to other project
|
|
|
|
|
other_work_package.reload
|
|
|
|
|
expect(other_work_package.changesets).to eq []
|
2024-04-09 17:46:23 +02:00
|
|
|
|
|
|
|
|
# Expect the parent to be updated
|
|
|
|
|
parent_work_package.reload
|
|
|
|
|
|
|
|
|
|
expect(parent_work_package.done_ratio).to eq 0
|
|
|
|
|
expect(parent_work_package.derived_remaining_hours).to eq 10
|
|
|
|
|
expect(parent_work_package.derived_done_ratio).to eq 90
|
2019-07-24 14:07:44 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "with work package in parent project" do
|
2023-03-07 15:04:32 +01:00
|
|
|
let(:parent) { create(:project) }
|
|
|
|
|
let!(:work_package) { create(:work_package, project: parent, status: open_status) }
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
repository.project.parent = parent
|
|
|
|
|
repository.project.save!
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "can reference it" do
|
|
|
|
|
# make sure work package 1 is not already closed
|
|
|
|
|
expect(work_package.status.is_closed?).to be false
|
|
|
|
|
|
|
|
|
|
changeset.scan_comment_for_work_package_ids
|
|
|
|
|
work_package.reload
|
|
|
|
|
|
|
|
|
|
expect(work_package.changesets).to eq [changeset]
|
|
|
|
|
|
|
|
|
|
# Expect other work package to be unchanged
|
|
|
|
|
# due to other project
|
|
|
|
|
other_work_package.reload
|
|
|
|
|
expect(other_work_package.changesets).to eq []
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "with work package in sub project" do
|
2023-03-07 15:04:32 +01:00
|
|
|
let(:sub) { create(:project) }
|
|
|
|
|
let!(:work_package) { create(:work_package, project: sub, status: open_status) }
|
2019-07-24 14:07:44 +02:00
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
sub.parent = repository.project
|
|
|
|
|
sub.save!
|
|
|
|
|
|
|
|
|
|
repository.project.reload
|
|
|
|
|
sub.reload
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "can reference it" do
|
|
|
|
|
# make sure work package 1 is not already closed
|
|
|
|
|
expect(work_package.status.is_closed?).to be false
|
|
|
|
|
|
|
|
|
|
changeset.scan_comment_for_work_package_ids
|
|
|
|
|
work_package.reload
|
|
|
|
|
|
|
|
|
|
expect(work_package.changesets).to eq [changeset]
|
|
|
|
|
|
|
|
|
|
# Expect other work package to be unchanged
|
|
|
|
|
# due to other project
|
|
|
|
|
other_work_package.reload
|
|
|
|
|
expect(other_work_package.changesets).to eq []
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-21 15:26:50 +01:00
|
|
|
describe "assign_openproject user" do
|
2014-11-03 23:43:33 +01:00
|
|
|
describe "w/o user" do
|
2019-07-24 14:07:44 +02:00
|
|
|
before do
|
|
|
|
|
changeset.save!
|
|
|
|
|
end
|
2014-02-21 15:26:50 +01:00
|
|
|
|
|
|
|
|
it_behaves_like "valid changeset" do
|
|
|
|
|
let(:journal_user) { User.anonymous }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-11-03 23:43:33 +01:00
|
|
|
describe "with user is committer" do
|
2022-01-24 19:22:35 +01:00
|
|
|
let!(:committer) { create(:user, login: email) }
|
2014-02-21 15:26:50 +01:00
|
|
|
|
2019-07-24 14:07:44 +02:00
|
|
|
before do
|
|
|
|
|
changeset.save!
|
|
|
|
|
end
|
2014-02-21 15:26:50 +01:00
|
|
|
|
|
|
|
|
it_behaves_like "valid changeset" do
|
|
|
|
|
let(:journal_user) { committer }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-11-03 23:43:33 +01:00
|
|
|
describe "current user is not committer" do
|
2022-01-24 19:22:35 +01:00
|
|
|
let(:current_user) { create(:user) }
|
|
|
|
|
let!(:committer) { create(:user, login: email) }
|
2014-02-21 15:26:50 +01:00
|
|
|
|
|
|
|
|
before do
|
2014-03-29 14:50:29 +01:00
|
|
|
allow(User).to receive(:current).and_return current_user
|
2014-02-21 15:26:50 +01:00
|
|
|
|
|
|
|
|
changeset.save!
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it_behaves_like "valid changeset" do
|
|
|
|
|
let(:journal_user) { committer }
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|