html_attributes 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 17207d28d748bc86025194248244278b5baa2f14
4
- data.tar.gz: f74c943314eb6cf59f24556c2f377406aeb7f55d
3
+ metadata.gz: 88416dcda26690786311bc8696a7f217496c4edf
4
+ data.tar.gz: b11b2cc5ded0e65cbfd3b7d6e6e5e3f3288b4432
5
5
  SHA512:
6
- metadata.gz: f328b93be218490cbeab3ea7d3166b4bfbd6da3f55f0a4895d1bde69ba24f830dfdd907eee4de100f0105760868decab77886a27e861885a8a311a4c64c9e528
7
- data.tar.gz: da7e48403c5ec0c2764c3786b79b2009a03d2186fe9e4b1081602011e8d2ce4ddb2871af95e565a59a41b548efebc257d5272f715b581bde54c24a3c7d170c1d
6
+ metadata.gz: 80d794781c3457f06c0ba608ba7b6e02854edcddf1ff2e49e5d499dd8d92ddfe8aa9032ac20f4c118c274f0d294b46244e3dfb07f92f9cea1f73898bd3492444
7
+ data.tar.gz: eb8c9dad5d50c792b026cc8e36f826a5111076d51e711804825762efe7866e9c1c7c830adce87f6b47fed68366a8cd6dd8756eab67df2f87a23f4248a49ed6a9
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.version = HtmlAttributes::VERSION
20
20
  gem.platform = Gem::Platform::RUBY
21
21
 
22
- gem.add_dependency "actionview", ">= 4.0", "< 5.2"
22
+ gem.add_dependency "actionview", ">= 4.0", "< 6"
23
23
 
24
24
  gem.add_development_dependency "rspec"
25
25
 
@@ -1,5 +1,5 @@
1
1
  module HtmlAttributes
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
 
4
4
  module Version
5
5
  version = VERSION.to_s.split(".").map { |i| i.to_i }
@@ -5,7 +5,7 @@ if defined?(ActionView::Helpers::TagHelper)
5
5
 
6
6
  require "html_attributes/rails/tag_helper"
7
7
 
8
- if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1
8
+ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 2
9
9
  ActionView::Helpers::TagHelper::TagBuilder.send(:include, HtmlAttributes::TagHelper)
10
10
  else
11
11
  ActionView::Helpers::TagHelper.module_eval do
@@ -4,38 +4,38 @@ describe Array do
4
4
 
5
5
  describe "#to_class_attr" do
6
6
 
7
- it "should return nil if array is empty" do
7
+ it "returns nil if array is empty" do
8
8
  classes = []
9
- classes.to_class_attr.should be_nil
9
+ expect(classes.to_class_attr).to be_nil
10
10
  end
11
11
 
12
- it "should return a space separated string if array contains strings" do
12
+ it "returns a space separated string if array contains strings" do
13
13
  classes = ["first", "second", "third"]
14
- classes.to_class_attr.should eql("first second third")
14
+ expect(classes.to_class_attr).to eql("first second third")
15
15
  end
16
16
 
17
- it "should preserve existing spaces" do
17
+ it "preserves existing spaces" do
18
18
  classes = ["first", "second third", "forth"]
19
- classes.to_class_attr.should eql("first second third forth")
19
+ expect(classes.to_class_attr).to eql("first second third forth")
20
20
  end
21
21
 
22
22
  end
23
23
 
24
24
  describe "#to_style_attr" do
25
25
 
26
- it "should return nil if array is empty" do
26
+ it "returns nil if array is empty" do
27
27
  styles = []
28
- styles.to_style_attr.should be_nil
28
+ expect(styles.to_style_attr).to be_nil
29
29
  end
30
30
 
31
- it "should return a semicolon separated string if array contains strings" do
31
+ it "returns a semicolon separated string if array contains strings" do
32
32
  styles = ["padding-top: 8px", "padding-right: 15px", "font-size: 12pt"]
33
- styles.to_style_attr.should eql("padding-top: 8px; padding-right: 15px; font-size: 12pt;")
33
+ expect(styles.to_style_attr).to eql("padding-top: 8px; padding-right: 15px; font-size: 12pt;")
34
34
  end
35
35
 
36
- it "should preserve existing semicolon" do
36
+ it "preserves existing semicolon" do
37
37
  styles = ["padding-top: 8px; padding-right: 15px", "font-size: 12pt"]
38
- styles.to_style_attr.should eql("padding-top: 8px; padding-right: 15px; font-size: 12pt;")
38
+ expect(styles.to_style_attr).to eql("padding-top: 8px; padding-right: 15px; font-size: 12pt;")
39
39
  end
40
40
 
41
41
  end
@@ -4,84 +4,84 @@ describe Hash do
4
4
 
5
5
  describe "#to_class_attr" do
6
6
 
7
- it "should return nil if hash is empty" do
7
+ it "returns nil if hash is empty" do
8
8
  classes = {}
9
- classes.to_class_attr.should be_nil
9
+ expect(classes.to_class_attr).to be_nil
10
10
  end
11
11
 
12
- it "should return nil if hash only contains false values" do
12
+ it "returns nil if hash only contains false values" do
13
13
  classes = { :foo => false, :bar => false }
14
- classes.to_class_attr.should be_nil
14
+ expect(classes.to_class_attr).to be_nil
15
15
  end
16
16
 
17
- it "should return space separated string" do
17
+ it "returns space separated string" do
18
18
  classes = { :first => true, :second => true, :third => true }
19
- classes.to_class_attr.should eql("first second third")
19
+ expect(classes.to_class_attr).to eql("first second third")
20
20
  end
21
21
 
22
- it "should return space separated string only for true values" do
22
+ it "returns space separated string only for true values" do
23
23
  classes = { :first => true, :second => false, :third => true }
24
- classes.to_class_attr.should eql("first third")
24
+ expect(classes.to_class_attr).to eql("first third")
25
25
  end
26
26
 
27
27
  end
28
28
 
29
29
  describe "#to_style_attr" do
30
30
 
31
- it "should return nil if hash is empty" do
31
+ it "returns nil if hash is empty" do
32
32
  styles = {}
33
- styles.to_style_attr.should be_nil
33
+ expect(styles.to_style_attr).to be_nil
34
34
  end
35
35
 
36
- it "should return nil if hash only contains nil values" do
36
+ it "returns nil if hash only contains nil values" do
37
37
  styles = { :display => nil }
38
- styles.to_style_attr.should be_nil
38
+ expect(styles.to_style_attr).to be_nil
39
39
  end
40
40
 
41
- it "should return semicolon separated string" do
41
+ it "returns semicolon separated string" do
42
42
  styles = { :display => "none", :visibility => "hidden" }
43
- styles.to_style_attr.should eql("display: none; visibility: hidden;")
43
+ expect(styles.to_style_attr).to eql("display: none; visibility: hidden;")
44
44
  end
45
45
 
46
- it "should replace '_' in keys with '-'" do
46
+ it "replaces '_' in keys with '-'" do
47
47
  styles = { :font_size => "12pt" }
48
- styles.to_style_attr.should eql("font-size: 12pt;")
48
+ expect(styles.to_style_attr).to eql("font-size: 12pt;")
49
49
  end
50
50
 
51
- it "should flatten hash to construct style statements" do
51
+ it "flattens hash to construct style statements" do
52
52
  styles = { :padding => { :top => "8px", :right => "15px" }, :font_size => "12pt" }
53
- styles.to_style_attr.should eql("font-size: 12pt; padding-right: 15px; padding-top: 8px;")
53
+ expect(styles.to_style_attr).to eql("font-size: 12pt; padding-right: 15px; padding-top: 8px;")
54
54
  end
55
55
 
56
56
  end
57
57
 
58
58
  describe "#flatten" do
59
59
 
60
- it "should do nothing for emtpy hash" do
61
- {}.flatten.should eql({})
60
+ it "does nothing for emtpy hash" do
61
+ expect({}.flatten).to eql({})
62
62
  end
63
63
 
64
- it "should do nothing for unnested hash" do
65
- { "padding" => "8px", "font_size" => "12pt" }.flatten.should eql({ "padding" => "8px", "font_size" => "12pt" })
64
+ it "does nothing for unnested hash" do
65
+ expect({ "padding" => "8px", "font_size" => "12pt" }.flatten).to eql({ "padding" => "8px", "font_size" => "12pt" })
66
66
  end
67
67
 
68
- it "should convert symbolized keys to stringified keys" do
69
- { :padding => "8px", :font_size => "12pt" }.flatten.should eql({ "padding" => "8px", "font_size" => "12pt" })
68
+ it "converts symbolized keys to stringified keys" do
69
+ expect({ :padding => "8px", :font_size => "12pt" }.flatten).to eql({ "padding" => "8px", "font_size" => "12pt" })
70
70
  end
71
71
 
72
- it "should flatten nested hash" do
72
+ it "flattens nested hash" do
73
73
  styles = { :padding => { :top => "8px", :right => "15px" } }
74
- styles.flatten.should eql({ "paddingtop" => "8px", "paddingright" => "15px" })
74
+ expect(styles.flatten).to eql({ "paddingtop" => "8px", "paddingright" => "15px" })
75
75
  end
76
76
 
77
- it "should flatten nested hash using given separator" do
77
+ it "flattens nested hash using given separator" do
78
78
  styles = { :padding => { :top => "8px", :right => "15px" } }
79
- styles.flatten("-").should eql({ "padding-top" => "8px", "padding-right" => "15px" })
79
+ expect(styles.flatten("-")).to eql({ "padding-top" => "8px", "padding-right" => "15px" })
80
80
  end
81
81
 
82
- it "should pass array of nested keys if block is given" do
82
+ it "passes array of nested keys if block is given" do
83
83
  styles = { :padding => { :top => "8px", :right => "15px" } }
84
- styles.flatten { |keys| keys.join('-') }.should eql({ "padding-top" => "8px", "padding-right" => "15px" })
84
+ expect(styles.flatten { |keys| keys.join('-') }).to eql({ "padding-top" => "8px", "padding-right" => "15px" })
85
85
  end
86
86
 
87
87
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Sebastian Siwy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-10-10 00:00:00.000000000 Z
13
+ date: 2019-04-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionview
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '4.0'
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '5.2'
24
+ version: '6'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +31,7 @@ dependencies:
31
31
  version: '4.0'
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '5.2'
34
+ version: '6'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rspec
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.4.5.1
90
+ rubygems_version: 2.5.2.3
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: html_attributes provide helper methods to convert arrays and hashes to valid