Permalink
Browse files

make tests work, address issue #2

  • Loading branch information...
1 parent 6aa4376 commit f0e3ccd03d0fcbb2f6d36feb3a13f48c0eefc8a4 @randysecrist randysecrist committed Mar 2, 2013
Showing with 42 additions and 36 deletions.
  1. +2 −3 Gemfile
  2. +24 −28 Gemfile.lock
  3. +6 −0 lib/ripple-encryption/activation.rb
  4. +1 −1 test/fixtures/ripple.yml
  5. +2 −2 test/helper.rb
  6. +4 −0 test/test_config.rb
  7. +3 −2 test/test_ripple.rb
View
@@ -3,9 +3,8 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in ripple-contrib.gemspec
gemspec
-gem 'riak-client', git: 'git://github.com/basho/riak-ruby-client.git', ref: '15a1fcb3cc5adf5365ae7d920cff8f13bc57743c'
-gem 'ripple', git: "git://github.com/seancribbs/ripple.git", ref: 'c68106a8a431cbef6be1ad79a5080359a9f7f540'
-
+gem 'riak-client', '~> 1.1.1'
+gem 'ripple', :git => 'git://github.com/basho/ripple.git', :ref => '913806aa2942db5a3b61d1432d2c9be200338f50'
group :development, :test do
gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
View
@@ -1,13 +1,13 @@
GIT
- remote: git://github.com/basho/riak-ruby-client.git
- revision: 15a1fcb3cc5adf5365ae7d920cff8f13bc57743c
- ref: 15a1fcb3cc5adf5365ae7d920cff8f13bc57743c
+ remote: git://github.com/basho/ripple.git
+ revision: 913806aa2942db5a3b61d1432d2c9be200338f50
+ ref: 913806aa2942db5a3b61d1432d2c9be200338f50
specs:
- riak-client (1.0.4)
- beefcake (~> 0.3.7)
- builder (>= 2.1.2)
- i18n (>= 0.4.0)
- multi_json (~> 1.0)
+ ripple (1.0.0.beta2)
+ activemodel (>= 3.0.0, < 3.3.0)
+ activesupport (>= 3.0.0, < 3.3.0)
+ riak-client (~> 1.1.0)
+ tzinfo
GIT
remote: git://github.com/mark-moseley/linecache
@@ -16,43 +16,39 @@ GIT
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
-GIT
- remote: git://github.com/seancribbs/ripple.git
- revision: c68106a8a431cbef6be1ad79a5080359a9f7f540
- ref: c68106a8a431cbef6be1ad79a5080359a9f7f540
- specs:
- ripple (1.0.0.beta2)
- activemodel (>= 3.0.0, < 3.3.0)
- activesupport (>= 3.0.0, < 3.3.0)
- riak-client (~> 1.0.0)
- tzinfo
-
PATH
remote: .
specs:
- ripple-encryption (0.1.0)
+ ripple-encryption (0.0.3)
riak-client
ripple
GEM
remote: https://rubygems.org/
specs:
- activemodel (3.2.8)
- activesupport (= 3.2.8)
+ activemodel (3.2.12)
+ activesupport (= 3.2.12)
builder (~> 3.0.0)
- activesupport (3.2.8)
+ activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
archive-tar-minitar (0.5.2)
beefcake (0.3.7)
- builder (3.0.0)
+ builder (3.0.4)
columnize (0.3.6)
- i18n (0.6.0)
+ i18n (0.6.4)
+ innertube (1.0.2)
mini_shoulda (0.5.0)
minitest (> 2.1.0)
minitest (3.3.0)
- multi_json (1.3.6)
+ multi_json (1.6.1)
rake (0.9.2.2)
+ riak-client (1.1.1)
+ beefcake (~> 0.3.7)
+ builder (>= 2.1.2)
+ i18n (>= 0.4.0)
+ innertube (~> 1.0.2)
+ multi_json (~> 1.0)
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
@@ -68,7 +64,7 @@ GEM
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
- tzinfo (0.3.33)
+ tzinfo (0.3.35)
PLATFORMS
ruby
@@ -77,7 +73,7 @@ DEPENDENCIES
linecache19!
mini_shoulda
rake
- riak-client!
+ riak-client (~> 1.1.1)
ripple!
ripple-encryption!
ruby-debug-base19x (~> 0.11.30.pre4)
@@ -1,12 +1,18 @@
module Ripple
module Encryption
class Activation
+
def initialize(path)
config = Ripple::Encryption::Config.new path
# short-circuit encryption via the config file if desired
if !Riak::Serializers['application/x-json-encrypted'] && (config.to_h['encryption'] != false)
Riak::Serializers['application/x-json-encrypted'] = Ripple::Encryption::Serializer.new config
end
+ @@is_activated = true
+ end
+
+ def self.activated?
+ @@is_activated
end
end
end
@@ -1,4 +1,4 @@
test:
host: 127.0.0.1
- http_port: 8091
+ http_port: 8098
namespace: test_ns~
View
@@ -17,8 +17,8 @@
client = Riak::Client.new(:nodes => [riak_config])
bucket = client.bucket("#{riak_config[:namespace].to_s}test")
object = bucket.get_or_new("test")
-rescue RuntimeError
- raise RuntimeError, "Could not connect to the Riak test node."
+rescue RuntimeError => e
+ raise e
end
# activate the library
View
@@ -2,6 +2,10 @@
class TestConfig < MiniTest::Spec
context "Ripple::Encryption::Config" do
+ should 'confirm encryption is active' do
+ assert Ripple::Encryption::Activation.activated?
+ end
+
should "raise heck if the config file isn't found" do
assert_raises Ripple::Encryption::ConfigError do
config = Ripple::Encryption::Config.new('nowhere')
View
@@ -19,8 +19,9 @@ class TestRipple < MiniTest::Spec
document = TestDocument.new
document.message = 'here is some new data'
document.save
- expected_doc_data = '{"version":"0.1.0","iv":"ABYLnUHWE/fIwE2gKYC6hg==\n","data":"VpQTfX23xKdMK4Kprp/xgwDh4UFFSYC8q4OeOhK2zPn0l5huFO+vsoBrq8pT\nd5Z3EdgPx3k8VpL0QNH1FM6m4g==\n"}'
- raw_data = `curl -s -XGET http://#{Ripple.config[:host]}:#{Ripple.config[:http_port]}/buckets/#{TestDocument.bucket_name}/keys/#{document.key}`
+ expected_data = 'VpQTfX23xKdMK4Kprp/xgwDh4UFFSYC8q4OeOhK2zPn0l5huFO+vsoBrq8pT\nd5Z3EdgPx3k8VpL0QNH1FM6m4g==\n'
+ expected_doc_data = "{\"version\":\"#{Ripple::Encryption::VERSION}\",\"iv\":\"ABYLnUHWE/fIwE2gKYC6hg==\\n\",\"data\":\"#{expected_data}\"}"
+ raw_data = `curl -s http://#{Ripple.config[:host]}:#{Ripple.config[:http_port]}/buckets/#{TestDocument.bucket_name}/keys/#{document.key}`
assert_equal expected_doc_data, raw_data
end
end

0 comments on commit f0e3ccd

Please sign in to comment.