Skip to content

Commit dd65c3f

Browse files
committed
reduce duplicate test cases
1 parent ddba9cf commit dd65c3f

3 files changed

Lines changed: 3 additions & 43 deletions

File tree

spec/example-app/config/database.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ development:
5757
test:
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

spec/generators/michel/view/view_generator_spec.rb

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -89,48 +89,6 @@
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

spec/spec_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
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)

0 commit comments

Comments
 (0)