relation 0.3.8 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +10 -8
- data/.gitignore +1 -1
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +7 -5
- data/Gemfile.lock +141 -115
- data/MIT-LICENSE +3 -1
- data/README.md +36 -26
- data/Rakefile +5 -5
- data/app/models/dangling.rb +7 -6
- data/app/models/relation.rb +4 -2
- data/app/models/relation_ext.rb +6 -4
- data/db/migrate/{20150810152808_relation.rb → 003_create_relations.rb} +2 -2
- data/lib/relation/engine.rb +1 -23
- data/lib/relation/version.rb +13 -9
- data/lib/relation.rb +3 -6
- data/relation.gemspec +18 -25
- data/test/dangling_test.rb +17 -23
- data/test/internal/app/models/order.rb +2 -0
- data/test/internal/app/models/user.rb +2 -0
- data/test/internal/config/database.yml +3 -0
- data/test/internal/db/schema.rb +28 -0
- data/test/relation_ext_test.rb +14 -21
- data/test/relation_test.rb +10 -17
- data/test/test_helper.rb +11 -12
- metadata +15 -58
- data/.rubocop.yml +0 -9
- data/.watchr +0 -59
- data/Appraisals +0 -19
- data/gemfiles/rails_6.0.gemfile +0 -13
- data/gemfiles/rails_6.1.gemfile +0 -13
- data/test/support/database.rb +0 -57
data/test/support/database.rb
DELETED
@@ -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'
|