|
1 | 1 | require "rails_helper" |
2 | 2 |
|
3 | 3 | RSpec.describe "court_dates/edit", type: :system do |
4 | | - context "with date" |
5 | 4 | let(:now) { Date.new(2021, 1, 1) } |
6 | | - let(:organization) { create(:casa_org) } |
7 | | - let(:admin) { create(:casa_admin, casa_org: organization) } |
8 | | - let(:volunteer) { create(:volunteer) } |
9 | | - let(:supervisor) { create(:casa_admin, casa_org: organization) } |
10 | | - let!(:casa_case) { create(:casa_case, casa_org: organization) } |
11 | | - let!(:court_date) { create(:court_date, :with_court_details, casa_case: casa_case, date: now - 1.week) } |
12 | | - let!(:future_court_date) { create(:court_date, :with_court_details, casa_case: casa_case, date: now + 1.week) } |
| 5 | + let(:organization_containing_court_date) { create(:casa_org) } |
| 6 | + let(:organization_not_containing_court_date) { create(:casa_org) } |
| 7 | + let(:admin) { create(:casa_admin, casa_org: organization_containing_court_date) } |
| 8 | + let(:volunteer) { create(:volunteer, casa_org: organization_containing_court_date) } |
| 9 | + let!(:casa_case) { create(:casa_case, casa_org: organization_containing_court_date) } |
| 10 | + let!(:court_date) { create(:court_date, :with_court_details, casa_case: casa_case, date: now + 1.week) } |
13 | 11 |
|
14 | 12 | before do |
15 | 13 | travel_to now |
16 | 14 | end |
17 | 15 |
|
| 16 | + shared_examples "user can view court date" do |user_type, organization| |
| 17 | + let(:user) { create(user_type, casa_org: organization) } |
| 18 | + |
| 19 | + before(:all) do |
| 20 | + sign_in user |
| 21 | + visit casa_case_court_date_path(casa_case, court_date) |
| 22 | + end |
| 23 | + |
| 24 | + it "can visit the court order page" do |
| 25 | + expect(page).not_to have_content "Sorry, you are not authorized to perform this action." |
| 26 | + end |
| 27 | + |
| 28 | + it "can see the court date" do |
| 29 | + end |
| 30 | + |
| 31 | + it "can see the associated case number" do |
| 32 | + end |
| 33 | + |
| 34 | + it "can see the associated court report due date" do |
| 35 | + end |
| 36 | + |
| 37 | + it "can see the associated judge" do |
| 38 | + end |
| 39 | + |
| 40 | + it "can see the associated hearing type" do |
| 41 | + end |
| 42 | + |
| 43 | + it "can see associated court orders" do |
| 44 | + end |
| 45 | + end |
| 46 | + |
| 47 | + shared_examples "user cannot view court date" do |user_type, organization| |
| 48 | + let(:user) { create(user_type, casa_org: organization) } |
| 49 | + |
| 50 | + it "is not allowed to visit the court order page" do |
| 51 | + expect(page).to have_content "Sorry, you are not authorized to perform this action." |
| 52 | + end |
| 53 | + end |
| 54 | + |
18 | 55 | context "as a volunteer" do |
19 | 56 | it "can download a report which focuses on the court date", :js do |
20 | 57 | volunteer.casa_cases = [casa_case] |
|
0 commit comments