awesome_print 1.8.0 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Appraisals +16 -48
- data/CHANGELOG.md +10 -1
- data/LICENSE +16 -19
- data/README.md +3 -10
- data/lib/ap.rb +1 -5
- data/lib/awesome_print.rb +7 -29
- data/lib/awesome_print/colorize.rb +2 -0
- data/lib/awesome_print/core_ext/active_support.rb +7 -0
- data/lib/awesome_print/core_ext/awesome_method_array.rb +0 -6
- data/lib/awesome_print/core_ext/class.rb +0 -5
- data/lib/awesome_print/core_ext/kernel.rb +0 -5
- data/lib/awesome_print/core_ext/logger.rb +0 -5
- data/lib/awesome_print/core_ext/object.rb +0 -5
- data/lib/awesome_print/core_ext/string.rb +0 -5
- data/lib/awesome_print/formatter.rb +38 -98
- data/lib/awesome_print/formatters/array_formatter.rb +10 -7
- data/lib/awesome_print/formatters/base_formatter.rb +17 -50
- data/lib/awesome_print/formatters/bigdecimal_formatter.rb +20 -0
- data/lib/awesome_print/formatters/class_formatter.rb +5 -6
- data/lib/awesome_print/formatters/dir_formatter.rb +4 -6
- data/lib/awesome_print/formatters/ext/active_model_error_formatter.rb +44 -0
- data/lib/awesome_print/formatters/ext/active_record_attributeset_formatter.rb +27 -0
- data/lib/awesome_print/formatters/ext/active_record_class_formatter.rb +43 -0
- data/lib/awesome_print/formatters/ext/active_record_instance_formatter.rb +48 -0
- data/lib/awesome_print/formatters/ext/active_record_relation_formatter.rb +19 -0
- data/lib/awesome_print/formatters/ext/bson_objectid_formatter.rb +20 -0
- data/lib/awesome_print/formatters/ext/hash_with_indifferent_access_formatter.rb +20 -0
- data/lib/awesome_print/formatters/ext/mongoid_document_formatter.rb +59 -0
- data/lib/awesome_print/formatters/ext/nokogiri_document_formatter.rb +30 -0
- data/lib/awesome_print/formatters/ext/nokogiri_node_formatter.rb +29 -0
- data/lib/awesome_print/formatters/ext/nokogiri_nodeset_formatter.rb +32 -0
- data/lib/awesome_print/formatters/ext/sequel_dataset_formatter.rb +20 -0
- data/lib/awesome_print/formatters/ext/sequel_model_class_formatter.rb +25 -0
- data/lib/awesome_print/formatters/ext/sequel_model_formatter.rb +26 -0
- data/lib/awesome_print/formatters/ext/time_with_zone_formatter.rb +24 -0
- data/lib/awesome_print/formatters/fallback_formatter.rb +55 -0
- data/lib/awesome_print/formatters/false_class_formatter.rb +15 -0
- data/lib/awesome_print/formatters/file_formatter.rb +4 -6
- data/lib/awesome_print/formatters/hash_formatter.rb +12 -7
- data/lib/awesome_print/formatters/integer_formatter.rb +11 -0
- data/lib/awesome_print/formatters/method_formatter.rb +8 -6
- data/lib/awesome_print/formatters/module_formatter.rb +18 -0
- data/lib/awesome_print/formatters/nil_class_formatter.rb +19 -0
- data/lib/awesome_print/formatters/object_formatter.rb +20 -7
- data/lib/awesome_print/formatters/open_struct.rb +19 -0
- data/lib/awesome_print/formatters/range_formatter.rb +11 -0
- data/lib/awesome_print/formatters/rational_formatter.rb +15 -0
- data/lib/awesome_print/formatters/set_formatter.rb +19 -0
- data/lib/awesome_print/formatters/simple_formatter.rb +10 -8
- data/lib/awesome_print/formatters/string_formatter.rb +14 -0
- data/lib/awesome_print/formatters/struct_formatter.rb +8 -6
- data/lib/awesome_print/formatters/symbol_formatter.rb +18 -0
- data/lib/awesome_print/formatters/true_class_formatter.rb +15 -0
- data/lib/awesome_print/formatters/unbound_method_formatter.rb +15 -0
- data/lib/awesome_print/inspector.rb +20 -16
- data/lib/awesome_print/limiter.rb +63 -0
- data/lib/awesome_print/registrar.rb +20 -0
- data/lib/awesome_print/version.rb +6 -6
- data/spec/formatters/array_spec.rb +251 -0
- data/spec/formatters/big_decimal_spec.rb +28 -0
- data/spec/formatters/class_spec.rb +91 -0
- data/spec/formatters/dir_file_spec.rb +43 -0
- data/spec/{ext → formatters/ext}/active_record_spec.rb +27 -63
- data/spec/{ext → formatters/ext}/active_support_spec.rb +6 -6
- data/spec/{ext → formatters/ext}/mongoid_spec.rb +4 -41
- data/spec/{ext → formatters/ext}/nokogiri_spec.rb +0 -0
- data/spec/formatters/hash_spec.rb +284 -0
- data/spec/{methods_spec.rb → formatters/methods_spec.rb} +13 -7
- data/spec/{objects_spec.rb → formatters/objects_spec.rb} +49 -0
- data/spec/{ext → formatters}/ostruct_spec.rb +1 -0
- data/spec/formatters/set_spec.rb +49 -0
- data/spec/formatters/struct_spec.rb +61 -0
- data/spec/merge_options_spec.rb +13 -0
- data/spec/misc_spec.rb +21 -21
- data/spec/spec_helper.rb +5 -10
- data/spec/support/active_record_data/5_1_diana.txt +104 -0
- data/spec/support/active_record_data/5_1_multi.txt +210 -0
- data/spec/support/active_record_data/5_2_diana.txt +104 -0
- data/spec/support/active_record_data/5_2_multi.txt +210 -0
- data/spec/support/ext_verifier.rb +0 -15
- data/spec/support/mongoid_versions.rb +4 -4
- data/spec/support/rails_versions.rb +10 -20
- metadata +98 -87
- data/lib/awesome_print/core_ext/method.rb +0 -21
- data/lib/awesome_print/ext/action_view.rb +0 -22
- data/lib/awesome_print/ext/active_record.rb +0 -78
- data/lib/awesome_print/ext/active_support.rb +0 -47
- data/lib/awesome_print/ext/mongo_mapper.rb +0 -124
- data/lib/awesome_print/ext/mongoid.rb +0 -67
- data/lib/awesome_print/ext/nobrainer.rb +0 -52
- data/lib/awesome_print/ext/nokogiri.rb +0 -45
- data/lib/awesome_print/ext/ostruct.rb +0 -27
- data/lib/awesome_print/ext/ripple.rb +0 -71
- data/lib/awesome_print/ext/sequel.rb +0 -58
- data/spec/ext/action_view_spec.rb +0 -18
- data/spec/ext/mongo_mapper_spec.rb +0 -261
- data/spec/ext/nobrainer_spec.rb +0 -59
- data/spec/ext/ripple_spec.rb +0 -48
- data/spec/formats_spec.rb +0 -779
- data/spec/support/active_record_data/3_2_diana.txt +0 -24
- data/spec/support/active_record_data/3_2_diana_legacy.txt +0 -24
- data/spec/support/active_record_data/3_2_multi.txt +0 -50
- data/spec/support/active_record_data/3_2_multi_legacy.txt +0 -50
- data/spec/support/active_record_data/4_0_diana.txt +0 -98
- data/spec/support/active_record_data/4_0_multi.txt +0 -198
- data/spec/support/active_record_data/4_1_diana.txt +0 -97
- data/spec/support/active_record_data/4_1_multi.txt +0 -196
- data/spec/support/active_record_data/4_2_diana.txt +0 -109
- data/spec/support/active_record_data/4_2_diana_legacy.txt +0 -109
- data/spec/support/active_record_data/4_2_multi.txt +0 -220
- data/spec/support/active_record_data/4_2_multi_legacy.txt +0 -220
@@ -7,12 +7,20 @@ RSpec.describe 'Single method' do
|
|
7
7
|
|
8
8
|
it 'plain: should handle a method with no arguments' do
|
9
9
|
method = ''.method(:upcase)
|
10
|
-
|
10
|
+
if RUBY_VERSION >= '2.4.0'
|
11
|
+
expect(method.ai(plain: true)).to eq('String#upcase(*arg1)')
|
12
|
+
else
|
13
|
+
expect(method.ai(plain: true)).to eq('String#upcase()')
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
it 'color: should handle a method with no arguments' do
|
14
18
|
method = ''.method(:upcase)
|
15
|
-
|
19
|
+
if RUBY_VERSION >= '2.4.0'
|
20
|
+
expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m(*arg1)\e[0m")
|
21
|
+
else
|
22
|
+
expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m()\e[0m")
|
23
|
+
end
|
16
24
|
end
|
17
25
|
|
18
26
|
it 'plain: should handle a method with one argument' do
|
@@ -54,7 +62,9 @@ RSpec.describe 'Single method' do
|
|
54
62
|
method = ''.method(:is_a?)
|
55
63
|
expect(method.ai).to eq("\e[1;33mString (Kernel)\e[0m#\e[0;35mis_a?\e[0m\e[0;37m(arg1)\e[0m")
|
56
64
|
end
|
65
|
+
end
|
57
66
|
|
67
|
+
RSpec.describe 'unbound methods' do
|
58
68
|
it 'plain: should handle an unbound method' do
|
59
69
|
class Hello
|
60
70
|
def world; end
|
@@ -68,11 +78,7 @@ RSpec.describe 'Single method' do
|
|
68
78
|
def world(a, b); end
|
69
79
|
end
|
70
80
|
method = Hello.instance_method(:world)
|
71
|
-
|
72
|
-
expect(method.ai).to eq("\e[1;33mHello (unbound)\e[0m#\e[0;35mworld\e[0m\e[0;37m(arg1, arg2)\e[0m")
|
73
|
-
else
|
74
|
-
expect(method.ai).to eq("\e[1;33mHello (unbound)\e[0m#\e[0;35mworld\e[0m\e[0;37m(a, b)\e[0m")
|
75
|
-
end
|
81
|
+
expect(method.ai).to eq("\e[1;33mHello (unbound)\e[0m#\e[0;35mworld\e[0m\e[0;37m(a, b)\e[0m")
|
76
82
|
end
|
77
83
|
end
|
78
84
|
|
@@ -167,5 +167,54 @@ EOS
|
|
167
167
|
expect(out).to be_similar_to(str)
|
168
168
|
expect(hello.ai(plain: true, raw: false)).to eq(hello.inspect)
|
169
169
|
end
|
170
|
+
|
171
|
+
it 'object_id' do
|
172
|
+
class Hello
|
173
|
+
def initialize
|
174
|
+
@abra = 1
|
175
|
+
@ca = 2
|
176
|
+
@dabra = 3
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
hello = Hello.new
|
181
|
+
out = hello.ai(plain: true, raw: true, object_id: false)
|
182
|
+
str = <<-EOS.strip
|
183
|
+
#<Hello
|
184
|
+
@abra = 1,
|
185
|
+
@ca = 2,
|
186
|
+
@dabra = 3
|
187
|
+
>
|
188
|
+
EOS
|
189
|
+
expect(out).to be_similar_to(str)
|
190
|
+
expect(hello.ai(plain: true, raw: false)).to eq(hello.inspect)
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'class_name' do
|
194
|
+
class Hello
|
195
|
+
def initialize
|
196
|
+
@abra = 1
|
197
|
+
@ca = 2
|
198
|
+
@dabra = 3
|
199
|
+
end
|
200
|
+
|
201
|
+
def to_s
|
202
|
+
"CustomizedHello"
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
hello = Hello.new
|
207
|
+
out = hello.ai(plain: true, raw: true, class_name: :to_s)
|
208
|
+
str = <<-EOS.strip
|
209
|
+
#<CustomizedHello:placeholder_id
|
210
|
+
@abra = 1,
|
211
|
+
@ca = 2,
|
212
|
+
@dabra = 3
|
213
|
+
>
|
214
|
+
EOS
|
215
|
+
expect(out).to be_similar_to(str)
|
216
|
+
expect(hello.ai(plain: true, raw: false)).to eq(hello.inspect)
|
217
|
+
end
|
218
|
+
|
170
219
|
end
|
171
220
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'set'
|
3
|
+
|
4
|
+
RSpec.describe 'AwesomePrint' do
|
5
|
+
describe 'Set' do
|
6
|
+
before do
|
7
|
+
@arr = [1, :two, 'three']
|
8
|
+
@set = Set.new(@arr)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'empty set' do
|
12
|
+
expect(Set.new.ai).to eq([].ai)
|
13
|
+
end
|
14
|
+
|
15
|
+
if RUBY_VERSION > '1.9'
|
16
|
+
it 'plain multiline' do
|
17
|
+
expect(@set.ai(plain: true)).to eq(@arr.ai(plain: true))
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'plain multiline indented' do
|
21
|
+
expect(@set.ai(plain: true, indent: 1)).to eq(@arr.ai(plain: true, indent: 1))
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'plain single line' do
|
25
|
+
expect(@set.ai(plain: true, multiline: false)).to eq(@arr.ai(plain: true, multiline: false))
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'colored multiline (default)' do
|
29
|
+
expect(@set.ai).to eq(@arr.ai)
|
30
|
+
end
|
31
|
+
else # Prior to Ruby 1.9 the order of set values is unpredicatble.
|
32
|
+
it 'plain multiline' do
|
33
|
+
expect(@set.sort_by { |x| x.to_s }.ai(plain: true)).to eq(@arr.sort_by { |x| x.to_s }.ai(plain: true))
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'plain multiline indented' do
|
37
|
+
expect(@set.sort_by { |x| x.to_s }.ai(plain: true, indent: 1)).to eq(@arr.sort_by { |x| x.to_s }.ai(plain: true, indent: 1))
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'plain single line' do
|
41
|
+
expect(@set.sort_by { |x| x.to_s }.ai(plain: true, multiline: false)).to eq(@arr.sort_by { |x| x.to_s }.ai(plain: true, multiline: false))
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'colored multiline (default)' do
|
45
|
+
expect(@set.sort_by { |x| x.to_s }.ai).to eq(@arr.sort_by { |x| x.to_s }.ai)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'AwesomePrint' do
|
4
|
+
describe 'Struct' do
|
5
|
+
before do
|
6
|
+
@struct = unless defined?(Struct::SimpleStruct)
|
7
|
+
Struct.new('SimpleStruct', :name, :address).new
|
8
|
+
else
|
9
|
+
Struct::SimpleStruct.new
|
10
|
+
end
|
11
|
+
@struct.name = 'Herman Munster'
|
12
|
+
@struct.address = '1313 Mockingbird Lane'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'empty struct' do
|
16
|
+
expect(Struct.new('EmptyStruct').ai).to eq("\e[1;33mStruct::EmptyStruct < Struct\e[0m")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'plain multiline' do
|
20
|
+
s1 = <<-EOS.strip
|
21
|
+
address = \"1313 Mockingbird Lane\",
|
22
|
+
name = \"Herman Munster\"
|
23
|
+
EOS
|
24
|
+
s2 = <<-EOS.strip
|
25
|
+
name = \"Herman Munster\",
|
26
|
+
address = \"1313 Mockingbird Lane\"
|
27
|
+
EOS
|
28
|
+
expect(@struct.ai(plain: true)).to satisfy { |out| out.match(s1) || out.match(s2) }
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'plain multiline indented' do
|
32
|
+
s1 = <<-EOS.strip
|
33
|
+
address = "1313 Mockingbird Lane",
|
34
|
+
name = "Herman Munster"
|
35
|
+
EOS
|
36
|
+
s2 = <<-EOS.strip
|
37
|
+
name = "Herman Munster",
|
38
|
+
address = "1313 Mockingbird Lane"
|
39
|
+
EOS
|
40
|
+
expect(@struct.ai(plain: true, indent: 1)).to satisfy { |out| out.match(s1) || out.match(s2) }
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'plain single line' do
|
44
|
+
s1 = 'address = "1313 Mockingbird Lane", name = "Herman Munster"'
|
45
|
+
s2 = 'name = "Herman Munster", address = "1313 Mockingbird Lane"'
|
46
|
+
expect(@struct.ai(plain: true, multiline: false)).to satisfy { |out| out.match(s1) || out.match(s2) }
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'colored multiline (default)' do
|
50
|
+
s1 = <<-EOS.strip
|
51
|
+
address\e[0;37m = \e[0m\e[0;33m\"1313 Mockingbird Lane\"\e[0m,
|
52
|
+
name\e[0;37m = \e[0m\e[0;33m\"Herman Munster\"\e[0m
|
53
|
+
EOS
|
54
|
+
s2 = <<-EOS.strip
|
55
|
+
name\e[0;37m = \e[0m\e[0;33m\"Herman Munster\"\e[0m,
|
56
|
+
address\e[0;37m = \e[0m\e[0;33m\"1313 Mockingbird Lane\"\e[0m
|
57
|
+
EOS
|
58
|
+
expect(@struct.ai).to satisfy { |out| out.include?(s1) || out.include?(s2) }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'AwesomePrint' do
|
4
|
+
describe 'Utility methods' do
|
5
|
+
it 'should merge options' do
|
6
|
+
ap = AwesomePrint::Inspector.new
|
7
|
+
ap.send(:merge_options!, { color: { array: :black }, indent: 0 })
|
8
|
+
options = ap.instance_variable_get('@options')
|
9
|
+
expect(options[:color][:array]).to eq(:black)
|
10
|
+
expect(options[:indent]).to eq(0)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/misc_spec.rb
CHANGED
@@ -18,7 +18,7 @@ RSpec.describe 'AwesomePrint' do
|
|
18
18
|
'ice'.freeze
|
19
19
|
end
|
20
20
|
end
|
21
|
-
expect(weird.new.ai(plain:
|
21
|
+
expect(weird.new.ai(plain: true)).to eq('ice')
|
22
22
|
end
|
23
23
|
|
24
24
|
# See https://github.com/awesome-print/awesome_print/issues/35
|
@@ -45,7 +45,7 @@ RSpec.describe 'AwesomePrint' do
|
|
45
45
|
|
46
46
|
# Require different file name this time (lib/ap.rb vs. lib/awesome_print).
|
47
47
|
it "several require 'awesome_print' should do no harm" do
|
48
|
-
require File.expand_path(File.dirname(__FILE__) + '/../lib/
|
48
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/awesome_print')
|
49
49
|
expect { rand.ai }.not_to raise_error
|
50
50
|
end
|
51
51
|
|
@@ -58,7 +58,7 @@ RSpec.describe 'AwesomePrint' do
|
|
58
58
|
it 'IPAddr workaround' do
|
59
59
|
require 'ipaddr'
|
60
60
|
ipaddr = IPAddr.new('3ffe:505:2::1')
|
61
|
-
expect(ipaddr.ai).to eq('#<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>')
|
61
|
+
expect(ipaddr.ai(plain: true)).to eq('#<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>')
|
62
62
|
end
|
63
63
|
|
64
64
|
# See https://github.com/awesome-print/awesome_print/issues/139
|
@@ -88,23 +88,23 @@ RSpec.describe 'AwesomePrint' do
|
|
88
88
|
|
89
89
|
it 'wraps multiline ap output with <pre> tag with colorized <kbd>' do
|
90
90
|
markup = [1, :two, 'three']
|
91
|
-
expect(markup.ai(html: true)).to eq <<-EOS.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
91
|
+
expect(markup.ai(html: true)).to eq <<-EOS.strip
|
92
|
+
<pre>[
|
93
|
+
<kbd style="color:white">[0] </kbd><kbd style="color:blue">1</kbd>,
|
94
|
+
<kbd style="color:white">[1] </kbd><kbd style="color:darkcyan">:two</kbd>,
|
95
|
+
<kbd style="color:white">[2] </kbd><kbd style="color:brown">"three"</kbd>
|
96
|
+
]</pre>
|
97
97
|
EOS
|
98
98
|
end
|
99
99
|
|
100
100
|
it 'wraps hash ap output with only an outer <pre> tag' do
|
101
101
|
markup = [{ 'hello' => 'world' }]
|
102
|
-
expect(markup.ai(html: true)).to eq <<-EOS.
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
102
|
+
expect(markup.ai(html: true)).to eq <<-EOS.strip
|
103
|
+
<pre>[
|
104
|
+
<kbd style="color:white">[0] </kbd>{
|
105
|
+
"hello"<kbd style="color:slategray"> => </kbd><kbd style="color:brown">"world"</kbd>
|
106
|
+
}
|
107
|
+
]</pre>
|
108
108
|
EOS
|
109
109
|
end
|
110
110
|
|
@@ -130,12 +130,12 @@ RSpec.describe 'AwesomePrint' do
|
|
130
130
|
AwesomePrint.defaults = { indent: -2, sort_keys: true }
|
131
131
|
hash = { [0, 0, 255] => :yellow, :red => 'rgb(255, 0, 0)', 'magenta' => 'rgb(255, 0, 255)' }
|
132
132
|
out = hash.ai(plain: true)
|
133
|
-
expect(out).to eq <<-EOS.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
expect(out).to eq <<-EOS.strip
|
134
|
+
{
|
135
|
+
[ 0, 0, 255 ] => :yellow,
|
136
|
+
"magenta" => "rgb(255, 0, 255)",
|
137
|
+
:red => "rgb(255, 0, 0)"
|
138
|
+
}
|
139
139
|
EOS
|
140
140
|
end
|
141
141
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
# Copyright (c) 2010-2016 Michael Dvorkin and contributors
|
2
|
-
#
|
3
|
-
# Awesome Print is freely distributable under the terms of MIT license.
|
4
|
-
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
|
-
#------------------------------------------------------------------------------
|
6
|
-
#
|
7
1
|
# Running specs from the command line:
|
8
2
|
# $ rake spec # Entire spec suite.
|
9
3
|
# $ rspec spec/objects_spec.rb # Individual spec file.
|
@@ -15,8 +9,9 @@
|
|
15
9
|
# $ gem install rspec -v=2.6.0
|
16
10
|
#
|
17
11
|
|
18
|
-
require 'simplecov'
|
19
|
-
SimpleCov.start
|
12
|
+
# require 'simplecov'
|
13
|
+
# SimpleCov.start
|
14
|
+
|
20
15
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
21
16
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
22
17
|
|
@@ -24,6 +19,8 @@ Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each do |file|
|
|
24
19
|
require file
|
25
20
|
end
|
26
21
|
|
22
|
+
require 'byebug'
|
23
|
+
|
27
24
|
ExtVerifier.require_dependencies!(
|
28
25
|
%w(
|
29
26
|
rails
|
@@ -31,8 +28,6 @@ ExtVerifier.require_dependencies!(
|
|
31
28
|
action_view
|
32
29
|
active_support/all
|
33
30
|
mongoid
|
34
|
-
mongo_mapper
|
35
|
-
ripple nobrainer
|
36
31
|
)
|
37
32
|
)
|
38
33
|
require 'nokogiri'
|
@@ -0,0 +1,104 @@
|
|
1
|
+
#<User:placeholder_id
|
2
|
+
@_start_transaction_state = {},
|
3
|
+
@aggregation_cache = {},
|
4
|
+
@association_cache = {},
|
5
|
+
@destroyed = false,
|
6
|
+
@marked_for_destruction = false,
|
7
|
+
@new_record = true,
|
8
|
+
@readonly = false,
|
9
|
+
@transaction_state = nil,
|
10
|
+
attr_accessor :attributes = #<ActiveRecord::AttributeSet:placeholder_id
|
11
|
+
@attributes = {
|
12
|
+
"admin" => #<ActiveRecord::Attribute::FromUser:placeholder_id
|
13
|
+
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
|
14
|
+
@original_attribute = nil,
|
15
|
+
attr_reader :name = "admin",
|
16
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
17
|
+
attr_reader :limit = nil,
|
18
|
+
attr_reader :precision = nil,
|
19
|
+
attr_reader :scale = nil
|
20
|
+
>,
|
21
|
+
attr_reader :value_before_type_cast = nil
|
22
|
+
>,
|
23
|
+
attr_reader :name = "admin",
|
24
|
+
attr_reader :type = #<ActiveModel::Type::Boolean:placeholder_id
|
25
|
+
attr_reader :limit = nil,
|
26
|
+
attr_reader :precision = nil,
|
27
|
+
attr_reader :scale = nil
|
28
|
+
>,
|
29
|
+
attr_reader :value_before_type_cast = false
|
30
|
+
>,
|
31
|
+
"created_at" => #<ActiveRecord::Attribute::FromUser:placeholder_id
|
32
|
+
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
|
33
|
+
@original_attribute = nil,
|
34
|
+
attr_reader :name = "created_at",
|
35
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
36
|
+
attr_reader :limit = nil,
|
37
|
+
attr_reader :precision = nil,
|
38
|
+
attr_reader :scale = nil
|
39
|
+
>,
|
40
|
+
attr_reader :value_before_type_cast = nil
|
41
|
+
>,
|
42
|
+
attr_reader :name = "created_at",
|
43
|
+
attr_reader :type = #<ActiveRecord::Type::DateTime:placeholder_id
|
44
|
+
attr_reader :limit = nil,
|
45
|
+
attr_reader :precision = nil,
|
46
|
+
attr_reader :scale = nil
|
47
|
+
>,
|
48
|
+
attr_reader :value_before_type_cast = "1992-10-10 12:30:00"
|
49
|
+
>,
|
50
|
+
"id" => #<ActiveRecord::Attribute::FromDatabase:placeholder_id
|
51
|
+
@original_attribute = nil,
|
52
|
+
attr_reader :name = "id",
|
53
|
+
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
|
54
|
+
@range = -2147483648...2147483648,
|
55
|
+
attr_reader :limit = nil,
|
56
|
+
attr_reader :precision = nil,
|
57
|
+
attr_reader :scale = nil
|
58
|
+
>,
|
59
|
+
attr_reader :value_before_type_cast = nil
|
60
|
+
>,
|
61
|
+
"name" => #<ActiveRecord::Attribute::FromUser:placeholder_id
|
62
|
+
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
|
63
|
+
@original_attribute = nil,
|
64
|
+
attr_reader :name = "name",
|
65
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
66
|
+
attr_reader :limit = nil,
|
67
|
+
attr_reader :precision = nil,
|
68
|
+
attr_reader :scale = nil
|
69
|
+
>,
|
70
|
+
attr_reader :value_before_type_cast = nil
|
71
|
+
>,
|
72
|
+
attr_reader :name = "name",
|
73
|
+
attr_reader :type = #<ActiveModel::Type::String:placeholder_id
|
74
|
+
attr_reader :limit = nil,
|
75
|
+
attr_reader :precision = nil,
|
76
|
+
attr_reader :scale = nil
|
77
|
+
>,
|
78
|
+
attr_reader :value_before_type_cast = "Diana"
|
79
|
+
>,
|
80
|
+
"rank" => #<ActiveRecord::Attribute::FromUser:placeholder_id
|
81
|
+
@original_attribute = #<ActiveRecord::Attribute::FromDatabase:placeholder_id
|
82
|
+
@original_attribute = nil,
|
83
|
+
attr_reader :name = "rank",
|
84
|
+
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
|
85
|
+
@range = -2147483648...2147483648,
|
86
|
+
attr_reader :limit = nil,
|
87
|
+
attr_reader :precision = nil,
|
88
|
+
attr_reader :scale = nil
|
89
|
+
>,
|
90
|
+
attr_reader :value_before_type_cast = nil
|
91
|
+
>,
|
92
|
+
attr_reader :name = "rank",
|
93
|
+
attr_reader :type = #<ActiveModel::Type::Integer:placeholder_id
|
94
|
+
@range = -2147483648...2147483648,
|
95
|
+
attr_reader :limit = nil,
|
96
|
+
attr_reader :precision = nil,
|
97
|
+
attr_reader :scale = nil
|
98
|
+
>,
|
99
|
+
attr_reader :value_before_type_cast = 1
|
100
|
+
>
|
101
|
+
}
|
102
|
+
>,
|
103
|
+
attr_accessor :destroyed_by_association = nil
|
104
|
+
>
|