rails-erd 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c30fa295be10915a3d5d8e67c20bc05d10aee6d
4
- data.tar.gz: ef14cf496c1f5fc4b608b9672c18a56d7ad3e978
3
+ metadata.gz: f023a0096d3737d00670e9d713e766855426f578
4
+ data.tar.gz: ebb61ceddc34a6d03ebb7157688335a41321ecc5
5
5
  SHA512:
6
- metadata.gz: b03cf48dde711acfe6ae9988cf794629ecaec62cea8e6efabcc04bf43d743c2898b7d4b377c0fca85a944e67635e900a4a90df2477d48fcfbcb68cf42002354a
7
- data.tar.gz: 5aa2246b32e02b5a8ff0729c84b4f1cdd2476b2c296293a8d7b447eb55bce26998c289528b2e98acb8e66f6bec756aaed2654b2efc5d0bac7c03019af1625be8
6
+ metadata.gz: 297d5f2899e0fbe308fe461c7304480efd00c10f904d58f5af14ee01b5ce2708167f49e4f366ff93ee9ac5e21b316da34d7b118c36a107965af07d0a3d404774
7
+ data.tar.gz: e757d823c41be9a73cf83b7e4485c6e596ece8874ac3e80de697a7536db6eab14906ac8a434936c99b94f83c515c2e0e2e16b0906870fd0a69185dcce75a679b
@@ -125,7 +125,7 @@ module RailsERD
125
125
  # Returns any non-standard limit for this attribute. If a column has no
126
126
  # limit or uses a default database limit, this method returns +nil+.
127
127
  def limit
128
- return if native_type == 'geometry'
128
+ return if native_type == 'geometry' || native_type == 'geography'
129
129
  return column.limit.to_i if column.limit != native_type[:limit] and column.limit.respond_to?(:to_i)
130
130
  column.precision.to_i if column.precision != native_type[:precision] and column.precision.respond_to?(:to_i)
131
131
  end
@@ -1,4 +1,4 @@
1
1
  module RailsERD
2
- VERSION = "1.4.3"
2
+ VERSION = "1.4.4"
3
3
  BANNER = "RailsERD #{VERSION}"
4
4
  end
@@ -2,11 +2,15 @@ require "rubygems"
2
2
  require "bundler/setup"
3
3
 
4
4
  require "active_record"
5
+
5
6
  if ActiveSupport::VERSION::MAJOR >= 4
6
7
  require "minitest/autorun"
8
+ require 'mocha/mini_test'
7
9
  else
8
10
  require "test/unit"
11
+ require 'mocha/test_unit'
9
12
  end
13
+
10
14
  require "rails_erd/domain"
11
15
 
12
16
  ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:"
@@ -4,7 +4,7 @@ require "rails_erd/diagram/graphviz"
4
4
  class GraphvizTest < ActiveSupport::TestCase
5
5
  def setup
6
6
  RailsERD.options.filetype = :png
7
- RailsERD.options.warn = false
7
+ RailsERD.options.warn = false
8
8
  end
9
9
 
10
10
  def teardown
@@ -75,26 +75,30 @@ class GraphvizTest < ActiveSupport::TestCase
75
75
  belongs_to :bar
76
76
  end
77
77
  create_model "Bar", :column => :string
78
+
79
+ Diagram.any_instance.expects(:save)
78
80
  Diagram::Graphviz.create
79
- assert File.exists?("erd.png")
80
81
  end
81
82
 
82
83
  test "create should create output for domain without attributes" do
83
84
  create_simple_domain
85
+
86
+ Diagram.any_instance.expects(:save)
84
87
  Diagram::Graphviz.create
85
- assert File.exists?("erd.png")
86
88
  end
87
89
 
88
90
  test "create should write to file with dot extension if type is dot" do
89
91
  create_simple_domain
90
- Diagram::Graphviz.create :filetype => :dot
91
- assert File.exists?("erd.dot")
92
+
93
+ Diagram.any_instance.expects(:save)
94
+ Diagram::Graphviz.create(:filetype => :dot)
92
95
  end
93
96
 
94
97
  test "create should create output for filenames that have spaces" do
95
98
  create_simple_domain
96
- Diagram::Graphviz.create :filename => "erd with spaces"
97
- assert File.exists?("erd_with_spaces.png")
99
+
100
+ Diagram.any_instance.expects(:save)
101
+ Diagram::Graphviz.create(:filename => "erd with spaces")
98
102
  end
99
103
 
100
104
  test "create should write to file with dot extension without requiring graphviz" do
@@ -105,7 +109,7 @@ class GraphvizTest < ActiveSupport::TestCase
105
109
  def output_and_errors_from_command(*args); raise end
106
110
  end
107
111
  assert_nothing_raised do
108
- Diagram::Graphviz.create :filetype => :dot
112
+ Diagram::Graphviz.create(:filetype => :dot)
109
113
  end
110
114
  ensure
111
115
  GraphViz.class_eval do
@@ -119,14 +123,16 @@ class GraphvizTest < ActiveSupport::TestCase
119
123
  belongs_to :bar
120
124
  end
121
125
  create_model "Bar", :column => :string
126
+
127
+ Diagram.any_instance.expects(:save)
122
128
  Diagram::Graphviz.create(:orientation => :vertical)
123
- assert File.exists?("erd.png")
124
129
  end
125
130
 
126
131
  test "create should create output for domain if orientation is vertical" do
127
132
  create_simple_domain
133
+
134
+ Diagram.any_instance.expects(:save)
128
135
  Diagram::Graphviz.create(:orientation => :vertical)
129
- assert File.exists?("erd.png")
130
136
  end
131
137
 
132
138
  test "create should not create output if there are no connected models" do
@@ -144,24 +150,16 @@ class GraphvizTest < ActiveSupport::TestCase
144
150
  assert_match /No entities found/, message
145
151
  end
146
152
 
147
- test "create should write to given file name plus extension if present" do
148
- begin
149
- create_simple_domain
150
- Diagram::Graphviz.create :filename => "foobar"
151
- assert File.exists?("foobar.png")
152
- ensure
153
- FileUtils.rm "foobar.png" rescue nil
154
- end
155
- end
156
-
157
153
  test "create should abort and complain if output directory does not exist" do
158
154
  message = nil
155
+
159
156
  begin
160
157
  create_simple_domain
161
- Diagram::Graphviz.create :filename => "does_not_exist/foo"
158
+ Diagram::Graphviz.create(:filename => "does_not_exist/foo")
162
159
  rescue => e
163
160
  message = e.message
164
161
  end
162
+
165
163
  assert_match /Output directory 'does_not_exist' does not exist/, message
166
164
  end
167
165
 
@@ -33,8 +33,9 @@ class RakeTaskTest < ActiveSupport::TestCase
33
33
  # Diagram generation =======================================================
34
34
  test "generate task should create output based on domain model" do
35
35
  create_simple_domain
36
+
37
+ Diagram.any_instance.expects(:save)
36
38
  Rake::Task["erd:generate"].execute
37
- assert File.exists?("erd.dot")
38
39
  end
39
40
 
40
41
  test "generate task should not create output if there are no connected models" do
@@ -45,27 +46,35 @@ class RakeTaskTest < ActiveSupport::TestCase
45
46
  test "generate task should eager load application environment" do
46
47
  eager_loaded, environment_loaded = nil
47
48
  create_app
49
+
48
50
  Rails.application.class_eval do
49
51
  define_method :eager_load! do
50
52
  eager_loaded = true
51
53
  end
52
54
  end
55
+
53
56
  Rake::Task.define_task :environment do
54
57
  environment_loaded = true
55
58
  end
59
+
56
60
  create_simple_domain
61
+
57
62
  Rake::Task["erd:generate"].invoke
63
+
58
64
  assert_equal [true, true], [eager_loaded, environment_loaded]
59
65
  end
60
66
 
61
67
  test "generate task should complain if active record is not loaded" do
62
68
  create_app
69
+
63
70
  Rails.application.class_eval do
64
71
  define_method :eager_load! do end
65
72
  end
73
+
66
74
  Rake::Task.define_task :environment
67
75
  Object.send :remove_const, :ActiveRecord
68
76
  message = nil
77
+
69
78
  begin
70
79
  Rake::Task["erd:generate"].invoke
71
80
  rescue => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-erd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rolf Timmermans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-27 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord