Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
6 lib/risky.rb
@@ -86,9 +86,9 @@ def self.cast(data)
86 86 end
87 87
88 88 # Counts the number of values in the bucket via key streaming
89   - def self.count(opts = {:reload => true})
  89 + def self.count
90 90 count = 0
91   - bucket.keys(opts) do |keys|
  91 + bucket.keys do |keys|
92 92 count += keys.length
93 93 end
94 94 count
@@ -103,7 +103,7 @@ def self.delete(key, opts = {})
103 103
104 104 # Iterate over all items using key streaming.
105 105 def self.each
106   - bucket.keys(:reload => true) do |keys|
  106 + bucket.keys do |keys|
107 107 keys.each do |key|
108 108 if x = self[key]
109 109 yield x
8 spec/crud.rb
... ... @@ -1,12 +1,6 @@
1 1 #!/usr/bin/env ruby
2 2
3   -require 'rubygems'
4   -require 'bacon'
5   -require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
6   -
7   -Bacon.summary_on_exit
8   -
9   -Risky.riak = Riak::Client.new(:host => '127.0.0.1')
  3 +require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
10 4
11 5 class Crud < Risky
12 6 bucket 'crud'
8 spec/enumerable.rb
... ... @@ -1,12 +1,6 @@
1 1 #!/usr/bin/env ruby
2 2
3   -require 'rubygems'
4   -require 'bacon'
5   -require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
6   -
7   -Bacon.summary_on_exit
8   -
9   -Risky.riak = Riak::Client.new(:host => '127.0.0.1')
  3 +require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
10 4
11 5 class Enum < Risky
12 6 bucket 'enum'
6 spec/indexes.rb
... ... @@ -1,10 +1,6 @@
1 1 #!/usr/bin/env ruby
2 2
3   -require 'rubygems'
4   -require 'bacon'
5   -require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
6   -
7   -Bacon.summary_on_exit
  3 +require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
8 4
9 5 class Indexed < Risky
10 6 include Risky::Indexes
11 spec/init.rb
... ... @@ -0,0 +1,11 @@
  1 +require 'bacon'
  2 +require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
  3 +
  4 +Bacon.summary_on_exit
  5 +
  6 +begin
  7 + Riak.disable_list_keys_warnings = true
  8 +rescue
  9 +end
  10 +
  11 +Risky.riak = Riak::Client.new(:host => '127.0.0.1')
7 spec/resolver.rb
... ... @@ -1,14 +1,9 @@
1 1 #!/usr/bin/env ruby
2 2
3   -require 'rubygems'
4   -require 'bacon'
5   -require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
  3 +require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
6 4 require 'risky/resolver'
7 5 require 'pp'
8 6
9   -Bacon.summary_on_exit
10   -
11   -Risky.riak = proc { Riak::Client.new(:host => '127.0.0.1') }
12 7 Thread.abort_on_exception = true
13 8
14 9 class Multi < Risky
8 spec/risky.rb
... ... @@ -1,12 +1,6 @@
1 1 #!/usr/bin/env ruby
2 2
3   -require 'rubygems'
4   -require 'bacon'
5   -require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
6   -
7   -Bacon.summary_on_exit
8   -
9   -Risky.riak = Riak::Client.new(:host => '127.0.0.1')
  3 +require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
10 4
11 5 class User < Risky
12 6 value :admin, :default => false
6 spec/threads.rb
... ... @@ -1,10 +1,6 @@
1 1 #!/usr/bin/env ruby
2 2
3   -require 'rubygems'
4   -require 'bacon'
5   -require "#{File.expand_path(File.dirname(__FILE__))}/../lib/risky"
6   -
7   -Bacon.summary_on_exit
  3 +require File.expand_path("#{File.dirname(__FILE__)}/init.rb")
8 4
9 5 Risky.riak = lambda { Riak::Client.new(:host => '127.0.0.1') }
10 6

0 comments on commit 954d339

Please sign in to comment.
Something went wrong with that request. Please try again.