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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6eb07c6d956fc01d7c308a30661e84b9091ea0cc02f95ebd7d4478107e79462
4
- data.tar.gz: 8c42770dd22551fec9ba5edd6bb49c2954150579fbf8ee5349f0e320f8d3c3f4
3
+ metadata.gz: a3e5072199d7fc4e375ea7004f0e5273e3bf7506f022d6d914367a31e4d9bb6c
4
+ data.tar.gz: bfb79ce50422f7f4d9ff9a2c9c1258cb70e0674d150f1ebf18f0e346a96dd557
5
5
  SHA512:
6
- metadata.gz: 20d346df127433342fb904d9b8c5871c2b703a4518c12b338c990ac1b8c9d1857a8e485d44e4c084f59e95626b29f01f64c195eabe79da876b8da2916b82e1be
7
- data.tar.gz: fea7995fb635d04bd803b01402d043c0a7a17027129c3ca7e8b927486cd4d2160125fb2270e11a2efd1a72f9ba7f921be9a9de108bbbd5d0b3541db602a2d52c
6
+ metadata.gz: '09195fb6084a198e35c1dcd6dd216009a6a8d2c9ea774e902c56278ff08fbc4dc50b6a9fadb277045c2edb3754ec5d0d08946b6dfde82d0ba81dfbcf2d984fd0'
7
+ data.tar.gz: 4652bd99bf54e6991f6e24b445a7e1e3f5665074b3d7384e051acae16da6f3010208224841a17382d5ab625ddec51e157ff25079fe246cb09983a50678e7b260
@@ -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
@@ -1,3 +1,3 @@
1
1
  module TableHelp
2
- VERSION = "0.1.6".freeze
2
+ VERSION = "0.1.7".freeze
3
3
  end
@@ -26,13 +26,21 @@ RSpec.describe TableHelp::Helper do
26
26
  end
27
27
  end
28
28
 
29
- context "when passed an ActiveRecord::Relation" do
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.6
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-02 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties