summaryrefslogtreecommitdiff
path: root/spec/lib/extracts_path_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/extracts_path_spec.rb')
-rw-r--r--spec/lib/extracts_path_spec.rb21
1 files changed, 13 insertions, 8 deletions
diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb
index 9b2bb024fa6..5db2fbd923e 100644
--- a/spec/lib/extracts_path_spec.rb
+++ b/spec/lib/extracts_path_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe ExtractsPath do
describe '#assign_ref_vars' do
let(:ref) { sample_commit[:id] }
let(:path) { sample_commit[:line_code_path] }
- let(:params) { { path: path, ref: ref } }
+ let(:params) { ActionController::Parameters.new(path: path, ref: ref) }
it_behaves_like 'assigns ref vars'
@@ -54,7 +54,8 @@ RSpec.describe ExtractsPath do
context 'ref only exists without .atom suffix' do
context 'with a path' do
- let(:params) { { ref: 'v1.0.0.atom', path: 'README.md' } }
+ let(:ref) { 'v1.0.0.atom' }
+ let(:path) { 'README.md' }
it 'renders a 404' do
expect(self).to receive(:render_404)
@@ -64,7 +65,8 @@ RSpec.describe ExtractsPath do
end
context 'without a path' do
- let(:params) { { ref: 'v1.0.0.atom' } }
+ let(:ref) { 'v1.0.0.atom' }
+ let(:path) { nil }
before do
assign_ref_vars
@@ -82,7 +84,8 @@ RSpec.describe ExtractsPath do
context 'ref exists with .atom suffix' do
context 'with a path' do
- let(:params) { { ref: 'master.atom', path: 'README.md' } }
+ let(:ref) { 'master.atom' }
+ let(:path) { 'README.md' }
before do
repository = @project.repository
@@ -102,7 +105,8 @@ RSpec.describe ExtractsPath do
end
context 'without a path' do
- let(:params) { { ref: 'master.atom' } }
+ let(:ref) { 'master.atom' }
+ let(:path) { nil }
before do
repository = @project.repository
@@ -125,7 +129,8 @@ RSpec.describe ExtractsPath do
end
context 'ref and path are nil' do
- let(:params) { { path: nil, ref: nil } }
+ let(:path) { nil }
+ let(:ref) { nil }
it 'does not set commit' do
expect(container.repository).not_to receive(:commit).with('')
@@ -209,8 +214,8 @@ RSpec.describe ExtractsPath do
expect(extract_ref_without_atom('release/app/v1.0.0.atom')).to eq('release/app/v1.0.0')
end
- it 'returns nil if there are no matching refs' do
- expect(extract_ref_without_atom('foo.atom')).to eq(nil)
+ it 'raises an error if there are no matching refs' do
+ expect { extract_ref_without_atom('foo.atom') }.to raise_error(ExtractsRef::InvalidPathError)
end
end
end