Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor specs, remove use of Bucket#keys(:reload => true)

Specs now use a common init file.
  • Loading branch information...
commit 954d339d35336ae7c7e5db9a1a063f0d89958669 1 parent b606b4b
Kyle Kingsbury authored
View
6 lib/risky.rb
@@ -86,9 +86,9 @@ def self.cast(data)
end
# Counts the number of values in the bucket via key streaming
- def self.count(opts = {:reload => true})
+ def self.count
count = 0
- bucket.keys(opts) do |keys|
+ bucket.keys do |keys|
count += keys.length
end
count
@@ -103,7 +103,7 @@ def self.delete(key, opts = {})
# Iterate over all items using key streaming.
def self.each
- bucket.keys(:reload => true) do |keys|
+ bucket.keys do |keys|
keys.each do |key|
if x = self[key]
yield x
View
8 spec/crud.rb
@@ -1,12 +1,6 @@
#!/usr/bin/env ruby
-require 'rubygems'
-require 'bacon'
-require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
-
-Bacon.summary_on_exit
-
-Risky.riak = Riak::Client.new(:host => '127.0.0.1')
+require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
class Crud < Risky
bucket 'crud'
View
8 spec/enumerable.rb
@@ -1,12 +1,6 @@
#!/usr/bin/env ruby
-require 'rubygems'
-require 'bacon'
-require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
-
-Bacon.summary_on_exit
-
-Risky.riak = Riak::Client.new(:host => '127.0.0.1')
+require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
class Enum < Risky
bucket 'enum'
View
6 spec/indexes.rb
@@ -1,10 +1,6 @@
#!/usr/bin/env ruby
-require 'rubygems'
-require 'bacon'
-require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
-
-Bacon.summary_on_exit
+require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
class Indexed < Risky
include Risky::Indexes
View
11 spec/init.rb
@@ -0,0 +1,11 @@
+require 'bacon'
+require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
+
+Bacon.summary_on_exit
+
+begin
+ Riak.disable_list_keys_warnings = true
+rescue
+end
+
+Risky.riak = Riak::Client.new(:host => '127.0.0.1')
View
7 spec/resolver.rb
@@ -1,14 +1,9 @@
#!/usr/bin/env ruby
-require 'rubygems'
-require 'bacon'
-require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
+require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
require 'risky/resolver'
require 'pp'
-Bacon.summary_on_exit
-
-Risky.riak = proc { Riak::Client.new(:host => '127.0.0.1') }
Thread.abort_on_exception = true
class Multi < Risky
View
8 spec/risky.rb
@@ -1,12 +1,6 @@
#!/usr/bin/env ruby
-require 'rubygems'
-require 'bacon'
-require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
-
-Bacon.summary_on_exit
-
-Risky.riak = Riak::Client.new(:host => '127.0.0.1')
+require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
class User < Risky
value :admin, :default => false
View
6 spec/threads.rb
@@ -1,10 +1,6 @@
#!/usr/bin/env ruby
-require 'rubygems'
-require 'bacon'
-require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
-
-Bacon.summary_on_exit
+require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
Risky.riak = lambda { Riak::Client.new(:host => '127.0.0.1') }
Please sign in to comment.
Something went wrong with that request. Please try again.