Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pkg/
Gemfile.lock
gemfiles/*.lock
.byebug_history
vendor/
1 change: 0 additions & 1 deletion lib/validates_timeliness/extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Extensions
end

def self.enable_date_time_select_extension!
require 'uri' # Do we need this? No, but the test suite fails without it.
::ActionView::Helpers::Tags::DateSelect.send(:prepend, ValidatesTimeliness::Extensions::DateTimeSelect)
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe 'ValidatesTimeliness::Extensions::MultiparameterHandler' do

context "time column" do
it 'should be nil invalid date portion' do
context "datetime column" do
it 'should be nil for invalid date portion' do
employee = record_with_multiparameter_attribute(:birth_datetime, [2000, 2, 31, 12, 0, 0])
expect(employee.birth_datetime).to be_nil
end
Expand Down
2 changes: 1 addition & 1 deletion spec/validates_timeliness/helper_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
expect(record.errors[:birth_date]).not_to be_empty
end

it 'should validate instance using instance valiation method' do
it 'should validate instance using instance validation method' do
record.validates_date :birth_date

expect(record.errors[:birth_date]).not_to be_empty
Expand Down
2 changes: 1 addition & 1 deletion spec/validates_timeliness/railtie_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'validates_timeliness/railtie'

RSpec.describe ValidatesTimeliness::Railtie do
context "intializers" do
context "initializers" do
context "validates_timeliness.initialize_timeliness_ambiguous_date_format" do
it 'should set the timeliness default ambiguous date format from the current format' do
expect(Timeliness.configuration.ambiguous_date_format).to eq :us
Expand Down
4 changes: 2 additions & 2 deletions spec/validates_timeliness/validator/after_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
invalid!(:birth_datetime, DateTime.civil_from_format(:local, 2010, 1, 1, 12, 0, 0), 'must be after 2010-01-01 12:00:00')
end

it "should be valid for datetime is before restriction" do
it "should not be valid for datetime before restriction" do
invalid!(:birth_datetime, DateTime.civil_from_format(:local, 2010, 1, 1, 11, 59, 59), 'must be after 2010-01-01 12:00:00')
end

it "should be valid for datetime is after restriction" do
it "should be valid for datetime after restriction" do
valid!(:birth_datetime, DateTime.civil_from_format(:local, 2010, 1, 1, 12, 0, 1))
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/validates_timeliness/validator/on_or_before_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
valid!(:birth_datetime, DateTime.civil_from_format(:local, 2010, 1, 1, 12, 0, 0))
end

it "should not be valid for datetime before restriction" do
it "should be valid for datetime before restriction" do
valid!(:birth_datetime, DateTime.civil_from_format(:local, 2010, 1, 1, 11, 59, 59))
end
end
Expand Down