multi_bitly 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,20 @@ module MultiBitly
10
10
  def data_store
11
11
  @data_store ||= ::BitlyAccount
12
12
  end
13
+
14
+ def accounts
15
+ symbolize_account_keys
16
+ end
17
+
18
+ private
19
+
20
+ def symbolize_account_keys
21
+ @accounts.map { |account|
22
+ account.each_with_object({}) { |key_value, hsh|
23
+ hsh[key_value[0].to_sym.downcase] = key_value[1]
24
+ }
25
+ }
26
+ end
13
27
  end
14
28
 
15
29
  class << self
@@ -1,3 +1,3 @@
1
1
  module MultiBitly
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -3,24 +3,48 @@ require 'spec_helper'
3
3
  describe MultiBitly::Configuration do
4
4
  describe '#accounts' do
5
5
  context 'when set' do
6
- before do
7
- MultiBitly::configure do |config|
8
- config.accounts = [
6
+ context 'with keys of symbols' do
7
+ before do
8
+ MultiBitly::configure do |config|
9
+ config.accounts = [
10
+ { username: 'user1', api_key: 'key1' },
11
+ { username: 'user2', api_key: 'key2' }
12
+ ]
13
+ end
14
+ end
15
+
16
+ after do
17
+ MultiBitly.configuration = nil
18
+ end
19
+
20
+ it 'uses the supplied accounts' do
21
+ expect(MultiBitly.configuration.accounts).to eq([
9
22
  { username: 'user1', api_key: 'key1' },
10
23
  { username: 'user2', api_key: 'key2' }
11
- ]
24
+ ])
12
25
  end
13
26
  end
14
27
 
15
- after do
16
- MultiBitly.configuration = nil
17
- end
28
+ context 'with capitalized keys' do
29
+ before do
30
+ MultiBitly::configure do |config|
31
+ config.accounts = [
32
+ { 'USERNAME' => 'user1', 'API_KEY' => 'key1' },
33
+ { 'USERNAME' => 'user2', 'API_KEY' => 'key2' }
34
+ ]
35
+ end
36
+ end
37
+
38
+ after do
39
+ MultiBitly.configuration = nil
40
+ end
18
41
 
19
- it 'uses the supplied accounts' do
20
- expect(MultiBitly.configuration.accounts).to eq([
21
- { username: 'user1', api_key: 'key1' },
22
- { username: 'user2', api_key: 'key2' }
23
- ])
42
+ it 'uses the supplied accounts' do
43
+ expect(MultiBitly.configuration.accounts).to eq([
44
+ { username: 'user1', api_key: 'key1' },
45
+ { username: 'user2', api_key: 'key2' }
46
+ ])
47
+ end
24
48
  end
25
49
  end
26
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_bitly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  segments:
137
137
  - 0
138
- hash: -2121263376112597564
138
+ hash: 1251204611483716030
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  segments:
146
146
  - 0
147
- hash: -2121263376112597564
147
+ hash: 1251204611483716030
148
148
  requirements: []
149
149
  rubyforge_project:
150
150
  rubygems_version: 1.8.25