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
@@ -1,3 +1,6 @@
1
+ v0.1.0
2
+ -- `use_database` no longer supported when using CouchRest::Model::Config
3
+
1
4
  v0.0.2
2
5
  -- alias_method_chain both the class and instance `database` methods
3
6
  on CouchRest::Model::Base
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
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: Database configured directly on the model takes highest precedence
69
- Given I have configured the database for a model directly on the model via `use_database`
70
- And I have configured the database for that model via CouchRest::Model::Config
71
- When I call the `database` method on the model
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 database_with_couchrest_model_config
6
- database_without_couchrest_model_config || CouchRest::Model::Config.for(self).current_database
5
+ def database
6
+ CouchRest::Model::Config.for(self).current_database
7
7
  end
8
8
 
9
- alias_method_chain :database, :couchrest_model_config
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 database_with_couchrest_model_config
13
- database_without_couchrest_model_config || CouchRest::Model::Config.for(self.class).current_database
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
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Parker