cassandro 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmNlNzM0YjQyYTIyYjAzN2NjMzA5ODJjNjI1N2Y1ODhiNjZhMDBjMQ==
4
+ MjFhNGEwMGIyYTgyOTkyMmExODA3NGZlZDJiNGJkM2ZjNzM2Nzk0Zg==
5
5
  data.tar.gz: !binary |-
6
- YjFhNWQyY2UyMzI1YmY0MzBkMjBhODE5NDk3ZjczNTYwYmM0YzU3MA==
6
+ ZjMxYzk2YWY1ODM2MGZjOWVjYTk2ZmE1ZWJmMDk1ZWQ0NDZiMzQyNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2RlYTkzOWM1N2ZlNzQ1MTQ4NjA1YzI0MDNmYWQ3ZTViZTkxZWFjMmE0ZWRj
10
- ZDY2MmQyM2U0NWMyMmE5OWZlZjZmNWY4ODg0N2ZmN2NmMzRlZWRiM2I5MzZk
11
- NjFlZDM3YzE2NmZiNjViNGIwMjhhNzhhY2NmM2IxYWY5ZDRlZDI=
9
+ ZjNlZjIyMjQ5ZWY3MjliMWNiMDZmNGE1NmI0Y2ZiYWRhYTJjNTY1NmQ1ZDIx
10
+ MWE1MmRmMzRkOTRiNmU0OTczN2NiOTBkODI0NDMwNGIyYTAwMjFkMWFmNGIx
11
+ OWYzOWI1ZGNlOWUzYjBlOGE5NGI1ZDAzYjY4MzdlMWVlY2FhZmQ=
12
12
  data.tar.gz: !binary |-
13
- ODI4NjY1YmUwNWZlMTFhMTI5Yzc4ODg0Yzk1ZmYyYWQzNGU1ZTUzMGM0MmQ1
14
- NDhmMzQyZGJiMjc1NjY0YTMwYzE2ZWRlYTBjZmViMTJlMDBjZGE4NThlMGVj
15
- NTRjZGNlYzFmMmM2ZDk1ZWJjMTdmYWM3NmIwMmUyYzczNDI2YzE=
13
+ YWEyNGJlZWY1MDVmYjVhZDRiMDRkODczM2YwMDZkYTEzYWVjMmNjNTllNGJk
14
+ NjhmOGZjNWE2YzAyYWM4ZmNhMzMyYjUxZTM3ZTFjNDQ4MzFiODEzZmQwNjNi
15
+ ZTgzNzZkNmQ5MmFhOTJhZTQxNzRmOTM0N2RhYmQ0NzNkNTkwMzY=
data/cassandro.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "cassandro"
5
- s.version = "1.0.6"
5
+ s.version = "1.0.7"
6
6
  s.summary = "Ruby ORM for Apache Cassandra"
7
7
  s.license = "MIT"
8
8
  s.description = "Lightweight Apache Cassandra ORM for Ruby"
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.require_paths = ["lib"]
13
13
  s.add_dependency "cassandra-driver", '~> 1.2', '>= 1.0.0'
14
14
  s.add_development_dependency "protest", '~> 0.5', '>= 0.5.3'
15
+ s.add_development_dependency "rack-test", '~> 0.6', '>= 0.6.3'
15
16
 
16
17
  s.files = `git ls-files`.split("\n")
17
18
  end
@@ -301,6 +301,12 @@ module Cassandro
301
301
  attrs ||= @attributes
302
302
 
303
303
  attrs.each do |k, v|
304
+ # bypassed nil values to avoid type casting errors
305
+ if attrs[k].nil?
306
+ n_attrs << nil
307
+ next
308
+ end
309
+
304
310
  case self.class.casts[k]
305
311
  when :uuid
306
312
  n_attrs << Cassandra::Uuid.new(attrs[k])
@@ -81,6 +81,30 @@ Protest.describe "Cassandro Model" do
81
81
  end
82
82
  end
83
83
 
84
+ context 'Saving' do
85
+ setup do
86
+ class TestAttributes < Cassandro::Model
87
+ table 'tests_attributes'
88
+
89
+ attribute :test_col_1, :uuid
90
+ attribute :test_col_2, :text
91
+ attribute :test_col_3, :datetime
92
+
93
+ primary_key :test_col_1
94
+ unique :test_col_1
95
+ end
96
+
97
+ Cassandro.truncate_table('tests_attributes')
98
+ end
99
+
100
+ test "save a row with nil values" do
101
+ test = TestAttributes.create(test_col_1: SecureRandom.uuid, test_col_2: 'test_value_2', test_col_3: DateTime.now)
102
+ test.test_col_3 = nil
103
+ assert test.save
104
+ assert test.persisted?
105
+ end
106
+ end
107
+
84
108
  context 'Querying' do
85
109
  setup do
86
110
  class Test < Cassandro::Model
data/test/helper.rb CHANGED
@@ -21,4 +21,4 @@ class Protest::TestCase
21
21
  include Rack::Test::Methods
22
22
  end
23
23
 
24
- Protest.report_with(:turn)
24
+ ENV["PROTEST_REPORT"] ||= "turn"
@@ -8,6 +8,17 @@ table = <<-TABLEDEF
8
8
  TABLEDEF
9
9
  SESSION.execute(table)
10
10
 
11
+ SESSION.execute("DROP TABLE IF EXISTS tests_attributes")
12
+ table = <<-TABLEDEF
13
+ CREATE TABLE IF NOT EXISTS tests_attributes (
14
+ test_col_1 UUID,
15
+ test_col_2 VARCHAR,
16
+ test_col_3 TIMESTAMP,
17
+ PRIMARY KEY(test_col_1)
18
+ )
19
+ TABLEDEF
20
+ SESSION.execute(table)
21
+
11
22
  SESSION.execute("DROP TABLE IF EXISTS patients")
12
23
  table = <<-TABLEDEF
13
24
  CREATE TABLE IF NOT EXISTS patients (
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandro
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lautaro Orazi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-02 00:00:00.000000000 Z
12
+ date: 2015-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cassandra-driver
@@ -51,6 +51,26 @@ dependencies:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: 0.5.3
54
+ - !ruby/object:Gem::Dependency
55
+ name: rack-test
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '0.6'
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: 0.6.3
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: '0.6'
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: 0.6.3
54
74
  description: Lightweight Apache Cassandra ORM for Ruby
55
75
  email:
56
76
  - orazile@gmail.com