2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
require 'spec_helper'
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe ProjectWiki do
|
2020-05-24 23:13:21 +05:30
|
|
|
it_behaves_like 'wiki model' do
|
|
|
|
let(:wiki_container) { create(:project, :wiki_repo, namespace: user.namespace) }
|
|
|
|
let(:wiki_container_without_repo) { create(:project, namespace: user.namespace) }
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
it { is_expected.to delegate_method(:storage).to(:container) }
|
|
|
|
it { is_expected.to delegate_method(:repository_storage).to(:container) }
|
|
|
|
it { is_expected.to delegate_method(:hashed_storage?).to(:container) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
describe '#disk_path' do
|
|
|
|
it 'returns the repository storage path' do
|
|
|
|
expect(subject.disk_path).to eq("#{subject.container.disk_path}.wiki")
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
describe '#update_container_activity' do
|
|
|
|
it 'updates project activity' do
|
|
|
|
wiki_container.update!(
|
|
|
|
last_activity_at: nil,
|
|
|
|
last_repository_updated_at: nil
|
|
|
|
)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
subject.create_page('Test Page', 'This is content')
|
|
|
|
wiki_container.reload
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(wiki_container.last_activity_at).to be_within(1.minute).of(Time.current)
|
|
|
|
expect(wiki_container.last_repository_updated_at).to be_within(1.minute).of(Time.current)
|
2019-01-03 12:48:30 +05:30
|
|
|
end
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|