multi_config 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
- Unreleased ([changes](https://github.com/shadabahmed/multi_config/v0.1.9...master))
1
+ Unreleased ([changes](https://github.com/shadabahmed/multi_config/compare/v0.2.0...master))
2
2
  -------------------
3
3
  **Note: Not implemented yet**
4
4
  * Add generators for migrations
5
5
 
6
+ v0.2.0, 2012-10-23 ([changes](https://github.com/shadabahmed/multi_config/compare/v0.1.9...v0.2.0))
7
+ -------------------
8
+ * Refactored specs
9
+
6
10
  v0.1.9, 2012-09-18 ([changes](https://github.com/shadabahmed/multi_config/compare/v0.1.8...v0.1.9))
7
11
  -------------------
8
12
  * Refactored class variables
@@ -1,4 +1,4 @@
1
1
  module MultiConfig
2
2
  # Gem version
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.0"
4
4
  end
@@ -15,16 +15,16 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
15
15
  let(:test_class) { @test_class }
16
16
 
17
17
  describe "#config_file=" do
18
- describe "setting config_file in unspecified environment" do
18
+ context "unspecified environment" do
19
19
  before do
20
20
  Rails.stub(:env).and_return('unknown')
21
21
  end
22
- it "should through error when I specify a config file with environment not defined" do
23
- lambda { test_class.config_file = 'other' }.should raise_error
22
+ it "raises error when I specify a config file with environment not defined" do
23
+ expect { test_class.config_file = 'other' }.to raise_error
24
24
  end
25
25
  end
26
26
 
27
- describe "modifies class variable @@_multi_config_db_configs" do
27
+ context "modifies class variable @@_multi_config_db_configs" do
28
28
  before do
29
29
  test_class.send(:class_variable_get, '@@_multi_config_db_configs').should == {}
30
30
  test_class.config_file = 'other'
@@ -33,7 +33,7 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
33
33
  it { should == {"other" => ["test_class"]} }
34
34
  end
35
35
 
36
- describe "modifies .configurations" do
36
+ context "modifies .configurations" do
37
37
  before do
38
38
  test_class.should_receive(:establish_connection).once.with('other_test')
39
39
  expect {
@@ -45,7 +45,7 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
45
45
  it { should include 'other_test' }
46
46
  end
47
47
 
48
- describe "works as expected when filename without extension .yml is specified" do
48
+ context "filename without extension .yml is specified" do
49
49
  before do
50
50
  test_class.should_receive(:establish_connection).once.with('other_test')
51
51
  expect {
@@ -57,7 +57,7 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
57
57
  it { should include 'other_test' }
58
58
  end
59
59
 
60
- describe "works as expected when filename with extension .yml is specified" do
60
+ context "filename with extension .yml is specified" do
61
61
  before do
62
62
  test_class.should_receive(:establish_connection).once.with('other_test')
63
63
  expect {
@@ -69,7 +69,7 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
69
69
  it { should include 'other_test' }
70
70
  end
71
71
 
72
- describe "multiple calls for config_file= in different models modify configurations only once" do
72
+ context "config_file= called multiple times in different models with the same file" do
73
73
  let(:first_test_class) { Class.new(test_class) }
74
74
  let(:second_test_class) { Class.new(test_class) }
75
75
  before do
@@ -89,7 +89,7 @@ describe MultiConfig::ORMs::ActiveRecord::ClassMethods do
89
89
  it { should include 'other_test' }
90
90
  end
91
91
 
92
- describe "does nothing if database.yml specified" do
92
+ context "when file is database.yml" do
93
93
  before do
94
94
  test_class.should_not_receive(:establish_connection)
95
95
  test_class.should_not_receive(:add_db_config)
@@ -5,15 +5,15 @@ describe ActiveRecord::Base, "methods" do
5
5
  ActiveRecord::Base.send(:include, MultiConfig::ORMs::ActiveRecord)
6
6
  end
7
7
 
8
- it "should have configurations" do
8
+ it "has configurations" do
9
9
  ActiveRecord::Base.configurations.should_not == {}
10
10
  end
11
11
 
12
- it "should have multi config methods" do
13
- ActiveRecord::Base.singleton_methods.should include(RUBY_VERSION =~ /^1\.8/ ? 'config_file=' : :'config_file=')
12
+ it "has multi config methods" do
13
+ ActiveRecord::Base.singleton_methods.map(&:to_sym).should include(:'config_file=')
14
14
  end
15
15
 
16
- it "should have @@db_config class variable set" do
16
+ it "has @@db_config class variable set" do
17
17
  ActiveRecord::Base.send(:class_variable_get, '@@_multi_config_db_configs').should == {}
18
18
  end
19
19
 
@@ -6,7 +6,7 @@ describe UsesDatabaseYml do
6
6
  UsesDatabaseYml.establish_connection
7
7
  end
8
8
 
9
- it "should be connected to the alternate database" do
9
+ it "connects to the alternate database" do
10
10
  UsesDatabaseYml.connection.instance_variable_get(:@config)[:database].split('/').last.should == "db"
11
11
  end
12
12
  end
@@ -6,11 +6,11 @@ describe UsesOtherYml do
6
6
  UsesOtherYml.config_file = 'other'
7
7
  end
8
8
 
9
- it "should be connected to the default database" do
9
+ it "connects to the default database" do
10
10
  UsesOtherYml.connection.instance_variable_get(:@config)[:database].split('/').last.should == "other_db"
11
11
  end
12
12
 
13
- it "the @@_multi_config_db_configs should have entry for this class" do
13
+ it "stores an entry in @@_multi_config_db_configs" do
14
14
  UsesOtherYml.send(:class_variable_get, :'@@_multi_config_db_configs').should == {"other" => ["UsesOtherYml"]}
15
15
  end
16
16
  end
@@ -11,7 +11,7 @@ describe MultiConfig::Railtie do
11
11
  # Remove the class definition
12
12
  MultiConfig.send(:remove_const, :Railtie)
13
13
  end
14
- it "should call Railtie Insert when hook is executed" do
14
+ it "inserts the module when railtie hook executes" do
15
15
  # Reload class definition so that class in instantiated and Railitie.initializer is called
16
16
  load 'multi_config.rb'
17
17
  MultiConfig::Railtie.should_receive(:insert).once()
@@ -23,7 +23,7 @@ describe MultiConfig::Railtie do
23
23
  end
24
24
 
25
25
  describe '#insert' do
26
- it "should call ActiveRecord::Base.include" do
26
+ it "calls included the module in ActiveRecord" do
27
27
  ActiveRecord::Base.should_receive(:send).with(:include, MultiConfig::ORMs::ActiveRecord).once()
28
28
  MultiConfig::Railtie.insert
29
29
  end
metadata CHANGED
@@ -1,135 +1,136 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: multi_config
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.9
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Shadab Ahmed
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-09-18 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-10-23 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '3.0'
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '3.0'
30
- - !ruby/object:Gem::Dependency
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ version: "3.0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
31
36
  name: bundler
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: 1.0.0
38
- type: :development
39
37
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 23
44
+ segments:
45
+ - 1
46
+ - 0
47
+ - 0
45
48
  version: 1.0.0
46
- - !ruby/object:Gem::Dependency
47
- name: rails
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '3.0'
54
49
  type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rails
55
53
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- - !ruby/object:Gem::Dependency
63
- name: activerecord
64
- requirement: !ruby/object:Gem::Requirement
54
+ requirement: &id003 !ruby/object:Gem::Requirement
65
55
  none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '3.0'
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 7
60
+ segments:
61
+ - 3
62
+ - 0
63
+ version: "3.0"
70
64
  type: :development
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: activerecord
71
68
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '3.0'
78
- - !ruby/object:Gem::Dependency
79
- name: autotest
80
- requirement: !ruby/object:Gem::Requirement
69
+ requirement: &id004 !ruby/object:Gem::Requirement
81
70
  none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '4.0'
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 7
75
+ segments:
76
+ - 3
77
+ - 0
78
+ version: "3.0"
86
79
  type: :development
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: autotest
87
83
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '4.0'
94
- - !ruby/object:Gem::Dependency
95
- name: rdoc
96
- requirement: !ruby/object:Gem::Requirement
84
+ requirement: &id005 !ruby/object:Gem::Requirement
97
85
  none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 27
90
+ segments:
91
+ - 4
92
+ - 0
93
+ version: "4.0"
102
94
  type: :development
95
+ version_requirements: *id005
96
+ - !ruby/object:Gem::Dependency
97
+ name: rdoc
103
98
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: sqlite3
112
- requirement: !ruby/object:Gem::Requirement
99
+ requirement: &id006 !ruby/object:Gem::Requirement
113
100
  none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
118
108
  type: :development
109
+ version_requirements: *id006
110
+ - !ruby/object:Gem::Dependency
111
+ name: sqlite3
119
112
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
113
+ requirement: &id007 !ruby/object:Gem::Requirement
121
114
  none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ hash: 3
119
+ segments:
120
+ - 0
121
+ version: "0"
122
+ type: :development
123
+ version_requirements: *id007
126
124
  description: This gem lets you specify different config file for an ActiveRecord Model
127
- email:
128
- - ''
125
+ email:
126
+ - ""
129
127
  executables: []
128
+
130
129
  extensions: []
130
+
131
131
  extra_rdoc_files: []
132
- files:
132
+
133
+ files:
133
134
  - .gitignore
134
135
  - .rspec
135
136
  - .travis.yml
@@ -160,29 +161,38 @@ files:
160
161
  - spec/support/rails_config.rb
161
162
  homepage: https://github.com/shadabahmed/multi_config
162
163
  licenses: []
164
+
163
165
  post_install_message:
164
166
  rdoc_options: []
165
- require_paths:
167
+
168
+ require_paths:
166
169
  - lib
167
- required_ruby_version: !ruby/object:Gem::Requirement
170
+ required_ruby_version: !ruby/object:Gem::Requirement
168
171
  none: false
169
- requirements:
170
- - - ! '>='
171
- - !ruby/object:Gem::Version
172
- version: '0'
173
- required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
178
+ version: "0"
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
180
  none: false
175
- requirements:
176
- - - ! '>='
177
- - !ruby/object:Gem::Version
178
- version: '0'
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ hash: 3
185
+ segments:
186
+ - 0
187
+ version: "0"
179
188
  requirements: []
189
+
180
190
  rubyforge_project:
181
- rubygems_version: 1.8.23
191
+ rubygems_version: 1.8.24
182
192
  signing_key:
183
193
  specification_version: 3
184
194
  summary: Use this gem to use multiple db config files
185
- test_files:
195
+ test_files:
186
196
  - spec/active_record/class_methods_spec.rb
187
197
  - spec/active_record/config_spec.rb
188
198
  - spec/active_record_spec.rb