Skip to content

Commit

Permalink
Fix spec issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatas committed Sep 6, 2024
1 parent 22a86fa commit 4d6c60d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
require_relative "support/active_record/models"
require_relative "support/active_record/schema"

Dotenv.load!
Dotenv.load! if File.exists?(".env")

# Establish a connection for testing

ActiveRecord::Base.establish_connection(ENV['PG_URI_TEST'])
Timescaledb.establish_connection(ENV['PG_URI_TEST'])
Expand Down
2 changes: 2 additions & 0 deletions spec/support/active_record/models.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ActiveRecord::Base.extend Timescaledb::ActsAsHypertable

class Event < ActiveRecord::Base
self.primary_key = "identifier"

Expand Down
4 changes: 2 additions & 2 deletions spec/timescaledb/schema_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
Event
.from("event_counts")
.select("time_bucket('1d', time) as time,
identifier as label,
sum(value) as value").group("1,2")
sum(value) as value").group("1")
end

context "schema" do
Expand Down Expand Up @@ -78,6 +77,7 @@
end

it "dumps a create_continuous_aggregate for a view in the database" do
con.execute("DROP MATERIALIZED VIEW IF EXISTS event_daily_counts")
con.execute("DROP MATERIALIZED VIEW IF EXISTS event_counts")
con.create_continuous_aggregate(:event_counts, query, materialized_only: true, finalized: true)
con.create_continuous_aggregate(:event_daily_counts, query_daily, materialized_only: true, finalized: true)
Expand Down

0 comments on commit 4d6c60d

Please sign in to comment.