summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/models/wiki_shared_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/models/wiki_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/models/wiki_shared_examples.rb27
1 files changed, 2 insertions, 25 deletions
diff --git a/spec/support/shared_examples/models/wiki_shared_examples.rb b/spec/support/shared_examples/models/wiki_shared_examples.rb
index bc5956e3eec..b3f79d9fe6e 100644
--- a/spec/support/shared_examples/models/wiki_shared_examples.rb
+++ b/spec/support/shared_examples/models/wiki_shared_examples.rb
@@ -599,36 +599,13 @@ RSpec.shared_examples 'wiki model' do
context 'when repository is empty' do
let(:wiki_container) { wiki_container_without_repo }
- it 'changes the HEAD reference to the default branch' do
- wiki.repository.create_if_not_exists
- wiki.repository.raw_repository.write_ref('HEAD', 'refs/heads/bar')
+ it 'creates the repository with the default branch' do
+ wiki.repository.create_if_not_exists(default_branch)
subject
expect(File.read(head_path).squish).to eq "ref: refs/heads/#{default_branch}"
end
end
-
- context 'when repository is not empty' do
- before do
- wiki.create_page('index', 'test content')
- end
-
- it 'does nothing when HEAD points to the right branch' do
- expect(wiki.repository.raw_repository).not_to receive(:write_ref)
-
- subject
- end
-
- context 'when HEAD points to the wrong branch' do
- it 'rewrites HEAD with the right branch' do
- wiki.repository.raw_repository.write_ref('HEAD', 'refs/heads/bar')
-
- subject
-
- expect(File.read(head_path).squish).to eq "ref: refs/heads/#{default_branch}"
- end
- end
- end
end
end