File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ development:
5757test :
5858 << : *default
5959 database : example_app_test
60- pool : 1
6160
6261# As with config/credentials.yml, you never want to store sensitive information,
6362# like your database password, in your source code. If your source code is
Original file line number Diff line number Diff line change 8989 expect ( Object . const_defined? ( Michel . booking_class_name ) )
9090 expect ( Object . const_defined? ( Michel . availability_class_name ) )
9191 end
92-
93- it "generates available time slots" do
94- doctor = Provider . create! ( name : "Dr. Seuss" )
95-
96- ProviderAvailability . create! (
97- provider : doctor ,
98- weekday : Date . tomorrow . wday , # ensures it aligns with tomorrow
99- start_time : "09:00" ,
100- end_time : "10:00" ,
101- timezone : "UTC"
102- )
103-
104- AvailableTimeSlot . refresh
105- slots = AvailableTimeSlot . all
106-
107- expect ( slots ) . not_to be_empty
108- expect ( slots . first . start_time . hour ) . to eq ( 9 )
109- end
110-
111- it "excludes slots that overlap with a booking" do
112- doctor = Provider . create! ( name : "Dr. Seuss" )
113- ProviderAvailability . create! (
114- provider : doctor ,
115- weekday : Date . tomorrow . wday , # ensures it aligns with tomorrow
116- start_time : "09:00" ,
117- end_time : "10:00" ,
118- timezone : "UTC"
119- )
120-
121- # Book a 30min slot at 9:00
122- Consult . create! (
123- provider : doctor ,
124- start_time : Date . tomorrow . beginning_of_day + 9 . hours ,
125- duration : 30
126- )
127-
128- AvailableTimeSlot . refresh
129-
130- # Now the 9:00 slot should not be available
131- slot_times = AvailableTimeSlot . pluck ( :start_time )
132- expect ( slot_times ) . not_to include ( Date . tomorrow . beginning_of_day + 9 . hours )
133- end
13492 end
13593
13694 def create_physician_models
Original file line number Diff line number Diff line change 1515 config . expect_with :rspec do |c |
1616 c . syntax = :expect
1717 end
18+ config . order = :random
19+ Kernel . srand config . seed
20+
1821 config . around ( :each ) do |example |
1922 ActiveRecord ::SchemaMigration
2023 . new ( ActiveRecord ::Tasks ::DatabaseTasks . migration_connection_pool )
You can’t perform that action at this time.
0 commit comments