datastax_rails 1.0.6 → 1.0.8

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.
data/spec/spec_helper.rb CHANGED
@@ -8,9 +8,10 @@ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
8
8
 
9
9
  # Requires supporting ruby files with custom matchers and macros, etc,
10
10
  # in spec/support/ and its subdirectories.
11
- Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
11
+ Dir[File.expand_path(File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb"))].each {|f| require f }
12
12
 
13
13
  RSpec.configure do |config|
14
+ config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
14
15
  config.before(:each) do
15
16
  DatastaxRails::Base.recorded_classes = {}
16
17
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples_for 'default_consistency' do
4
+ it "should default to QUORUM" do
5
+ cql = DatastaxRails::Cql::Select.new(@model_class, ["*"])
6
+ cql.to_cql.should match(/using consistency quorum/i)
7
+ end
8
+
9
+ it "should default to level specified by model class" do
10
+ @model_class.stub(:default_consistency => 'LOCAL_QUORUM')
11
+ cql = DatastaxRails::Cql::Select.new(@model_class, ["*"])
12
+ cql.to_cql.should match(/using consistency local_quorum/i)
13
+ end
14
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datastax_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 6
10
- version: 1.0.6
9
+ - 8
10
+ version: 1.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason M. Kusar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-07-25 00:00:00 Z
18
+ date: 2012-08-01 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -69,14 +69,12 @@ dependencies:
69
69
  requirement: &id004 !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements:
72
- - - ~>
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
- hash: 43
74
+ hash: 3
75
75
  segments:
76
- - 2
77
- - 9
78
76
  - 0
79
- version: 2.9.0
77
+ version: "0"
80
78
  type: :development
81
79
  version_requirements: *id004
82
80
  - !ruby/object:Gem::Dependency
@@ -148,7 +146,6 @@ files:
148
146
  - lib/datastax_rails/cql/delete.rb
149
147
  - lib/datastax_rails/attribute_methods.rb
150
148
  - lib/datastax_rails/connection.rb
151
- - lib/datastax_rails/consistency.rb
152
149
  - lib/datastax_rails/reflection.rb
153
150
  - lib/datastax_rails/identity/custom_key_factory.rb
154
151
  - lib/datastax_rails/identity/uuid_key_factory.rb
@@ -207,15 +204,16 @@ files:
207
204
  - lib/datastax_rails/persistence.rb
208
205
  - lib/datastax_rails/version.rb
209
206
  - lib/datastax_rails.rb
210
- - lib/solr_no_escape.rb
211
207
  - MIT-LICENSE
212
208
  - Rakefile
213
209
  - README.rdoc
210
+ - spec/support/default_consistency_shared_examples.rb
214
211
  - spec/support/models.rb
215
212
  - spec/support/datastax_test_hook.rb
216
213
  - spec/datastax_rails/attribute_methods_spec.rb
217
214
  - spec/datastax_rails/cql/update_spec.rb
218
215
  - spec/datastax_rails/cql/select_spec.rb
216
+ - spec/datastax_rails/persistence_spec.rb
219
217
  - spec/datastax_rails/associations/belongs_to_association_spec.rb
220
218
  - spec/datastax_rails/associations/has_many_association_spec.rb
221
219
  - spec/datastax_rails/relation_spec.rb
@@ -297,11 +295,13 @@ signing_key:
297
295
  specification_version: 3
298
296
  summary: A Ruby-on-Rails interface to Datastax Enterprise
299
297
  test_files:
298
+ - spec/support/default_consistency_shared_examples.rb
300
299
  - spec/support/models.rb
301
300
  - spec/support/datastax_test_hook.rb
302
301
  - spec/datastax_rails/attribute_methods_spec.rb
303
302
  - spec/datastax_rails/cql/update_spec.rb
304
303
  - spec/datastax_rails/cql/select_spec.rb
304
+ - spec/datastax_rails/persistence_spec.rb
305
305
  - spec/datastax_rails/associations/belongs_to_association_spec.rb
306
306
  - spec/datastax_rails/associations/has_many_association_spec.rb
307
307
  - spec/datastax_rails/relation_spec.rb
@@ -1,33 +0,0 @@
1
- module DatastaxRails
2
- module Consistency
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- cattr_accessor :consistency_levels
7
- self.consistency_levels = [:one, :quorum, :all]
8
-
9
- class_attribute :write_consistency
10
- class_attribute :read_consistency
11
- self.write_consistency = :quorum
12
- self.read_consistency = :quorum
13
- end
14
-
15
- module ClassMethods
16
- THRIFT_LEVELS = {
17
- :one => 'ONE',
18
- :quorum => 'QUORUM',
19
- :local_quorum => 'LOCAL_QUORUM',
20
- :each_quorum => 'EACH_QUORUM',
21
- :all => 'ALL'
22
- }
23
-
24
- def thrift_read_consistency
25
- THRIFT_LEVELS[read_consistency] || (raise "Invalid consistency level #{read_consistency}")
26
- end
27
-
28
- def thrift_write_consistency
29
- THRIFT_LEVELS[write_consistency] || (raise "Invalid consistency level #{write_consistency}")
30
- end
31
- end
32
- end
33
- end
@@ -1,28 +0,0 @@
1
- require 'sunspot'
2
- module SolrNoEscape
3
- def escape(str)
4
- # We are purposely not escaping since we want people to be able to do
5
- # advanced queries that otherwise wouldn't work. Spaces are a special
6
- # case due to later URL escaping.
7
- str.gsub(/ /,"\\\\ ")
8
- end
9
- end
10
-
11
- module Sunspot
12
- module Query
13
- class FunctionQuery
14
- include SolrNoEscape
15
- end
16
- end
17
- end
18
-
19
- module Sunspot
20
- module Query
21
- module Restriction
22
- class Base
23
- include SolrNoEscape
24
- end
25
- end
26
- end
27
- end
28
-