activerecord-tableless 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.files = `git ls-files`.split($\)
11
11
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
- gem.version = "1.1.1"
13
+ gem.version = "1.1.2"
14
14
  gem.has_rdoc = true
15
15
 
16
16
  gem.require_paths = ["lib"]
@@ -73,6 +73,7 @@ module ActiveRecord
73
73
  def tableless?
74
74
  false
75
75
  end
76
+
76
77
  end
77
78
 
78
79
  module SingletonMethods
@@ -109,7 +110,7 @@ module ActiveRecord
109
110
  end
110
111
 
111
112
  if ActiveRecord::VERSION::STRING < "3.0"
112
- def find_with_ids(*args)
113
+ def find_from_ids(*args)
113
114
  case tableless_options[:database]
114
115
  when :pretend_success
115
116
  raise ActiveRecord::RecordNotFound.new("Couldn't find #{self} with ID=#{args[0].to_s}")
@@ -151,6 +152,13 @@ module ActiveRecord
151
152
  def tableless?
152
153
  true
153
154
  end
155
+
156
+ if ActiveRecord::VERSION::STRING < "3.1.0"
157
+ else
158
+ def table_exists?
159
+ false
160
+ end
161
+ end
154
162
  end
155
163
 
156
164
  module ClassMethods
@@ -18,15 +18,7 @@ class ChairPretend < ActiveRecord::Base
18
18
  column :name, :string
19
19
  end
20
20
 
21
- FileUtils.mkdir_p "tmp"
22
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => 'tmp/test.db')
23
- ActiveRecord::Base.connection.execute("drop table if exists chairs")
24
- ActiveRecord::Base.connection.execute("create table chairs (id INTEGER PRIMARY KEY, name TEXT )")
25
-
26
- class Chair < ActiveRecord::Base
27
- end
28
-
29
- describe "tableless attributes" do
21
+ describe "Tableless attributes" do
30
22
 
31
23
  subject { ChairFailure.new }
32
24
  it { should respond_to :id }
@@ -36,7 +28,7 @@ describe "tableless attributes" do
36
28
 
37
29
  end
38
30
 
39
- describe "tableless with fail_fast" do
31
+ describe "Tableless with fail_fast" do
40
32
  let!(:klass) { ChairFailure }
41
33
  subject { ChairFailure.new }
42
34
 
@@ -141,14 +133,27 @@ shared_examples_for "a succeeding database" do
141
133
  end
142
134
  end
143
135
 
144
- describe "tableless with real database" do
136
+ describe "Active record with real database" do
145
137
  ##This is only here to ensure that the shared examples are actually behaving like a real database.
138
+ before(:all) do
139
+ FileUtils.mkdir_p "tmp"
140
+ ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => 'tmp/test.db')
141
+ ActiveRecord::Base.connection.execute("drop table if exists chairs")
142
+ ActiveRecord::Base.connection.execute("create table chairs (id INTEGER PRIMARY KEY, name TEXT )")
143
+
144
+ Object.send(:remove_const, Chair) rescue nil
145
+ class Chair < ActiveRecord::Base
146
+ end
147
+ end
148
+ before(:all) do
149
+ ActiveRecord::Base.clear_all_connections!
150
+ end
146
151
  let!(:klass) { Chair }
147
152
  subject { Chair.new(:name => 'Jarl') }
148
153
  it_behaves_like "a succeeding database"
149
154
  end
150
155
 
151
- describe "tableless with succeeding database" do
156
+ describe "Tableless with succeeding database" do
152
157
  let!(:klass) { ChairPretend }
153
158
  subject { ChairPretend.new(:name => 'Jarl') }
154
159
  it_behaves_like "a succeeding database"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-tableless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -218,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  segments:
220
220
  - 0
221
- hash: -619351809282407548
221
+ hash: 3602190657480695753
222
222
  required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  none: false
224
224
  requirements:
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  version: '0'
228
228
  segments:
229
229
  - 0
230
- hash: -619351809282407548
230
+ hash: 3602190657480695753
231
231
  requirements: []
232
232
  rubyforge_project:
233
233
  rubygems_version: 1.8.24