apartment 0.5.1 → 0.6.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/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.6.0
2
+ * June 21, 2011
3
+
4
+ - Added #process to connect to new db, perform operations, then ensure a reset
5
+
1
6
  # 0.5.1
2
7
  * June 21, 2011
3
8
 
data/README.md CHANGED
@@ -106,8 +106,6 @@ from `Apartment.database_names`
106
106
 
107
107
  ## TODO
108
108
 
109
- * Migration support
110
- * Other rake task support
111
109
  * Cross-database associations
112
110
 
113
111
  ## Contributing
@@ -24,6 +24,7 @@ module Apartment
24
24
  ensure
25
25
  reset
26
26
  end
27
+ alias_method :process, :connect_and_reset # more succinct name
27
28
 
28
29
  # Create new postgres schema
29
30
  #
@@ -3,7 +3,7 @@ require 'active_support/core_ext/string/inflections' # for `constantize`
3
3
  module Apartment
4
4
  module Database
5
5
 
6
- MULTI_TENANT_METHODS = [:create, :switch, :reset, :connect_and_reset]
6
+ MULTI_TENANT_METHODS = [:create, :switch, :reset, :connect_and_reset, :process]
7
7
 
8
8
  class << self
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Apartment
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -39,7 +39,6 @@ describe Apartment::Database do
39
39
  it "should load postgresql adapter" do
40
40
  Apartment::Database.adapter
41
41
  Apartment::Adapters::PostgresqlAdapter.should be_a(Class)
42
-
43
42
  end
44
43
 
45
44
  it "should raise exception with invalid adapter specified" do
@@ -67,6 +66,19 @@ describe Apartment::Database do
67
66
  Apartment::Test.drop_schema(database)
68
67
  end
69
68
 
69
+ describe "#process" do
70
+ it "should connect to new schema" do
71
+ Apartment::Database.process(database) do
72
+ ActiveRecord::Base.connection.schema_search_path.should == database
73
+ end
74
+ end
75
+
76
+ it "should reset to public schema" do
77
+ Apartment::Database.process(database)
78
+ ActiveRecord::Base.connection.schema_search_path.should == @schema_search_path
79
+ end
80
+ end
81
+
70
82
  describe "#create" do
71
83
  it "should create new postgres schema" do
72
84
  ActiveRecord::Base.connection.execute("SELECT nspname FROM pg_namespace;").collect{|row| row['nspname']}.should include(database)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: apartment
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.1
5
+ version: 0.6.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Brunner
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  requirements:
186
186
  - - ">="
187
187
  - !ruby/object:Gem::Version
188
- hash: 2503870912539283995
188
+ hash: 4521352595890258295
189
189
  segments:
190
190
  - 0
191
191
  version: "0"
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  requirements:
195
195
  - - ">="
196
196
  - !ruby/object:Gem::Version
197
- hash: 2503870912539283995
197
+ hash: 4521352595890258295
198
198
  segments:
199
199
  - 0
200
200
  version: "0"