couchrest_model_config 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -65,12 +65,10 @@ Feature: Configure CouchRest::Model database connections
|
|
65
65
|
And the database should use the domain provided for the server instead of the default server
|
66
66
|
|
67
67
|
@focus
|
68
|
-
Scenario:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
Then I should receive the database configured directly on the model via `use_database`
|
73
|
-
|
68
|
+
Scenario: CouchRest::Model::Base.use_database method no longer support
|
69
|
+
When I call the `use_database` method on CouchRest::Model::Base
|
70
|
+
Then I should receive an exception that the `use_database` method is not suported with couchrest_model_config
|
71
|
+
|
74
72
|
@focus
|
75
73
|
Scenario: Looking up the model's database via the model itself
|
76
74
|
Given I have configured the database for a model via CouchRest::Model::Config
|
@@ -221,3 +221,11 @@ end
|
|
221
221
|
When /^I call the `database` method on an instance of the model$/ do
|
222
222
|
@model_database = IndirectlyConfiguredModel.new.database
|
223
223
|
end
|
224
|
+
|
225
|
+
When /^I call the `use_database` method on CouchRest::Model::Base$/ do
|
226
|
+
@call = proc { CouchRest::Model::Base.use_database }
|
227
|
+
end
|
228
|
+
|
229
|
+
Then /^I should receive an exception that the `use_database` method is not suported with couchrest_model_config$/ do
|
230
|
+
@call.should raise_exception("We're sorry, but the `use_database` method is not supported with couchrest_model_config.")
|
231
|
+
end
|
@@ -2,18 +2,18 @@ module CouchRest
|
|
2
2
|
module Model
|
3
3
|
class Base
|
4
4
|
class << self
|
5
|
-
def
|
6
|
-
|
5
|
+
def database
|
6
|
+
CouchRest::Model::Config.for(self).current_database
|
7
7
|
end
|
8
8
|
|
9
|
-
|
9
|
+
def use_database(*args)
|
10
|
+
raise "We're sorry, but the `use_database` method is not supported with couchrest_model_config."
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
|
-
def
|
13
|
-
|
14
|
+
def database
|
15
|
+
CouchRest::Model::Config.for(self.class).current_database
|
14
16
|
end
|
15
|
-
|
16
|
-
alias_method_chain :database, :couchrest_model_config
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|