ridley 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -90,8 +90,8 @@ module Ridley
90
90
  def initialize(options = {})
91
91
  self.class.validate_options(options)
92
92
 
93
- @client_name = options.fetch(:client_name)
94
- @client_key = options.fetch(:client_key)
93
+ @client_name = options[:client_name]
94
+ @client_key = File.expand_path(options[:client_key])
95
95
  @organization = options[:organization]
96
96
  @thread_count = (options[:thread_count] || DEFAULT_THREAD_COUNT)
97
97
  @ssh = (options[:ssh] || Hash.new)
@@ -168,7 +168,7 @@ module Ridley
168
168
  #
169
169
  # @return [Hash] decrypted attributes
170
170
  def decrypt
171
- decrypted_hash = Hash[attributes.map { |key, value| [key, decrypt_value(value)] }]
171
+ decrypted_hash = Hash[attributes.map { |key, value| [key, key == "id" ? value : decrypt_value(value)] }]
172
172
  self.attributes = HashWithIndifferentAccess.new(decrypted_hash)
173
173
  end
174
174
 
@@ -1,3 +1,3 @@
1
1
  module Ridley
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -121,6 +121,12 @@ describe Ridley::Connection do
121
121
  subject.new(config)
122
122
  }.should raise_error(Ridley::Errors::ClientKeyFileNotFound)
123
123
  end
124
+
125
+ it "expands the path of the client_key" do
126
+ config[:client_key] = "~/"
127
+
128
+ subject.new(config).client_key.should_not == "~/"
129
+ end
124
130
  end
125
131
 
126
132
  describe "::sync" do
@@ -41,13 +41,22 @@ describe Ridley::DataBagItem do
41
41
  end
42
42
 
43
43
  describe "#decrypt" do
44
- it "decrypts an encrypted item" do
44
+ before(:each) do
45
45
  encrypted_data_bag_secret = File.read(fixtures_path.join("encrypted_data_bag_secret").to_s)
46
46
  connection.stub(:encrypted_data_bag_secret).and_return(encrypted_data_bag_secret)
47
+ end
47
48
 
49
+ it "decrypts an encrypted value" do
48
50
  subject.attributes[:test] = "Xk0E8lV9r4BhZzcg4wal0X4w9ZexN3azxMjZ9r1MCZc="
49
51
  subject.decrypt
50
52
  subject.attributes[:test][:database][:username].should == "test"
51
53
  end
54
+
55
+ it "does not decrypt the id field" do
56
+ id = "dbi_id"
57
+ subject.attributes[:id] = id
58
+ subject.decrypt
59
+ subject.attributes[:id].should == id
60
+ end
52
61
  end
53
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
305
  version: '0'
306
306
  segments:
307
307
  - 0
308
- hash: -1699037666768544565
308
+ hash: 4545606646369102038
309
309
  requirements: []
310
310
  rubyforge_project:
311
311
  rubygems_version: 1.8.23