Skip to content

Commit

Permalink
Add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebeca Martinez committed Oct 28, 2024
1 parent 05681fc commit e388511
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions spec/public/versions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,31 @@
end
end
end

describe '#in_range' do
let(:versions) do
[
ResourceRegistry::Versions::Version.new('2024-01-01'),
ResourceRegistry::Versions::Version.new('2024-04-28'),
ResourceRegistry::Versions::Version.new('2024-09-20'),
ResourceRegistry::Versions::Version.new('2025-01-09')
]
end

it 'filtered the version by >= from & <= to' do
expect(subject.in_range('2024-04-28', '2024-09-20')).count.to eq(2)
end

context 'without to' do
it 'filtered the version by >= from' do
expect(subject.in_range('2024-04-28', nil)).count.to eq(3)
end
end

context 'without from' do
it 'filtered the version by <= to' do
expect(subject.in_range(nil, '2024-09-20')).count.to eq(3)
end
end
end
end

0 comments on commit e388511

Please sign in to comment.