rspec-html 0.2.11 → 0.2.12

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
  SHA256:
3
- metadata.gz: 8052637b48c07f5312c3c0f6c4f3c42b790691758ab66b92240509bc19512b78
4
- data.tar.gz: 28332c0112b53c97613bb24f387d6b9cef099527d363416856a44eab9e9f7260
3
+ metadata.gz: 0c34a7cf68a03240483a87a23055af2dd15b8215e8e9d071b3d5a1599a69af0e
4
+ data.tar.gz: 03c82e1d52598e7b77f0fcdd9c7a12223e60dbd9e638d31d06be64d2833a26cf
5
5
  SHA512:
6
- metadata.gz: aa6583f785fd6e9da9e0a6c6d2a06e4f262e749e75d99e7a808fb937c3d08c882366424ffffcaf70e7d19de44027064435148ac9a8c9b3d4607ca67f218e5377
7
- data.tar.gz: 419571c56771c6c5b46a7197ce3f8f3cb866c00e0db54201c1106e9f2105099c78461feb719b81ddf5d924b6098859f57e5c4107140583805ba84b3c6555a2d5
6
+ metadata.gz: 576bb61d56e699378ec157adc9b4d8a14097c4443b1a79586f10bf866d26904e5a9e9777a4a9bc68650d1c53552e50c8c3dbba7f35e1326989a4bcff2fa071d7
7
+ data.tar.gz: 27a02c3c756539d5e24d441f49a1e09463638567425f36e19a231d849d6c42eb3faea86633d6a76685135b9e4dbdeb8b05ceba9e9eca514cfdfdfb9473c4a645
data/README.md CHANGED
@@ -7,7 +7,7 @@ _RSpec::HTML_ provides a simple object interface to HTML responses from [_RSpec
7
7
  Add the gem to your `Gemfile`:
8
8
 
9
9
  ```ruby
10
- gem 'rspec-html', '~> 0.2.11'
10
+ gem 'rspec-html', '~> 0.2.12'
11
11
  ```
12
12
 
13
13
  And rebuild your bundle:
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSpec
4
4
  module HTML
5
- VERSION = '0.2.11'
5
+ VERSION = '0.2.12'
6
6
  end
7
7
  end
@@ -29,7 +29,7 @@ module RSpecHTML
29
29
  alias exist? present?
30
30
 
31
31
  def inspect
32
- "<#{self.class}::#{name.to_s.capitalize}>"
32
+ reconstituted
33
33
  end
34
34
 
35
35
  def to_s
@@ -12,7 +12,7 @@ module RSpecHTML
12
12
  name = @tag.to_s.downcase
13
13
  return '#document' if name == 'document'
14
14
  return name if name == 'document'
15
- return "<#{name}#{@options} />" if @options.is_a?(String)
15
+ return "<#{name}#{shorthand_options} />" if @options.is_a?(String)
16
16
  return "<#{name}#{formatted_attributes} />" unless @options&.key?(:text)
17
17
 
18
18
  "<#{name}#{formatted_attributes}>#{@options[:text]}</#{name}>"
@@ -33,5 +33,23 @@ module RSpecHTML
33
33
  def formatted_attributes
34
34
  mapped_attributes.empty? ? nil : " #{mapped_attributes.join(' ')}"
35
35
  end
36
+
37
+ def shorthand_options
38
+ case @options[0]
39
+ when '.'
40
+ " #{shorthand_classes}"
41
+ when '#'
42
+ options = %( id="#{@options.partition('#').last.partition('.').first}")
43
+ shorthand_classes.nil? ? options : "#{options} #{shorthand_classes}"
44
+ else
45
+ @options
46
+ end
47
+ end
48
+
49
+ def shorthand_classes
50
+ return nil unless @options.include?('.')
51
+
52
+ %(class="#{@options.partition('.').last.split('.').map(&:strip).reject(&:empty?).join(' ')}")
53
+ end
36
54
  end
37
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-05 00:00:00.000000000 Z
11
+ date: 2022-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri