Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

apply rubocop corrections

Sebastian Fiedlschusterf8b3039b4373
diff --git a/app/models/timestamp.rb b/app/models/timestamp.rb
index dc9ca0bf685..611d598a039 100644
--- a/app/models/timestamp.rb
+++ b/app/models/timestamp.rb
@@ -1,56 +1,59 @@
class Timestamp
-
def initialize(arg = Timestamp.now.to_s)
- if arg.kind_of? String
+ if arg.is_a? String
@timestamp_iso8601_string = arg
elsif arg.respond_to? :iso8601
@timestamp_iso8601_string = arg.iso8601
else
- raise Timestamp::Exception, "Argument type not supported. Please provide a String or anything that responds to :iso8601, e.g. a Time."
+ raise Timestamp::Exception, \
+ "Argument type not supported. " \
+ "Please provide an ISO-8601 String or anything that responds to :iso8601, e.g. a Time."
end
end
-
+
def self.parse(iso8601_string)
if iso8601_string.start_with? "P" # ISO8601 "Period"
ActiveSupport::Duration.parse(iso8601_string)
else
- Time.parse(iso8601_string)
+ if Time.zone.parse(iso8601_string).blank?
+ raise ArgumentError, "The string \"#{iso8601_string}\" cannot be parsed to a Time."
+ end
end
Timestamp.new(iso8601_string)
end
-
+
def self.now
- self.new(ActiveSupport::Duration.build(0).iso8601)
+ new(ActiveSupport::Duration.build(0).iso8601)
end
-
+
def relative?
to_s.first == "P" # ISO8601 "Period"
end
-
+
def to_s
iso8601
end
-
+
def to_str
to_s
end
-
+
def iso8601
@timestamp_iso8601_string.to_s
end
-
+
def inspect
- "#<Timestamp \"#{to_s}\">"
+ "#<Timestamp \"#{iso8601}\">"
end
-
+
def to_time
if relative?
- Time.zone.now - to_duration * (to_duration.to_i.positive? ? 1 : -1)
+ Time.zone.now - (to_duration * (to_duration.to_i.positive? ? 1 : -1))
else
- Time.parse(self)
+ Time.zone.parse(self)
end
end
-
+
def to_duration
if relative?
ActiveSupport::Duration.parse(self)
@@ -58,18 +61,18 @@ class Timestamp
raise Timestamp::Exception, "This timestamp is absolute and cannot be represented as ActiveSupport::Duration."
end
end
-
+
def as_json
to_s
end
-
- def to_json
+
+ def to_json(*_args)
to_s
end
-
- def ==(other_timestamp)
- self.iso8601 == other_timestamp.iso8601
+
+ def ==(other)
+ iso8601 == other.iso8601
end
-
+
class Exception < StandardError; end
-end
\ No newline at end of file
+end
diff --git a/spec/models/query/results_filter_on_historic_data_spec.rb b/spec/models/query/results_filter_on_historic_data_spec.rb
index 6148d189ac3..c3873a64076 100644
--- a/spec/models/query/results_filter_on_historic_data_spec.rb
+++ b/spec/models/query/results_filter_on_historic_data_spec.rb
@@ -28,12 +28,13 @@
require 'spec_helper'
-describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: false do
+describe ::Query::Results, 'Filter on historic data', with_mail: false do
let(:historic_time) { "2022-08-01".to_datetime }
let(:pre_historic_time) { historic_time - 1.day }
let(:recent_time) { 1.hour.ago }
let!(:work_package) do
- new_work_package = create :work_package, description: "This is the original description of the work package", project: project_1
+ new_work_package = create(:work_package, description: "This is the original description of the work package",
+ project: project1)
new_work_package.update_columns created_at: historic_time
new_work_package.journals.first.update_columns created_at: historic_time, updated_at: historic_time
new_work_package.reload
@@ -43,16 +44,15 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
new_work_package
end
- let(:project_1) { create :project }
- let(:user_1) do
+ let(:project1) { create(:project) }
+ let(:user1) do
create(:user,
firstname: 'user',
lastname: '1',
- member_in_project: project_1,
- member_with_permissions: [:view_work_packages, :view_file_links])
+ member_in_project: project1,
+ member_with_permissions: %i[view_work_packages view_file_links])
end
-
describe "[prelims]" do
specify "the work package has a journal entry with the historic description" do
expect(work_package.journals.count).to eq 2
@@ -66,17 +66,19 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "#work_packages" do
let(:query) do
- login_as(user_1)
- build(:query, user: user_1, project: nil).tap do |query|
+ login_as(user1)
+ build(:query, user: user1, project: nil).tap do |query|
query.filters.clear
query.add_filter 'description', '~', search_term
end
end
let(:results) { query.results }
+
subject { results.work_packages }
describe "filter for description containing 'current'" do
let(:search_term) { 'current' }
+
it "includes the work package matching today" do
expect(subject).to include work_package
end
@@ -84,6 +86,7 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "filter for description containing 'original'" do
let(:search_term) { 'original' }
+
it "does not include the work package matching only in the past" do
expect(subject).not_to include work_package
end
@@ -94,6 +97,7 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "filter for description containing 'current'" do
let(:search_term) { 'current' }
+
it "includes the work package matching today" do
expect(subject).to include work_package
end
@@ -101,6 +105,7 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "filter for description containing 'original'" do
let(:search_term) { 'original' }
+
it "includes the work package matching in the past" do
expect(subject).to include work_package
end
@@ -112,6 +117,7 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "filter for description containing 'current'" do
let(:search_term) { 'current' }
+
it "does not include the work package matching only in the past" do
expect(subject).not_to include work_package
end
@@ -143,6 +149,7 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "filter for description containing 'current'" do
let(:search_term) { 'current' }
+
it "does not include the work package matching only in the past" do
expect(subject).not_to include work_package
end
@@ -150,6 +157,7 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "filter for description containing 'original'" do
let(:search_term) { 'original' }
+
it "does not include the work package because it does not exist yet at that time" do
expect(subject).not_to include work_package
end
@@ -159,21 +167,21 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
describe "when filtering for file links" do
# https://github.com/opf/openproject/pull/11678#issuecomment-1326171087
- let(:storage_1) { create(:storage, creator: user_1) }
- let(:file_link_1) { create(:file_link, creator: user_1, container: work_package, storage: storage_1) }
- let(:project_storage_1) { create(:project_storage, project: project_1, storage: storage_1) }
- before do
- project_storage_1
- file_link_1
- end
-
+ let(:storage1) { create(:storage, creator: user1) }
let(:query) do
- login_as(user_1)
- build(:query, user: user_1, project: nil).tap do |query|
+ login_as(user1)
+ build(:query, user: user1, project: nil).tap do |query|
query.filters.clear
- query.add_filter 'file_link_origin_id', '=', [file_link_1.origin_id.to_s]
+ query.add_filter 'file_link_origin_id', '=', [file_link1.origin_id.to_s]
end
end
+ let(:file_link1) { create(:file_link, creator: user1, container: work_package, storage: storage1) }
+ let(:project_storage1) { create(:project_storage, project: project1, storage: storage1) }
+
+ before do
+ project_storage1
+ file_link1
+ end
it "includes the work package" do
expect(subject).to include work_package
@@ -184,15 +192,16 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
end
describe "when having second reference to the same external file" do
- let(:storage_2) { create(:storage, creator: user_1) }
- let(:file_link_2) { create(:file_link, creator: user_1, container: work_package, storage: storage_2) }
- let(:project_storage_2) { create(:project_storage, project: project_2, storage: storage_2) }
- let(:project_2) { create :project }
- let(:file_link_2) { create(:file_link, creator: user_1, container: work_package, storage: storage_2, origin_id: file_link_1.origin_id) }
+ let(:storage2) { create(:storage, creator: user1) }
+ let(:project_storage2) { create(:project_storage, project: project2, storage: storage2) }
+ let(:project2) { create(:project) }
+ let(:file_link2) do
+ create(:file_link, creator: user1, container: work_package, storage: storage2, origin_id: file_link1.origin_id)
+ end
before do
- project_storage_2
- file_link_2
+ project_storage2
+ file_link2
end
it "includes the work package" do
@@ -204,6 +213,5 @@ describe ::Query::Results, 'Filter on historic data', type: :model, with_mail: f
end
end
end
-
end
end
diff --git a/spec/models/query/results_sort_intergration_spec.rb b/spec/models/query/results_sort_intergration_spec.rb
index 84118e6a057..f4f51d00779 100644
--- a/spec/models/query/results_sort_intergration_spec.rb
+++ b/spec/models/query/results_sort_intergration_spec.rb
@@ -264,6 +264,7 @@ describe ::Query::Results, 'sorting and grouping', with_mail: false do
let(:work_package1) { create(:work_package, project: project1) }
let(:work_package2) { create(:work_package, project: project2) }
let(:work_package3) { create(:work_package, project: project3) }
+
before { [work_package1, work_package2, work_package3] }
context 'when ascending' do
@@ -298,6 +299,7 @@ describe ::Query::Results, 'sorting and grouping', with_mail: false do
let(:work_package1) { create(:work_package, project: project1, category: category1) }
let(:work_package2) { create(:work_package, project: project1, category: category2) }
let(:work_package3) { create(:work_package, project: project1, category: category3) }
+
before { [work_package1, work_package2, work_package3] }
context 'when ascending' do
@@ -332,6 +334,7 @@ describe ::Query::Results, 'sorting and grouping', with_mail: false do
let(:work_package1) { create(:work_package, project: project1, subject: 'WorkPackage A') }
let(:work_package2) { create(:work_package, project: project1, subject: 'WorkPackage b') }
let(:work_package3) { create(:work_package, project: project1, subject: 'WorkPackage C') }
+
before { [work_package1, work_package2, work_package3] }
context 'when ascending' do
@@ -366,6 +369,7 @@ describe ::Query::Results, 'sorting and grouping', with_mail: false do
let(:work_package1) { create(:work_package, project: project1, due_date: 3.days.ago) }
let(:work_package2) { create(:work_package, project: project1, due_date: 2.days.ago) }
let(:work_package3) { create(:work_package, project: project1, due_date: 1.day.ago) }
+
before { [work_package1, work_package2, work_package3] }
context 'when ascending' do
@@ -418,9 +422,10 @@ describe ::Query::Results, 'sorting and grouping', with_mail: false do
customized: work_package3,
value: 'String C')
end
- before { [work_package1, work_package2, work_package3] }
before do
+ [work_package1, work_package2, work_package3]
+
work_package1.project.work_package_custom_fields << string_cf
work_package1.type.custom_fields << string_cf
@@ -478,9 +483,10 @@ describe ::Query::Results, 'sorting and grouping', with_mail: false do
customized: work_package3,
value: 3)
end
- before { [work_package1, work_package2, work_package3] }
before do
+ [work_package1, work_package2, work_package3]
+
work_package1.project.work_package_custom_fields << int_cf
work_package1.type.custom_fields << int_cf
diff --git a/spec/models/query/timestamps_spec.rb b/spec/models/query/timestamps_spec.rb
index 1932a876389..29767ea9f91 100644
--- a/spec/models/query/timestamps_spec.rb
+++ b/spec/models/query/timestamps_spec.rb
@@ -28,72 +28,75 @@
require 'spec_helper'
-describe Query::Timestamps, type: :model do
-
+describe Query::Timestamps do
describe "#timestamps" do
subject { query.timestamps }
+
describe "after setting timestamps to an array of ISO8601 Strings" do
let(:query) { Query.new }
+
before { query.timestamps = ["P-50Y", "2022-10-29T23:01:23Z"] }
-
+
it "returns an Array of Timestamp objects" do
- expect(subject).to be_kind_of Array
+ expect(subject).to be_a Array
expect(subject.map(&:class).uniq).to eq [Timestamp]
end
-
+
it "remembers which timestamp encodes a relative time" do
- expect(subject.first.relative?).to eq true
- expect(subject.last.relative?).to eq false
+ expect(subject.first.relative?).to be true
+ expect(subject.last.relative?).to be false
end
end
-
+
describe "after setting timestamps to an array of Times" do
let(:query) { Query.new }
+
before { query.timestamps = [50.years.ago, Time.zone.now] }
it "returns an Array of Timestamp objects" do
- expect(subject).to be_kind_of Array
+ expect(subject).to be_a Array
expect(subject.map(&:class).uniq).to eq [Timestamp]
end
end
-
+
describe "when not present" do
let(:query) { Query.new }
+
before { query.timestamps = [] }
-
+
it "still returns the timestamp corresponding to the present time" do
expect(subject).to eq [Timestamp.now]
end
end
-
+
describe "[persistence] when saving timestamps to a record" do
- let(:query) { create :query }
+ let(:query) { create(:query) }
+
before do
query.timestamps = ["P-50Y", "2022-10-29T23:01:23Z"]
query.save!
end
-
+
describe "after reloading the record from the database" do
let(:reloaded_query) { Query.find(query.id) }
+
subject { reloaded_query.timestamps }
-
+
it "returns an Array of Timestamp objects" do
- expect(subject).to be_kind_of Array
+ expect(subject).to be_a Array
expect(subject.map(&:class).uniq).to eq [Timestamp]
end
-
+
it "remembers which timestamp encodes a relative time" do
- expect(subject.first.relative?).to eq true
- expect(subject.last.relative?).to eq false
+ expect(subject.first.relative?).to be true
+ expect(subject.last.relative?).to be false
end
-
+
it "remembers the timestamp values" do
expect(subject.first.iso8601).to eq "P-50Y"
expect(subject.last.iso8601).to eq "2022-10-29T23:01:23Z"
end
end
-
end
end
-
end
diff --git a/spec/models/timestamp_spec.rb b/spec/models/timestamp_spec.rb
index af1b5aef791..b2ed5870899 100644
--- a/spec/models/timestamp_spec.rb
+++ b/spec/models/timestamp_spec.rb
@@ -28,123 +28,131 @@
require 'spec_helper'
-describe Timestamp, type: :model do
-
+describe Timestamp do
describe ".new" do
describe "when calling without argument" do
- subject { Timestamp.new }
-
+ subject { described_class.new }
+
it "returns Timestamp.now" do
- expect(subject.to_s).to eq Timestamp.now.to_s
+ expect(subject.to_s).to eq described_class.now.to_s
end
end
-
+
describe "when providing an ISO8601 String" do
- subject { Timestamp.new("PT10S") }
-
- it "returns a Timestamp" do
- expect(subject).to be_kind_of Timestamp
+ subject { described_class.new("PT10S") }
+
+ it "returns a described_class" do
+ expect(subject).to be_a described_class
end
-
+
specify "the argument is retrievable via to_s" do
expect(subject.to_s).to eq "PT10S"
end
end
-
+
describe "when providing a Time" do
let(:time) { Time.zone.now }
- subject { Timestamp.new(time) }
-
- it "returns an absolute Timestamp representing that time (up to full seconds)" do
- expect(subject).to be_kind_of Timestamp
- expect(subject.relative?).to eq false
- expect(subject.to_time).to eq Time.at(time.to_i)
+
+ subject { described_class.new(time) }
+
+ it "returns an absolute described_class representing that time (up to full seconds)" do
+ expect(subject).to be_a described_class
+ expect(subject.relative?).to be false
+ expect(subject.to_time).to eq Time.zone.at(time.to_i)
end
end
-
+
describe "when providing a non-supported object" do
- subject { Timestamp.new(:foo) }
-
+ subject { described_class.new(:foo) }
+
it "raises an error" do
- expect { subject }.to raise_error Timestamp::Exception
+ expect { subject }.to raise_error described_class::Exception
end
end
end
-
+
describe ".now" do
- subject { Timestamp.now }
-
- it "returns a Timestamp" do
- expect(subject).to be_kind_of Timestamp
+ subject { described_class.now }
+
+ it "returns a described_class" do
+ expect(subject).to be_a described_class
end
-
+
it "returns a relative timestamp" do
- expect(subject.relative?).to eq true
+ expect(subject.relative?).to be true
end
-
+
it "corresponds to a duration of 0 seconds (ago)" do
expect(subject.to_duration).to eq ActiveSupport::Duration.build(0)
end
end
-
+
describe ".parse" do
describe "when providing a valid ISO8601 duration" do
- subject { Timestamp.parse("PT10S") }
-
- it "returns a Timestamp representing a time ago that duration" do
- expect(subject).to be_kind_of Timestamp
+ subject { described_class.parse("PT10S") }
+
+ it "returns a described_class representing a time ago that duration" do
+ expect(subject).to be_a described_class
expect(subject.to_s).to eq "PT10S"
expect(subject.to_duration).to eq ActiveSupport::Duration.build(10)
- expect(subject.relative?).to eq true
+ expect(subject.relative?).to be true
end
end
-
+
describe "when providing a valid ISO8601 time" do
- subject { Timestamp.parse("2022-10-29T21:55:58Z") }
-
- it "returns a Timestamp representing that absolute time" do
- expect(subject).to be_kind_of Timestamp
+ subject { described_class.parse("2022-10-29T21:55:58Z") }
+
+ it "returns a described_class representing that absolute time" do
+ expect(subject).to be_a described_class
expect(subject.to_s).to eq "2022-10-29T21:55:58Z"
- expect(subject.to_time).to eq Time.parse("2022-10-29T21:55:58Z")
- expect(subject.relative?).to eq false
+ expect(subject.to_time).to eq Time.zone.parse("2022-10-29T21:55:58Z")
+ expect(subject.relative?).to be false
end
end
-
+
describe "when providing something invalid" do
- subject { Timestamp.parse("foo") }
-
+ subject { described_class.parse("foo") }
+
it "raises an error" do
expect { subject }.to raise_error ArgumentError
end
end
end
-
+
describe "#relative?" do
- subject { timestamp.relative?}
+ subject { timestamp.relative? }
+
describe "for a timestamp representing an absolute time" do
- let(:timestamp) { Timestamp.new(Time.zone.now - 1.year) }
+ let(:timestamp) { described_class.new(1.year.ago) }
+
it "returns false" do
- expect(subject).to eq false
+ expect(subject).to be false
end
end
+
describe "for a timestamp representing a point in time relative to now" do
- let(:timestamp) { Timestamp.new("PT10S") }
+ let(:timestamp) { described_class.new("PT10S") }
+
it "returns true" do
- expect(subject).to eq true
+ expect(subject).to be true
end
end
end
-
+
describe "#iso8601" do
subject { timestamp.iso8601 }
+
describe "for a timestamp representing an absolute time" do
- let(:timestamp) { Timestamp.new(Time.zone.now - 1.year) }
+ let(:timestamp) { described_class.new(1.year.ago) }
+
it "returns an ISO8601 String representing that time" do
expect(subject).to eq timestamp.to_time.iso8601
end
end
+
describe "for a timestamp representing a point in time relative to now" do
- let(:timestamp) { Timestamp.new("PT10S") }
+ let(:timestamp) { described_class.new("PT10S") }
+
it "returns an ISO8601 String representing the duration between that time and now" do
expect(subject).to eq "PT10S"
expect(subject).to eq ActiveSupport::Duration.build(10).iso8601
@@ -154,14 +162,18 @@ describe Timestamp, type: :model do
describe "#to_s" do
subject { timestamp.to_s }
+
describe "for a timestamp representing an absolute time" do
- let(:timestamp) { Timestamp.new(Time.zone.now - 1.year) }
+ let(:timestamp) { described_class.new(1.year.ago) }
+
it "returns an ISO8601 String representing that time" do
expect(subject).to eq timestamp.to_time.iso8601
end
end
+
describe "for a timestamp representing a point in time relative to now" do
- let(:timestamp) { Timestamp.new("PT10S") }
+ let(:timestamp) { described_class.new("PT10S") }
+
it "returns an ISO8601 String representing the duration between that time and now" do
expect(subject).to eq "PT10S"
expect(subject).to eq ActiveSupport::Duration.build(10).iso8601
@@ -171,86 +183,98 @@ describe Timestamp, type: :model do
describe "#to_json" do
subject { timestamp.to_json }
+
describe "for a timestamp representing an absolute time" do
- let(:timestamp) { Timestamp.new(Time.zone.now - 1.year) }
+ let(:timestamp) { described_class.new(1.year.ago) }
+
it "returns an ISO8601 String representing that time" do
expect(subject).to eq timestamp.to_time.iso8601
end
end
+
describe "for a timestamp representing a point in time relative to now" do
- let(:timestamp) { Timestamp.new("PT10S") }
+ let(:timestamp) { described_class.new("PT10S") }
+
it "returns an ISO8601 String representing the duration between that time and now" do
expect(subject).to eq "PT10S"
expect(subject).to eq ActiveSupport::Duration.build(10).iso8601
end
end
end
-
+
describe "#to_time" do
subject { timestamp.to_time }
+
describe "for a timestamp representing an absolute time" do
- let(:time) { Time.zone.now - 1.year }
- let(:timestamp) { Timestamp.new(time) }
+ let(:time) { 1.year.ago }
+ let(:timestamp) { described_class.new(time) }
+
it "returns a Time representing that time (up to full seconds)" do
- expect(subject).to be_kind_of Time
- expect(subject).to eq Time.at(time.to_i)
+ expect(subject).to be_a Time
+ expect(subject).to eq Time.zone.at(time.to_i)
end
end
+
describe "for a timestamp representing a point in time relative to now" do
Timecop.freeze do
- let(:timestamp) { Timestamp.new("PT10S") }
+ let(:timestamp) { described_class.new("PT10S") }
it "returns a Time converting the relative time to an absolute time (relative to now at evaluation time)" do
- expect(subject).to be_kind_of Time
- expect(Time.at(subject.to_i)).to eq Time.at(10.seconds.ago.to_i)
+ expect(subject).to be_a Time
+ expect(Time.zone.at(subject.to_i)).to eq Time.zone.at(10.seconds.ago.to_i)
end
end
end
+
describe "for a timestamp representing a point in time relative to now with negative duration" do
Timecop.freeze do
- let(:timestamp) { Timestamp.new("PT-10S") }
+ let(:timestamp) { described_class.new("PT-10S") }
it "returns a Time converting the relative time to an absolute time (relative to now at evaluation time)" do
- expect(subject).to be_kind_of Time
- expect(Time.at(subject.to_i)).to eq Time.at(10.seconds.ago.to_i)
+ expect(subject).to be_a Time
+ expect(Time.zone.at(subject.to_i)).to eq Time.zone.at(10.seconds.ago.to_i)
end
end
end
end
-
+
describe "#to_duration" do
subject { timestamp.to_duration }
+
describe "for a timestamp representing an absolute time" do
- let(:time) { Time.zone.now - 1.year }
- let(:timestamp) { Timestamp.new(time) }
- it "raises an error because the absolute time does not change when the current time progresses and therefore cannot be represented as constant duration" do
- expect { subject }.to raise_error Timestamp::Exception
+ let(:time) { 1.year.ago }
+ let(:timestamp) { described_class.new(time) }
+
+ it "raises an error because the absolute time does not change when the current time progresses " \
+ "and therefore cannot be represented as constant duration" do
+ expect { subject }.to raise_error described_class::Exception
end
end
+
describe "for a timestamp representing a point in time relative to now" do
Timecop.freeze do
- let(:timestamp) { Timestamp.new("PT10S") }
+ let(:timestamp) { described_class.new("PT10S") }
it "returns an ActiveSupport::Duration corresponding to the duration between the timestamp and now" do
- expect(subject).to be_kind_of ActiveSupport::Duration
+ expect(subject).to be_a ActiveSupport::Duration
expect(subject).to eq ActiveSupport::Duration.build(10)
end
end
end
end
-
- describe "passing a Timestamp to a where clause" do
+
+ describe "passing a described_class to a where clause" do
subject { Query.where("updated_at < ?", timestamp) }
- let(:timestamp) { Timestamp.new("PT10S") }
-
+
+ let(:timestamp) { described_class.new("PT10S") }
+
it "raises an error because the query interface requires a Time type" do
expect { subject }.to raise_error TypeError
end
-
+
describe "when converting the timestamp to_time" do
subject { Query.where("updated_at < ?", timestamp.to_time) }
-
+
it "raises no error" do
expect { subject }.not_to raise_error TypeError
end
end
end
-
-end
\ No newline at end of file
+end