|
|
|
@ -40,12 +40,12 @@ describe Queries::WorkPackages::Filter::VersionFilter, type: :model do |
|
|
|
|
before do |
|
|
|
|
if project |
|
|
|
|
allow(project) |
|
|
|
|
.to receive_message_chain(:shared_versions, :order_by_semver_name) |
|
|
|
|
.and_return [version] |
|
|
|
|
.to receive_message_chain(:shared_versions, :pluck) |
|
|
|
|
.and_return [version.id] |
|
|
|
|
else |
|
|
|
|
allow(Version) |
|
|
|
|
.to receive_message_chain(:visible, :systemwide, :order_by_semver_name) |
|
|
|
|
.and_return [version] |
|
|
|
|
.to receive_message_chain(:visible, :systemwide, :pluck) |
|
|
|
|
.and_return [version.id] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -57,7 +57,7 @@ describe Queries::WorkPackages::Filter::VersionFilter, type: :model do |
|
|
|
|
|
|
|
|
|
it 'is false if the value does not exist as a version' do |
|
|
|
|
allow(project) |
|
|
|
|
.to receive_message_chain(:shared_versions, :order_by_semver_name) |
|
|
|
|
.to receive_message_chain(:shared_versions, :pluck) |
|
|
|
|
.and_return [] |
|
|
|
|
|
|
|
|
|
expect(instance).to_not be_valid |
|
|
|
@ -73,7 +73,7 @@ describe Queries::WorkPackages::Filter::VersionFilter, type: :model do |
|
|
|
|
|
|
|
|
|
it 'is false if the value does not exist as a version' do |
|
|
|
|
allow(Version) |
|
|
|
|
.to receive_message_chain(:visible, :systemwide, :order_by_semver_name) |
|
|
|
|
.to receive_message_chain(:visible, :systemwide, :pluck) |
|
|
|
|
.and_return [] |
|
|
|
|
|
|
|
|
|
expect(instance).to_not be_valid |
|
|
|
@ -85,7 +85,7 @@ describe Queries::WorkPackages::Filter::VersionFilter, type: :model do |
|
|
|
|
context 'within a project' do |
|
|
|
|
before do |
|
|
|
|
expect(instance.allowed_values) |
|
|
|
|
.to match_array [[version.name, version.id.to_s]] |
|
|
|
|
.to match_array [[version.id.to_s, version.id.to_s]] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -94,7 +94,7 @@ describe Queries::WorkPackages::Filter::VersionFilter, type: :model do |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
expect(instance.allowed_values) |
|
|
|
|
.to match_array [[version.name, version.id.to_s]] |
|
|
|
|
.to match_array [[version.id.to_s, version.id.to_s]] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|