Skip to content

Commit

Permalink
Use interpolation instead of join in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Sep 22, 2023
1 parent b7bbcef commit cdd2f04
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions spec/chrono_model/adapter/ddl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
include ChronoTest::Adapter::Helpers
include ChronoTest::Adapter::Structure

let(:current) { [ChronoModel::Adapter::TEMPORAL_SCHEMA, table].join('.') }
let(:history) { [ChronoModel::Adapter::HISTORY_SCHEMA, table].join('.') }
let(:current) { "#{ChronoModel::Adapter::TEMPORAL_SCHEMA}.#{table}" }
let(:history) { "#{ChronoModel::Adapter::HISTORY_SCHEMA}.#{table}" }

def count(table)
adapter.select_value("SELECT COUNT(*) FROM ONLY #{table}").to_i
Expand Down
6 changes: 3 additions & 3 deletions spec/chrono_model/time_machine/timestamps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
let(:record) { $t.foo.history.first }

(history_methods + current_methods).each do |attr|
describe ['#', attr].join do
describe "##{attr}" do
subject { record.public_send(attr) }

it { is_expected.to be_present }
Expand All @@ -27,15 +27,15 @@
let(:record) { $t.foo }

history_methods.each do |attr|
describe ['#', attr].join do
describe "##{attr}" do
subject(:attribute) { record.public_send(attr) }

it { expect { attribute }.to raise_error(NoMethodError) }
end
end

current_methods.each do |attr|
describe ['#', attr].join do
describe "##{attr}" do
subject { record.public_send(attr) }

it { is_expected.to be_nil }
Expand Down
4 changes: 2 additions & 2 deletions spec/support/matchers/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def has_history_indexes?
AND tablename = ?
SQL

fqtn = [history_schema, table].join('.')
fqtn = "#{history_schema}.#{table}"

expected = [
"CREATE INDEX index_#{table}_temporal_on_lower_validity ON #{fqtn} USING btree (lower(validity))",
Expand All @@ -169,7 +169,7 @@ def has_consistency_constraint?
binds = {
conname: connection.timeline_consistency_constraint_name(table),
connamespace: history_schema,
conrelid: [history_schema, table].join('.'),
conrelid: "#{history_schema}.#{table}",
attname: connection.primary_key(table)
}

Expand Down

0 comments on commit cdd2f04

Please sign in to comment.