Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4409] Only show fulfillment column if partner has default location #4466

37 changes: 37 additions & 0 deletions spec/requests/requests_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,43 @@
expect(response).to have_http_status(:not_found)
end
end

context 'When organization has a default storage location' do
let(:request) { create(:request, organization: create(:organization, default_storage_location: 1)) }
it 'shows the column Default storage location inventory' do
get request_path(request)

expect(response.body).to include('Default storage location inventory')
end
end

context 'When organization does not have a default storage location' do
cielf marked this conversation as resolved.
Show resolved Hide resolved
let(:request) { create(:request, organization: organization) }
it 'shows the column Default storage location inventory' do
cielf marked this conversation as resolved.
Show resolved Hide resolved
get request_path(request)

expect(response.body).not_to include('Default storage location inventory')
end
end

context 'When partner has a default storage location' do
let(:storage_location) { create(:storage_location) }
let(:request) { create(:request, partner: create(:partner, default_storage_location_id: storage_location.id)) }
it 'shows the column Default storage location inventory' do
get request_path(request)

expect(response.body).to include('Default storage location inventory')
end
end

context 'When partner does not have a default storage location' do
let(:request) { create(:request) }
it 'shows the column Default storage location inventory' do
cielf marked this conversation as resolved.
Show resolved Hide resolved
get request_path(request)

expect(response.body).not_to include('Default storage location inventory')
end
end
end

describe 'POST #start' do
Expand Down
Loading