spec/integration/riak/time_series_spec.rb in riak-client-2.3.1 vs spec/integration/riak/time_series_spec.rb in riak-client-2.3.2
- old
+ new
@@ -36,28 +36,70 @@
WHERE
#{family_series_str} AND
#{now_range_str}
SQL
end
- let(:no_data_query) do
+
+ let(:no_data_query) do
<<-SQL
SELECT * FROM #{table_name}
WHERE
#{family_series_str} AND
#{never_range_str}
SQL
end
+ let(:describe_table) do
+ "DESCRIBE #{table_name}"
+ end
+
+ let(:create_table) do
+ <<-SQL
+CREATE TABLE timeseries-#{random_key} (
+ geohash varchar not null,
+ user varchar not null,
+ time timestamp not null,
+ weather varchar not null,
+ temperature double,
+ PRIMARY KEY(
+ (geohash, user, quantum(time, 15, m)),
+ geohash, user, time
+ )
+)
+SQL
+ end
+
let(:stored_datum_expectation) do
submission = Riak::TimeSeries::Submission.new test_client, table_name
submission.measurements = [datum]
expect{ submission.write! }.to_not raise_error
end
let(:stored_datum_null_expectation) do
submission = Riak::TimeSeries::Submission.new test_client, table_name
submission.measurements = [datum_null]
expect{ submission.write! }.to_not raise_error
+ end
+
+ describe 'create table via query' do
+ subject{ Riak::TimeSeries::Query.new test_client, create_table }
+
+ it 'creates a new table without error' do
+ expect{ subject.issue! }.to_not raise_error
+ expect(subject.results).to be
+ expect(subject.results).to be_empty
+ end
+ end
+
+ describe 'describe table via query' do
+ subject{ Riak::TimeSeries::Query.new test_client, describe_table }
+
+ it 'describes a table without error' do
+ expect{ subject.issue! }.to_not raise_error
+ expect(subject.results).to be
+ expect(subject.results).to_not be_empty
+ expect(subject.results.columns).to_not be_empty
+ end
end
describe 'query interface' do
subject{ Riak::TimeSeries::Query.new test_client, query }
let(:subject_without_data) do