Skip to content

Commit

Permalink
created first version of court_dates_helper test
Browse files Browse the repository at this point in the history
  • Loading branch information
vasconsaurus committed Dec 5, 2022
1 parent 14e0027 commit 55a106b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/factories/casa_cases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@
create(:court_date, casa_case: casa_case, date: Date.tomorrow)
end
end

trait :with_past_court_date do
after(:create) do |casa_case|
create(:court_date, casa_case: casa_case, date: Date.yesterday)
end
end
end
23 changes: 23 additions & 0 deletions spec/helpers/court_dates_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require "rails_helper"

RSpec.describe CourtDatesHelper do
describe "#when_do_we_have_court_dates" do
describe 'when casa case has only dates in the past' do
let(:casa_case) { create(:casa_case, :with_past_court_date) }

it "returns 'past'" do
expect(helper.when_do_we_have_court_dates(casa_case)).to eq('past')
end
end

describe 'when casa case only has dates in the future' do
let(:casa_case) { create(:casa_case, :with_upcoming_court_date) }

it "returns 'future'" do
expect(helper.when_do_we_have_court_dates(casa_case)).to eq('future')
end
end

it "returns nothing if the last court date is in the future and the first is in the past" do; end
end
end

0 comments on commit 55a106b

Please sign in to comment.