table_help 0.1.6 → 0.1.7
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 +4 -4
- data/lib/table_help/config.rb +1 -1
- data/lib/table_help/version.rb +1 -1
- data/spec/helper_spec.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e5072199d7fc4e375ea7004f0e5273e3bf7506f022d6d914367a31e4d9bb6c
|
4
|
+
data.tar.gz: bfb79ce50422f7f4d9ff9a2c9c1258cb70e0674d150f1ebf18f0e346a96dd557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09195fb6084a198e35c1dcd6dd216009a6a8d2c9ea774e902c56278ff08fbc4dc50b6a9fadb277045c2edb3754ec5d0d08946b6dfde82d0ba81dfbcf2d984fd0'
|
7
|
+
data.tar.gz: 4652bd99bf54e6991f6e24b445a7e1e3f5665074b3d7384e051acae16da6f3010208224841a17382d5ab625ddec51e157ff25079fe246cb09983a50678e7b260
|
data/lib/table_help/config.rb
CHANGED
@@ -15,7 +15,7 @@ module TableHelp
|
|
15
15
|
when ActiveRecord::Relation
|
16
16
|
collection_or_resource.model.human_attribute_name(name)
|
17
17
|
when Enumerable
|
18
|
-
collection_or_resource.first.class.human_attribute_name(name)
|
18
|
+
collection_or_resource.first.class.human_attribute_name(name) unless collection_or_resource.empty?
|
19
19
|
else
|
20
20
|
collection_or_resource.class.human_attribute_name(name)
|
21
21
|
end
|
data/lib/table_help/version.rb
CHANGED
data/spec/helper_spec.rb
CHANGED
@@ -26,13 +26,21 @@ RSpec.describe TableHelp::Helper do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
context "when passed an
|
29
|
+
context "when passed an Enumerable" do
|
30
30
|
let(:articles) { Article.all.to_a }
|
31
31
|
|
32
32
|
it "builds an HTML table" do
|
33
33
|
is_expected.to have_css "td.col-title", text: "My Awesome Title"
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
context "when passed an empty Enumerable" do
|
38
|
+
let(:articles) { [] }
|
39
|
+
|
40
|
+
it "does not build an HTML table" do
|
41
|
+
is_expected.to be_nil
|
42
|
+
end
|
43
|
+
end
|
36
44
|
end
|
37
45
|
|
38
46
|
describe "#attributes_table_for" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_help
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiyuki Hirano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|