Skip to content

Commit

Permalink
Rename panel_mode? method to is_open? for clarity #627
Browse files Browse the repository at this point in the history
  • Loading branch information
jseraf committed Oct 6, 2020
1 parent 54603c6 commit abf7a94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/panel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Panel < ApplicationRecord

validate :start_is_after_submission_deadline, if: :start_datetime?

def in_panel_mode?
def is_open?
return false if !start_datetime? || !end_datetime?
DateTime.now.between?(start_datetime, end_datetime)
end
Expand Down
10 changes: 5 additions & 5 deletions spec/models/panel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,28 @@
end

describe '#methods' do
context '#panel_mode?' do
context '#is_open?' do
context 'open panel' do
it 'is true' do
expect(open_panel.in_panel_mode?).to be true
expect(open_panel.is_open?).to be true
end
end

context 'before start_datetime' do
it 'is false' do
expect(before_panel.in_panel_mode?).to be false
expect(before_panel.is_open?).to be false
end
end

context 'after end_datetime' do
it 'is false' do
expect(after_panel.in_panel_mode?).to be false
expect(after_panel.is_open?).to be false
end
end

context 'no panel dates' do
it 'is false' do
expect(no_panel.in_panel_mode?).to be false
expect(no_panel.is_open?).to be false
end
end
end
Expand Down

0 comments on commit abf7a94

Please sign in to comment.