-
-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5242 from rubyforgood/sort-milage
Sort mileage rates by effective_dates
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe MileageRatesController, type: :controller do | ||
describe "#index" do | ||
it "render the mileage rates by effective date in ascending order" do | ||
mileage_rate1 = FactoryBot.create(:mileage_rate, effective_date: Date.new(2023, 3, 1)) | ||
mileage_rate2 = FactoryBot.create(:mileage_rate, effective_date: Date.new(2023, 1, 1)) | ||
mileage_rate3 = FactoryBot.create(:mileage_rate, effective_date: Date.new(2023, 2, 1)) | ||
mileage_rates = MileageRate.order(effective_date: :asc) | ||
get :index | ||
expect(mileage_rates).to eq([mileage_rate2, mileage_rate3, mileage_rate1]) | ||
end | ||
end | ||
end |