arbre2 2.2.3 → 2.2.4

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
  SHA1:
3
- metadata.gz: efcc5dbda3b170d592102cc1808e7de8204e8ad6
4
- data.tar.gz: 1f148cf4b810471a62499b9ecef1abb02eacc330
3
+ metadata.gz: 93af3478dd8826c077b96a2aee7fb7dc1993085e
4
+ data.tar.gz: c09475cad5b20e8168124223885fea41717d52dc
5
5
  SHA512:
6
- metadata.gz: 7b02b000969d694fcbed27422824b9030695155f43bf1dbda713b57a296f2cd3521c8cf00eb6300d4634da7b1a14ab871e96d2f094b5cc9e767f69e0d36a299a
7
- data.tar.gz: 85efc9a9ea8ab43d5073c195764e4a7ee4047e01612b92a77c2590ad074785ac42444e0e3194f30c904c34c5d76b213b4eb3ce4510f6d22e37600d29ced31b9b
6
+ metadata.gz: d9301efdde9aba632671c56ed729945a81a22293e10401ecc69041542fadbce9f6d8e4d1fd16b9415daf783f1861492ed0ab90b9d3a88ec850b4d6590f4ad6ba
7
+ data.tar.gz: 1a4ec02ef8369886ef25ad72086b05248977aeb9f02c4b459d8dff672aa0ff8a95a36f0092ecca8a096bade835d09b540adaee652f8bbe71c3ac323faa98291d
@@ -1,3 +1,7 @@
1
+ ## 2.2.4
2
+
3
+ * Upgraded specs to RSpec 3.0
4
+
1
5
  ## 2.2.3
2
6
 
3
7
  * Added `main` tag.
@@ -13,9 +13,6 @@ GEM
13
13
  erubis (~> 2.7.0)
14
14
  rack (~> 1.5.2)
15
15
  rack-test (~> 0.6.2)
16
- activemodel (4.0.3)
17
- activesupport (= 4.0.3)
18
- builder (~> 3.1.0)
19
16
  activesupport (4.0.3)
20
17
  i18n (~> 0.6, >= 0.6.4)
21
18
  minitest (~> 4.2)
@@ -43,18 +40,22 @@ GEM
43
40
  rake (>= 0.8.7)
44
41
  thor (>= 0.18.1, < 2.0)
45
42
  rake (10.1.1)
46
- rspec-core (2.14.8)
47
- rspec-expectations (2.14.5)
48
- diff-lcs (>= 1.1.3, < 2.0)
49
- rspec-mocks (2.14.6)
50
- rspec-rails (2.14.1)
43
+ rspec-core (3.0.0)
44
+ rspec-support (~> 3.0.0)
45
+ rspec-expectations (3.0.0)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.0.0)
48
+ rspec-mocks (3.0.0)
49
+ rspec-support (~> 3.0.0)
50
+ rspec-rails (3.0.1)
51
51
  actionpack (>= 3.0)
52
- activemodel (>= 3.0)
53
52
  activesupport (>= 3.0)
54
53
  railties (>= 3.0)
55
- rspec-core (~> 2.14.0)
56
- rspec-expectations (~> 2.14.0)
57
- rspec-mocks (~> 2.14.0)
54
+ rspec-core (~> 3.0.0)
55
+ rspec-expectations (~> 3.0.0)
56
+ rspec-mocks (~> 3.0.0)
57
+ rspec-support (~> 3.0.0)
58
+ rspec-support (3.0.0)
58
59
  simplecov (0.8.2)
59
60
  docile (~> 1.1.0)
60
61
  multi_json
@@ -74,6 +75,6 @@ DEPENDENCIES
74
75
  bundler (~> 1.3)
75
76
  combustion (~> 0.5)
76
77
  rake
77
- rspec-rails (~> 2.14)
78
+ rspec-rails (~> 3.0)
78
79
  simplecov
79
80
  tzinfo
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rake"
24
24
  s.add_development_dependency "tzinfo"
25
25
  s.add_development_dependency "combustion", "~> 0.5"
26
- s.add_development_dependency "rspec-rails", "~> 2.14"
26
+ s.add_development_dependency "rspec-rails", "~> 3.0"
27
27
  s.add_development_dependency "simplecov"
28
28
  end
@@ -76,7 +76,7 @@ module Arbre
76
76
  html
77
77
  end
78
78
 
79
- def failure_message_for_should
79
+ def failure_message
80
80
  <<-MSG.gsub(/^\s{10}/, '')
81
81
  expected that element of type #{@actual.class} would be rendered differently:
82
82
  expected: #{expected.is_a?(Regexp) ? '/' + canonize_html(expected.source) + '/' : canonize_html(expected)} (#{expected.class})
@@ -84,7 +84,7 @@ module Arbre
84
84
  MSG
85
85
  end
86
86
 
87
- def failure_message_for_should_not
87
+ def failure_message_when_negated
88
88
  <<-MSG.gsub(/^\s{10}/, '')
89
89
  expected that element of type #{@actual.class} would not be rendered as #{canonize_html(expected)}, but it was:
90
90
  got: #{@actual.nil? ? 'nil' : canonize_html(ERB::Util.html_escape(@actual.to_s))}
@@ -44,7 +44,7 @@ module Arbre
44
44
  js
45
45
  end
46
46
 
47
- def failure_message_for_should
47
+ def failure_message
48
48
  <<-MSG.gsub(/^\s{10}/, '')
49
49
  expected that element of type #{@actual.class} would be scripted differently:
50
50
  expected: #{expected.is_a?(Regexp) ? '/' + canonize_js(expected.source) + '/' : canonize_js(expected)} (#{expected.class})
@@ -52,7 +52,7 @@ module Arbre
52
52
  MSG
53
53
  end
54
54
 
55
- def failure_message_for_should_not
55
+ def failure_message_when_negated
56
56
  "expected that element of type #{@actual.class} would be not scripted as #{expected}"
57
57
  end
58
58
 
@@ -38,7 +38,7 @@ module Arbre
38
38
  js
39
39
  end
40
40
 
41
- def failure_message_for_should
41
+ def failure_message
42
42
  <<-MSG.gsub(/^\s{10}/, '')
43
43
  expected that element of type #{@actual.class} contained script:
44
44
  expected: #{expected.is_a?(Regexp) ? '/' + canonize_js(expected.source) + '/' : canonize_js(expected)} (#{expected.class})
@@ -46,7 +46,7 @@ module Arbre
46
46
  MSG
47
47
  end
48
48
 
49
- def failure_message_for_should_not
49
+ def failure_message_when_negated
50
50
  <<-MSG.gsub(/^\s{10}/, '')
51
51
  expected that element of type #{actual.class} would not contain a script:
52
52
  script: #{expected.is_a?(Regexp) ? '/' + canonize_js(expected.source) + '/' : canonize_js(expected)} (#{expected.class})
@@ -1,3 +1,3 @@
1
1
  module Arbre
2
- VERSION = "2.2.3"
2
+ VERSION = "2.2.4"
3
3
  end
@@ -23,7 +23,11 @@ describe Arbre::Rails::RSpec::ArbreSupport, arbre: true do
23
23
  end
24
24
  end
25
25
 
26
- its(:assigns) { should eql({}) }
26
+ describe '#assigns' do
27
+ it "should be blank by default" do
28
+ expect(example.assigns).to eql({})
29
+ end
30
+ end
27
31
 
28
32
  describe '#helpers' do
29
33
  it "should build and memoize helpers" do
@@ -38,8 +42,18 @@ describe Arbre::Rails::RSpec::ArbreSupport, arbre: true do
38
42
  let(:helpers) { example.build_helpers }
39
43
 
40
44
  specify { expect(helpers).to be_a(ActionView::Base) }
41
- specify { expect(helpers.controller).to be(controller) }
42
- specify { expect(helpers.request).to be(request) }
45
+
46
+ it "should forward the controller to the helpers" do
47
+ controller = double()
48
+ allow(helpers).to receive(:controller).and_return(controller)
49
+ expect(helpers.controller).to be(controller)
50
+ end
51
+
52
+ it "should forward the request to the helpers" do
53
+ request = double()
54
+ allow(helpers).to receive(:request).and_return(request)
55
+ expect(helpers.request).to be(request)
56
+ end
43
57
 
44
58
  it "should mock an asset_path helper" do
45
59
  expect(helpers.asset_path('test')).to eql('/assets/test')
@@ -14,7 +14,7 @@ describe Arbre::RSpec::BeRenderedAsMatcher do
14
14
  it "should fail if the actual's string version was not the same" do
15
15
  expect{ expect(double(:to_s => '<html></html>'.html_safe)).to be_rendered_as('<html/>') }
16
16
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
17
- expected that element of type RSpec::Mocks::Mock would be rendered differently:
17
+ expected that element of type RSpec::Mocks::Double would be rendered differently:
18
18
  expected: <html/> (String)
19
19
  got: <html></html>
20
20
  STR
@@ -23,7 +23,7 @@ describe Arbre::RSpec::BeRenderedAsMatcher do
23
23
  it "should fail if the actual's string version did not match the regular expression" do
24
24
  expect{ expect(double(:to_s => '<html></html>'.html_safe)).to be_rendered_as(/regular* expression{1,2}/) }
25
25
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
26
- expected that element of type RSpec::Mocks::Mock would be rendered differently:
26
+ expected that element of type RSpec::Mocks::Double would be rendered differently:
27
27
  expected: /regular* expression{1,2}/ (Regexp)
28
28
  got: <html></html>
29
29
  STR
@@ -32,7 +32,7 @@ describe Arbre::RSpec::BeRenderedAsMatcher do
32
32
  it "should fail if the actual's string was not HTML-safed" do
33
33
  expect{ expect(double(:to_s => '<html></html>')).to be_rendered_as('<html></html>') }
34
34
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
35
- expected that element of type RSpec::Mocks::Mock would be rendered differently:
35
+ expected that element of type RSpec::Mocks::Double would be rendered differently:
36
36
  expected: <html></html> (String)
37
37
  got: &lt;html&gt;&lt;/html&gt;
38
38
  STR
@@ -5,7 +5,7 @@ describe Arbre::RSpec::BeScriptedAsMatcher do
5
5
  it "should fail if the actual's content was not the same" do
6
6
  expect{ expect(double(:content => 'alert("test");')).to be_scripted_as('alert("something else");') }
7
7
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
8
- expected that element of type RSpec::Mocks::Mock would be scripted differently:
8
+ expected that element of type RSpec::Mocks::Double would be scripted differently:
9
9
  expected: alert("something else"); (String)
10
10
  got: alert("test");
11
11
  STR
@@ -14,7 +14,7 @@ describe Arbre::RSpec::BeScriptedAsMatcher do
14
14
  it "should fail if the actual's content did not match the regular expression" do
15
15
  expect{ expect(double(:content => 'alert("test");')).to be_scripted_as(/regular* expression{1,2}/) }
16
16
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
17
- expected that element of type RSpec::Mocks::Mock would be scripted differently:
17
+ expected that element of type RSpec::Mocks::Double would be scripted differently:
18
18
  expected: /regular* expression{1,2}/ (Regexp)
19
19
  got: alert("test");
20
20
  STR
@@ -40,7 +40,7 @@ describe Arbre::RSpec::BeScriptedAsMatcher do
40
40
  it "should fail if the whitespace difference was significant" do
41
41
  expect{ expect(double(:content => 'alert("test " );')).to be_scripted_as('alert("test");') }
42
42
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
43
- expected that element of type RSpec::Mocks::Mock would be scripted differently:
43
+ expected that element of type RSpec::Mocks::Double would be scripted differently:
44
44
  expected: alert("test"); (String)
45
45
  got: alert("test " );
46
46
  STR
@@ -5,7 +5,7 @@ describe Arbre::RSpec::ContainScriptMatcher do
5
5
  it "should fail if the actual's content did not contain the given script" do
6
6
  expect{ expect(double(:to_s => '<script type="javascript">alert("test");</script>')).to contain_script('alert("something else");') }
7
7
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
8
- expected that element of type RSpec::Mocks::Mock contained script:
8
+ expected that element of type RSpec::Mocks::Double contained script:
9
9
  expected: alert("something else"); (String)
10
10
  got: <script type="javascript">alert("test");</script>
11
11
  STR
@@ -31,7 +31,7 @@ describe Arbre::RSpec::ContainScriptMatcher do
31
31
  it "should fail if the whitespace difference was significant" do
32
32
  expect{ expect(double(:to_s => '<script type="javascript">alert("test " );</script>')).to contain_script('alert("test");') }
33
33
  .to raise_error(RSpec::Expectations::ExpectationNotMetError, <<-STR.gsub(/^\s{8}/, ''))
34
- expected that element of type RSpec::Mocks::Mock contained script:
34
+ expected that element of type RSpec::Mocks::Double contained script:
35
35
  expected: alert("test"); (String)
36
36
  got: <script type="javascript">alert("test " );</script>
37
37
  STR
@@ -59,13 +59,13 @@ describe ChildElementCollection do
59
59
  it "should not add or set the parent of the same element twice" do
60
60
  expect(element).to receive(:parent=).once.with(parent)
61
61
  collection << element << element
62
- expect(collection).to have(1).item
62
+ expect(collection.size).to eql(1)
63
63
 
64
64
  collection = ChildElementCollection.new(parent)
65
65
  expect(element).to receive(:parent=).once.with(parent)
66
66
  collection << element
67
67
  collection.insert_at 0, element
68
- expect(collection).to have(1).item
68
+ expect(collection.size).to eql(1)
69
69
  end
70
70
 
71
71
  it "should not unset the parent if the given element was not part of the collection" do
@@ -17,19 +17,14 @@ describe ElementCollection do
17
17
 
18
18
  it "should behave like an array" do
19
19
  elements = ElementCollection.new([element1])
20
- expect(elements).to have(1).item
21
- expect(elements[0]).to be(element1)
20
+ expect(elements).to match([element1])
22
21
 
23
22
  elements << element2
24
- expect(elements).to have(2).item
25
- expect(elements[0]).to be(element1)
26
- expect(elements[1]).to be(element2)
23
+ expect(elements).to match([element1, element2])
27
24
 
28
25
  elements = ElementCollection.new
29
26
  elements.concat [ element1, element2 ]
30
- expect(elements).to have(2).item
31
- expect(elements[0]).to be(element1)
32
- expect(elements[1]).to be(element2)
27
+ expect(elements).to match([element1, element2])
33
28
 
34
29
  elements.clear
35
30
  expect(elements).to be_empty
@@ -41,13 +36,10 @@ describe ElementCollection do
41
36
  expect(collection[0]).to be_a(Element)
42
37
 
43
38
  expect(collection[0..1]).to be_a(ElementCollection)
44
- expect(collection[0..1]).to have(2).items
45
- expect(collection[0..1][0]).to be(element1)
46
- expect(collection[0..1][1]).to be(element2)
39
+ expect(collection[0..1]).to match([element1, element2])
47
40
 
48
41
  expect(collection[0, 1]).to be_a(ElementCollection)
49
- expect(collection[0, 1]).to have(1).items
50
- expect(collection[0, 1][0]).to be(element1)
42
+ expect(collection[0, 1]).to match([element1])
51
43
  end
52
44
 
53
45
  it "should equate to an array" do
@@ -135,7 +127,7 @@ describe ElementCollection do
135
127
  collection = ElementCollection.new
136
128
  element = Element.new
137
129
  collection << element << element
138
- expect(collection).to have(1).element
130
+ expect(collection.size).to eql(1)
139
131
  end
140
132
 
141
133
  specify "#to_a should create a copy of the elements and #to_ary not" do
@@ -88,8 +88,7 @@ describe Element do
88
88
  child = Element.new
89
89
  element << child
90
90
 
91
- expect(element).to have(1).child
92
- expect(element.children[0]).to be(child)
91
+ expect(element.children).to match([child])
93
92
  end
94
93
 
95
94
  end
@@ -165,8 +164,7 @@ describe Element do
165
164
  element << Element.new << Element.new
166
165
  element.content = "(CONTENT)"
167
166
 
168
- expect(element).to have(1).child
169
- expect(element.children[0]).to be_a(TextNode)
167
+ expect(element.children).to match([an_instance_of(TextNode)])
170
168
  expect(element.content).to eql('(CONTENT)')
171
169
  end
172
170
 
@@ -175,8 +173,7 @@ describe Element do
175
173
  child = Element.new
176
174
  element.content = child
177
175
 
178
- expect(element).to have(1).child
179
- expect(element.children[0]).to be(child)
176
+ expect(element.children).to match([child])
180
177
  end
181
178
 
182
179
  it "should clear any children and add a given element collection" do
@@ -201,9 +198,7 @@ describe Element do
201
198
 
202
199
  elements = element + element2
203
200
  expect(elements).to be_a(ElementCollection)
204
- expect(elements).to have(2).items
205
- expect(elements[0]).to be(element)
206
- expect(elements[1]).to be(element2)
201
+ expect(elements).to match([element, element2])
207
202
  end
208
203
 
209
204
  it "should wrap itself in a collection and add the other elements" do
@@ -212,10 +207,7 @@ describe Element do
212
207
 
213
208
  elements = element + [ element2, element3 ]
214
209
  expect(elements).to be_a(ElementCollection)
215
- expect(elements).to have(3).items
216
- expect(elements[0]).to be(element)
217
- expect(elements[1]).to be(element2)
218
- expect(elements[2]).to be(element3)
210
+ expect(elements).to match([element, element2, element3])
219
211
  end
220
212
 
221
213
  end
@@ -161,15 +161,15 @@ describe Tag do
161
161
 
162
162
  it "should allow access to the boolean attribute :autocomplete through a method" do
163
163
  tag.autocomplete = true
164
- expect(tag.autocomplete).to be_true
164
+ expect(tag.autocomplete).to be_truthy
165
165
  expect(tag[:autocomplete]).to eql('autocomplete')
166
166
 
167
167
  tag.autocomplete = double(:something_trueish)
168
- expect(tag.autocomplete).to be_true
168
+ expect(tag.autocomplete).to be_truthy
169
169
  expect(tag[:autocomplete]).to eql('autocomplete')
170
170
 
171
171
  tag.autocomplete = false
172
- expect(tag.autocomplete).to be_false
172
+ expect(tag.autocomplete).to be_falsey
173
173
  expect(tag[:autocomplete]).to be_nil
174
174
  end
175
175
 
@@ -73,7 +73,7 @@ describe Arbre::Rails::Layouts do
73
73
  arbre.document document_class, :one, :two, &block
74
74
  arbre.layout
75
75
  expect(arbre.children.first).to be_a(document_class)
76
- expect(called).to be_true
76
+ expect(called).to be_truthy
77
77
  end
78
78
 
79
79
  it "should execute the content block on the document if it was not called from its build! method" do
@@ -87,7 +87,7 @@ describe Arbre::Rails::Layouts do
87
87
  arbre.document document_class, :one, :two, &block
88
88
  arbre.layout
89
89
  expect(arbre.children.first).to be_a(document_class)
90
- expect(called).to be_true
90
+ expect(called).to be_truthy
91
91
  expect(receiver).to be(arbre.children.first)
92
92
  end
93
93
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arbre2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Bell
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: '2.14'
90
+ version: '3.0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: '2.14'
97
+ version: '3.0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: simplecov
100
100
  requirement: !ruby/object:Gem::Requirement