relation 0.3.8 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,57 +0,0 @@
1
- class DB
2
- ActiveRecord::Base.establish_connection adapter: 'sqlite3',
3
- database: ':memory:'
4
-
5
- def self.setup
6
- capture_stdout do
7
- ActiveRecord::Base.logger
8
- ActiveRecord::Schema.define(version: 1) do
9
- create_table :orders do |t|
10
- t.column :name, :string
11
- end
12
- create_table :users do |t|
13
- t.column :name, :string
14
- end
15
- create_table :relations, id: false do |t|
16
- t.string :name
17
- t.references :from, null: false
18
- t.references :to, null: false
19
- end
20
- end
21
-
22
- Order.reset_column_information
23
- end
24
- end
25
-
26
- def self.teardown
27
- if ActiveRecord::Base.connection.respond_to?(:data_sources)
28
- ActiveRecord::Base.connection.data_sources.each do |table|
29
- ActiveRecord::Base.connection.drop_table(table)
30
- end
31
- else
32
- ActiveRecord::Base.connection.tables.each do |table|
33
- ActiveRecord::Base.connection.drop_table(table)
34
- end
35
- end
36
- end
37
-
38
- def self.capture_stdout
39
- real_stdout = $stdout
40
-
41
- $stdout = StringIO.new
42
- yield
43
- $stdout.string
44
- ensure
45
- $stdout = real_stdout
46
- end
47
- end
48
-
49
- class Order < ActiveRecord::Base
50
- end
51
-
52
- class User < ActiveRecord::Base
53
- end
54
-
55
- require_relative '../../app/models/relation'
56
- require_relative '../../app/models/relation_ext'
57
- require_relative '../../app/models/dangling'