2019-03-30 03:23:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
require 'spec_helper'
|
2013-03-03 22:43:52 -05:00
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe ProjectWiki do
|
2020-04-22 08:09:29 -04:00
|
|
|
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) }
|
2013-03-03 22:43:52 -05:00
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
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-06-14 14:18:56 -04:00
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
describe '#disk_path' do
|
|
|
|
it 'returns the repository storage path' do
|
|
|
|
expect(subject.disk_path).to eq("#{subject.container.disk_path}.wiki")
|
2018-11-20 07:29:56 -05:00
|
|
|
end
|
2013-03-03 22:43:52 -05:00
|
|
|
end
|
2018-03-26 05:16:01 -04:00
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
describe '#update_container_activity' do
|
|
|
|
it 'updates project activity' do
|
|
|
|
wiki_container.update!(
|
|
|
|
last_activity_at: nil,
|
|
|
|
last_repository_updated_at: nil
|
|
|
|
)
|
2017-10-23 16:12:11 -04:00
|
|
|
|
2020-04-22 08:09:29 -04:00
|
|
|
subject.create_page('Test Page', 'This is content')
|
|
|
|
wiki_container.reload
|
2018-04-11 10:08:23 -04:00
|
|
|
|
2020-05-22 05:08:09 -04:00
|
|
|
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)
|
2018-11-20 05:36:52 -05:00
|
|
|
end
|
2018-11-20 07:29:56 -05:00
|
|
|
end
|
2014-07-31 12:24:53 -04:00
|
|
|
end
|
2013-03-03 22:43:52 -05:00
|
|
|
end
|