persistent_settings 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module PersistentSettings
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
data/lib/settings.rb CHANGED
@@ -47,7 +47,11 @@ class Settings < ActiveRecord::Base
47
47
  end
48
48
 
49
49
  def self.load_from_persistance
50
- load_from_persistance! if connected? && table_exists?
50
+ load_from_persistance! if ready?
51
+ end
52
+
53
+ def self.ready?
54
+ connected? && table_exists?
51
55
  end
52
56
 
53
57
  def self.keys
@@ -106,10 +106,9 @@ describe Settings do
106
106
  end
107
107
 
108
108
  describe :load_from_persistance do
109
- context "AR is connected and table is created" do
109
+ context "is ready" do
110
110
  before do
111
- Settings.stub(:connected?).and_return true
112
- Settings.stub(:table_exists?).and_return true
111
+ Settings.stub(:ready?).and_return true
113
112
  end
114
113
 
115
114
  it "calls load_from_persistance!" do
@@ -118,10 +117,9 @@ describe Settings do
118
117
  end
119
118
  end
120
119
 
121
- context "AR is not connected" do
120
+ context "not ready" do
122
121
  before do
123
- Settings.stub(:connected?).and_return false
124
- Settings.stub(:table_exists?).and_return true
122
+ Settings.stub(:ready?).and_return false
125
123
  end
126
124
 
127
125
  it "calls load_from_persistance!" do
@@ -129,6 +127,30 @@ describe Settings do
129
127
  Settings.load_from_persistance
130
128
  end
131
129
  end
130
+ end
131
+
132
+ describe :ready? do
133
+ context "AR is connected and table is created" do
134
+ before do
135
+ Settings.stub(:connected?).and_return true
136
+ Settings.stub(:table_exists?).and_return true
137
+ end
138
+
139
+ it "is true" do
140
+ Settings.ready?.should be_true
141
+ end
142
+ end
143
+
144
+ context "AR is not connected" do
145
+ before do
146
+ Settings.stub(:connected?).and_return false
147
+ Settings.stub(:table_exists?).and_return true
148
+ end
149
+
150
+ it "is false" do
151
+ Settings.ready?.should be_false
152
+ end
153
+ end
132
154
 
133
155
  context "table is not created" do
134
156
  before do
@@ -136,9 +158,8 @@ describe Settings do
136
158
  Settings.stub(:table_exists?).and_return false
137
159
  end
138
160
 
139
- it "calls load_from_persistance!" do
140
- Settings.should_not_receive(:load_from_persistance!)
141
- Settings.load_from_persistance
161
+ it "is false" do
162
+ Settings.ready?.should be_false
142
163
  end
143
164
  end
144
165
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persistent_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-21 00:00:00.000000000 Z
12
+ date: 2012-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: 3753706074841151251
150
+ hash: 2798642706016126182
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  segments:
158
158
  - 0
159
- hash: 3753706074841151251
159
+ hash: 2798642706016126182
160
160
  requirements: []
161
161
  rubyforge_project: persistent_settings
162
162
  rubygems_version: 1.8.23