unconstrained 0.0.1
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/lib/unconstrained.rb +19 -0
- data/lib/unconstrained/active_record_plugin.rb +43 -0
- data/lib/unconstrained/handlers.rb +24 -0
- data/lib/unconstrained/handlers/abstract_handler.rb +46 -0
- data/lib/unconstrained/handlers/postgresql.rb +15 -0
- data/lib/unconstrained/version.rb +3 -0
- data/test/destroy_test.rb +18 -0
- data/test/dummy/Rakefile +5 -0
- data/test/dummy/app/models/child.rb +3 -0
- data/test/dummy/app/models/parent.rb +3 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20150207083618_parents_with_children.rb +10 -0
- data/test/dummy/db/schema.rb +28 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +12 -0
- data/test/dummy/log/test.log +1259 -0
- data/test/fixtures/children.yml +4 -0
- data/test/fixtures/parents.yml +3 -0
- data/test/save_test.rb +10 -0
- data/test/test_helper.rb +21 -0
- metadata +121 -0
data/test/save_test.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SaveTest < ActiveSupport::TestCase
|
4
|
+
test "foreign key constraint converted to validation error" do
|
5
|
+
@child = children(:one)
|
6
|
+
@child.parent_id = ActiveRecord::FixtureSet.identify(:nonexistent)
|
7
|
+
@child.save
|
8
|
+
assert_not_empty @child.errors[:parent_id]
|
9
|
+
end
|
10
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
6
|
+
require "rails/test_help"
|
7
|
+
|
8
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
9
|
+
# to be shown.
|
10
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
11
|
+
|
12
|
+
# Load support files
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
+
|
15
|
+
# Load fixtures from the engine
|
16
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
17
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
18
|
+
class ActiveSupport::TestCase
|
19
|
+
fixtures :all
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unconstrained
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexandros Giouzenis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pg
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: This gem converts the foreign key exceptions raised by the database into
|
42
|
+
Active Model errors that can be displayed by an application.
|
43
|
+
email:
|
44
|
+
- alexandrosg@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- MIT-LICENSE
|
50
|
+
- Rakefile
|
51
|
+
- lib/unconstrained.rb
|
52
|
+
- lib/unconstrained/active_record_plugin.rb
|
53
|
+
- lib/unconstrained/handlers.rb
|
54
|
+
- lib/unconstrained/handlers/abstract_handler.rb
|
55
|
+
- lib/unconstrained/handlers/postgresql.rb
|
56
|
+
- lib/unconstrained/version.rb
|
57
|
+
- test/destroy_test.rb
|
58
|
+
- test/dummy/Rakefile
|
59
|
+
- test/dummy/app/models/child.rb
|
60
|
+
- test/dummy/app/models/parent.rb
|
61
|
+
- test/dummy/config.ru
|
62
|
+
- test/dummy/config/application.rb
|
63
|
+
- test/dummy/config/boot.rb
|
64
|
+
- test/dummy/config/database.yml
|
65
|
+
- test/dummy/config/environment.rb
|
66
|
+
- test/dummy/config/environments/test.rb
|
67
|
+
- test/dummy/db/development.sqlite3
|
68
|
+
- test/dummy/db/migrate/20150207083618_parents_with_children.rb
|
69
|
+
- test/dummy/db/schema.rb
|
70
|
+
- test/dummy/db/test.sqlite3
|
71
|
+
- test/dummy/log/development.log
|
72
|
+
- test/dummy/log/test.log
|
73
|
+
- test/fixtures/children.yml
|
74
|
+
- test/fixtures/parents.yml
|
75
|
+
- test/save_test.rb
|
76
|
+
- test/test_helper.rb
|
77
|
+
homepage: https://github.com/agios/unconstrained
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.4.5
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: A gem that converts Active Record foreign key exceptions.
|
101
|
+
test_files:
|
102
|
+
- test/test_helper.rb
|
103
|
+
- test/save_test.rb
|
104
|
+
- test/destroy_test.rb
|
105
|
+
- test/dummy/config.ru
|
106
|
+
- test/dummy/Rakefile
|
107
|
+
- test/dummy/app/models/parent.rb
|
108
|
+
- test/dummy/app/models/child.rb
|
109
|
+
- test/dummy/db/schema.rb
|
110
|
+
- test/dummy/db/migrate/20150207083618_parents_with_children.rb
|
111
|
+
- test/dummy/db/development.sqlite3
|
112
|
+
- test/dummy/db/test.sqlite3
|
113
|
+
- test/dummy/config/database.yml
|
114
|
+
- test/dummy/config/application.rb
|
115
|
+
- test/dummy/config/boot.rb
|
116
|
+
- test/dummy/config/environment.rb
|
117
|
+
- test/dummy/config/environments/test.rb
|
118
|
+
- test/dummy/log/development.log
|
119
|
+
- test/dummy/log/test.log
|
120
|
+
- test/fixtures/children.yml
|
121
|
+
- test/fixtures/parents.yml
|