This repository has been archived by the owner on Nov 30, 2018. It is now read-only.
/
table_operation_spec.rb
45 lines (39 loc) · 1.65 KB
/
table_operation_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
describe Stargate::Operation::TableOperation do
before :all do
url = ENV["STARGATE_URL"].nil? ? "http://localhost:8080" : ENV["STARGATE_URL"]
@client = Stargate::Client.new(url)
end
it "should create a table called test-stargate-client" do
table = @client.create_table('test-stargate-client', { :name => 'habbit',
:max_version => 3,
:compression => Stargate::Model::CompressionType::NONE,
:in_memory => false,
:block_cache => false,
:ttl => -1,
:max_cell_size => 2147483647,
:bloomfilter => false
})
table.should.is_a? Stargate::Model::TableDescriptor
end
it "should show the table info of 'test-stargate-client'" do
table = @client.show_table('test-stargate-client')
table.should.is_a? Stargate::Model::TableDescriptor
table.name.should == "test-stargate-client"
table.column_families.should respond_to(:each)
table.column_families.map(&:name).should include("habbit")
table.column_families.each do |cf|
cf.should.is_a? Stargate::Model::ColumnDescriptor
end
end
it "should delete the table 'test-stargate-client'" do
lambda {
table = @client.destroy_table("test-stargate-client")
}.should_not raise_error
lambda {
table = @client.show_table("test-stargate-client")
}.should raise_error(Stargate::TableNotFoundError)
end
after :all do
end
end