bootstrap_it 0.1.1 → 0.1.2

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -1
  3. data/bootstrap_it.gemspec +9 -8
  4. data/lib/bootstrap_it/config.rb +1 -1
  5. data/lib/bootstrap_it/engine.rb +1 -1
  6. data/lib/bootstrap_it/version.rb +1 -1
  7. data/lib/bootstrap_it/view_helpers.rb +4 -1
  8. data/lib/bootstrap_it/view_helpers/breadcrumb.rb +3 -2
  9. data/lib/bootstrap_it/view_helpers/button.rb +47 -39
  10. data/lib/bootstrap_it/view_helpers/button_group.rb +23 -4
  11. data/lib/bootstrap_it/view_helpers/dropdown_menu.rb +6 -5
  12. data/lib/bootstrap_it/view_helpers/form.rb +40 -41
  13. data/lib/bootstrap_it/view_helpers/grid.rb +9 -5
  14. data/lib/bootstrap_it/view_helpers/icon.rb +4 -2
  15. data/lib/bootstrap_it/view_helpers/list.rb +5 -5
  16. data/lib/bootstrap_it/view_helpers/misc.rb +37 -36
  17. data/lib/bootstrap_it/view_helpers/mixin.rb +16 -24
  18. data/lib/bootstrap_it/view_helpers/nav.rb +23 -21
  19. data/lib/bootstrap_it/view_helpers/pagination.rb +8 -6
  20. data/lib/bootstrap_it/view_helpers/table.rb +6 -10
  21. data/lib/bootstrap_it/view_helpers/text.rb +10 -8
  22. data/spec/spec_helper.rb +5 -2
  23. data/spec/support/example_groups/view_helpers_example_group.rb +4 -5
  24. data/spec/view_helpers/breadcrumb_spec.rb +8 -4
  25. data/spec/view_helpers/button_group_spec.rb +4 -4
  26. data/spec/view_helpers/button_spec.rb +25 -23
  27. data/spec/view_helpers/button_toolbar_spec.rb +3 -3
  28. data/spec/view_helpers/dropdown_menu_spec.rb +9 -9
  29. data/spec/view_helpers/form_spec.rb +4 -4
  30. data/spec/view_helpers/grid_spec.rb +5 -5
  31. data/spec/view_helpers/icon_spec.rb +2 -2
  32. data/spec/view_helpers/list_spec.rb +9 -9
  33. data/spec/view_helpers/misc_spec.rb +11 -11
  34. data/spec/view_helpers/mixin_spec.rb +49 -38
  35. data/spec/view_helpers/nav_spec.rb +14 -10
  36. data/spec/view_helpers/pagination_spec.rb +6 -6
  37. data/spec/view_helpers/table_spec.rb +9 -10
  38. data/spec/view_helpers/text_spec.rb +3 -3
  39. data/spec/views/examples_spec.rb +49 -36
  40. metadata +31 -32
  41. data/lib/bootstrap_it/view_helpers/button_toolbar.rb +0 -21
@@ -1,21 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapIt::ViewHelpers::Input do
4
- it { expect(helper).to render_with 'input.form-control[@type="text"]' }
4
+ it { expect(helper.render).to have_tag 'input.form-control[@type="text"]' }
5
5
 
6
6
  it 'accepts valid input types' do
7
- expect(helper type: 'password').to render_with(
7
+ expect(helper(type: 'password').render).to have_tag(
8
8
  'input.form-control[@type="password"]'
9
9
  )
10
10
  end
11
11
 
12
12
  it 'accepts string arguments as values' do
13
- expect(helper {'10'}).to render_with 'input.form-control[@value="10"]'
13
+ expect(helper {'10'}.render).to have_tag 'input.form-control[@value="10"]'
14
14
  end
15
15
  end
16
16
 
17
17
  describe BootstrapIt::ViewHelpers::Form do
18
- it { expect(helper).to render_with 'form[@role="form"]' }
18
+ it { expect(helper.render).to have_tag 'form[@role="form"]' }
19
19
 
20
20
  # kind
21
21
  it 'has `kind` enum' do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapIt::ViewHelpers::Grid do
4
- it { expect(helper).to render_with 'div.container' }
4
+ it { expect(helper.render).to have_tag 'div.container' }
5
5
 
6
6
  it 'renders child rows' do
7
7
  expect(BootstrapIt::ViewHelpers::GridRow).to receive(:new).and_call_original
@@ -10,7 +10,7 @@ describe BootstrapIt::ViewHelpers::Grid do
10
10
  end
11
11
 
12
12
  describe BootstrapIt::ViewHelpers::GridRow do
13
- it { expect(helper).to render_with 'div.row' }
13
+ it { expect(helper.render).to have_tag 'div.row' }
14
14
 
15
15
  it 'renders child cells' do
16
16
  expect(BootstrapIt::ViewHelpers::GridCell).to receive(:new).and_call_original
@@ -18,13 +18,13 @@ describe BootstrapIt::ViewHelpers::GridRow do
18
18
  end
19
19
 
20
20
  it 'renders clearfix' do
21
- expect(helper { |h| h.clear }).to render_with(
21
+ expect(helper { |h| h.clear }.render).to have_tag(
22
22
  'div.row > div.clearfix.visible-md'
23
23
  )
24
24
  end
25
25
 
26
26
  it 'renders clearfix with custom attributes' do
27
- expect(helper { |h| h.clear :hidden_large }).to render_with(
27
+ expect(helper { |h| h.clear :hidden_large }.render).to have_tag(
28
28
  'div.row > div.clearfix.hidden-lg'
29
29
  )
30
30
  end
@@ -34,7 +34,7 @@ describe BootstrapIt::ViewHelpers::GridRow do
34
34
  end
35
35
 
36
36
  describe BootstrapIt::ViewHelpers::GridCell do
37
- it { expect(helper).to render_with 'div.col-md-3' }
37
+ it { expect(helper.render).to have_tag 'div.col-md-3' }
38
38
 
39
39
  it 'renders child rows' do
40
40
  expect(BootstrapIt::ViewHelpers::GridRow).to receive(:new).and_call_original
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapIt::ViewHelpers::Icon do
4
- it { expect(helper).to render_with 'i.fa-asterisk' }
5
- it { expect(helper :bell).to render_with 'i.fa-bell' }
4
+ it { expect(helper.render).to have_tag 'i.fa-asterisk' }
5
+ it { expect(helper(:bell).render).to have_tag 'i.fa-bell' }
6
6
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapIt::ViewHelpers::ListItem do
4
- it { expect(helper).to render_with 'li' }
4
+ it { expect(helper.render).to have_tag 'li' }
5
5
  it { expect(helper).to be_kind_of BootstrapIt::ViewHelpers::Disableable }
6
6
  it { expect(helper).to be_kind_of WrapIt::TextContainer }
7
7
  end
@@ -9,28 +9,28 @@ end
9
9
  describe BootstrapIt::ViewHelpers::ListLinkItem do
10
10
  it { expect(helper).to be_kind_of WrapIt::Link }
11
11
 
12
- it { expect(helper).to render_with 'li > a' }
12
+ it { expect(helper.render).to have_tag 'li > a' }
13
13
 
14
14
  it 'passes `li` or `li_options` as options to li' do
15
15
  %i(li li_options).each do |key|
16
16
  @helper = nil
17
- expect(helper(key => {class: 'list'})).to render_with 'li.list > a'
17
+ expect(helper(key => {class: 'list'}).render).to have_tag 'li.list > a'
18
18
  end
19
19
  end
20
20
 
21
21
  it 'passes `li_*` options to li' do
22
- expect(helper(li_class: 'list')).to render_with 'li.list > a'
22
+ expect(helper(li_class: 'list').render).to have_tag 'li.list > a'
23
23
  end
24
24
 
25
25
  it 'passes `li_*` arguments to li' do
26
- expect(helper(:li_active)).to render_with 'li.active > a'
26
+ expect(helper(:li_active).render).to have_tag 'li.active > a'
27
27
  end
28
28
 
29
29
  it 'passes `active` and `disable` arguments to li' do
30
30
  %i(active disabled disable).each do |key|
31
31
  @helper = nil
32
32
  html_class = key == :disable ? :disabled : key
33
- expect(helper(key)).to render_with "li.#{html_class} > a"
33
+ expect(helper(key).render).to have_tag "li.#{html_class} > a"
34
34
  end
35
35
  end
36
36
 
@@ -38,13 +38,13 @@ describe BootstrapIt::ViewHelpers::ListLinkItem do
38
38
  %i(active disabled disable).each do |key|
39
39
  @helper = nil
40
40
  html_class = key == :disable ? :disabled : key
41
- expect(helper(key => true)).to render_with "li.#{html_class} > a"
41
+ expect(helper(key => true).render).to have_tag "li.#{html_class} > a"
42
42
  end
43
43
  end
44
44
 
45
45
  it 'keeps not related to list optioins and arguments' do
46
46
  expect(
47
- helper('text', 'url', li_class: 'list', class: 'link')
48
- ).to render_with 'li.list > a.link[@href="url"][text()="text"]'
47
+ helper('text', 'url', li_class: 'list', class: 'link').render
48
+ ).to have_tag 'li.list > a.link[@href="url"][text()="text"]'
49
49
  end
50
50
  end
@@ -1,21 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapIt::ViewHelpers::Jumbotron do
4
- it { expect(helper).to render_with 'div.jumbotron' }
4
+ it { expect(helper.render).to have_tag 'div.jumbotron' }
5
5
 
6
6
  # full_width
7
7
  it { expect(helper).to have_flag :full_width }
8
8
  it 'makes full width jumbotron' do
9
- expect(helper :full_width).to render_with 'div.jumbotron > div.container'
9
+ expect(helper(:full_width).render).to have_tag 'div.jumbotron > div.container'
10
10
  end
11
11
  end
12
12
 
13
13
  describe BootstrapIt::ViewHelpers::PageHeader do
14
- it { expect(helper).to render_with 'div.page-header' }
14
+ it { expect(helper.render).to have_tag 'div.page-header' }
15
15
  end
16
16
 
17
17
  describe BootstrapIt::ViewHelpers::Alert do
18
- it { expect(helper).to render_with 'div.alert.alert-success' }
18
+ it { expect(helper.render).to have_tag 'div.alert.alert-success' }
19
19
 
20
20
  # behaviour
21
21
  it { expect(helper).to be_kind_of WrapIt::TextContainer }
@@ -35,7 +35,7 @@ describe BootstrapIt::ViewHelpers::Alert do
35
35
  .with(html_class: ['alert-dismissable'])
36
36
  end
37
37
  it 'renders dismissable alert with button' do
38
- expect(helper(:dismissable, 'Some text')).to render_with(
38
+ expect(helper(:dismissable, 'Some text').render).to have_tag(
39
39
  'div.alert.alert-success.alert-dismissable[text()="Some text"]' \
40
40
  ' > button.close[@type="button"][@data-dismiss="alert"]' \
41
41
  '[@aria-hidden="true"]'
@@ -44,7 +44,7 @@ describe BootstrapIt::ViewHelpers::Alert do
44
44
 
45
45
  # links
46
46
  it 'renders link with alert-link class' do
47
- expect(helper { |h| h.link 'test', 'url' }).to render_with(
47
+ expect(helper { |h| h.link 'test', 'url' }.render).to have_tag(
48
48
  'div.alert.alert-success' \
49
49
  ' > a.alert-link[@href="url"][text()="test"]'
50
50
  )
@@ -55,7 +55,7 @@ end
55
55
 
56
56
  describe BootstrapIt::ViewHelpers::ProgressBar do
57
57
  it 'renders with all needed atrributes' do
58
- expect(helper).to render_with(
58
+ expect(helper.render).to have_tag(
59
59
  'div.progress-bar[@role="progressbar"][@aria-valuenow="0"]' \
60
60
  '[@aria-valuemin="0"][@aria-valuemax="100"][@style="width: 0%"]' \
61
61
  ' > span.sr-only[text()="0% Complete"]'
@@ -64,14 +64,14 @@ describe BootstrapIt::ViewHelpers::ProgressBar do
64
64
 
65
65
  # custom text
66
66
  it 'renders with custom text' do
67
- expect(helper('custom text')).to render_with(
67
+ expect(helper('custom text').render).to have_tag(
68
68
  'div.progress-bar > span.sr-only[text()="custom text"]'
69
69
  )
70
70
  end
71
71
 
72
72
  # complete
73
73
  it 'accepts integer arguments as complete percents' do
74
- expect(helper(60)).to render_with(
74
+ expect(helper(60).render).to have_tag(
75
75
  'div.progress-bar[@aria-valuenow="60"][@style="width: 60%"]' \
76
76
  ' > span.sr-only[text()="60% Complete"]'
77
77
  )
@@ -91,7 +91,7 @@ end
91
91
 
92
92
  describe BootstrapIt::ViewHelpers::Progress do
93
93
  it 'renders with all needed atrributes' do
94
- expect(helper).to render_with(
94
+ expect(helper.render).to have_tag(
95
95
  'div.progress > div.progress-bar[@role="progressbar"]' \
96
96
  '[@aria-valuenow="0"][@aria-valuemin="0"][@aria-valuemax="100"]' \
97
97
  '[@style="width: 0%"] > span.sr-only[text()="0% Complete"]'
@@ -109,7 +109,7 @@ describe BootstrapIt::ViewHelpers::Progress do
109
109
 
110
110
  # second bar
111
111
  it 'renders second bar' do
112
- expect(helper(10) { |h| h.bar 30 }).to render_with(
112
+ expect(helper(10) { |h| h.bar 30 }.render).to have_tag(
113
113
  'div.progress > div.progress-bar[@aria-valuenow="10"]' \
114
114
  ' + div.progress-bar[@aria-valuenow="30"]'
115
115
  )
@@ -7,9 +7,9 @@ describe BootstrapIt::ViewHelpers::Contextual do
7
7
  it 'sets state class' do
8
8
  %i(active success warning danger).each do |state|
9
9
  @wrapper = nil
10
- expect(wrapper state).to render_with "div.#{state}"
10
+ expect(wrapper(state).render).to have_tag "div.#{state}"
11
11
  @wrapper = nil
12
- expect(wrapper state: state).to render_with "div.#{state}"
12
+ expect(wrapper(state: state).render).to have_tag "div.#{state}"
13
13
  end
14
14
  end
15
15
  end
@@ -27,50 +27,55 @@ describe BootstrapIt::ViewHelpers::SizableColumn do
27
27
  it 'sanitize extra small classes' do
28
28
  %i(col_xs_2 xs_2 xs2 extra_small_2 extrasmall2).each do |c|
29
29
  @wrapper = nil
30
- expect(wrapper c).to render_with 'div.col-xs-2'
30
+ expect(wrapper(c).render).to have_tag 'div.col-xs-2'
31
31
  @wrapper = nil
32
32
  wrapper.column_size = c
33
- expect(wrapper).to render_with 'div.col-xs-2'
33
+ expect(wrapper.render).to have_tag 'div.col-xs-2'
34
34
  end
35
35
  end
36
36
 
37
37
  it 'sanitize small classes' do
38
38
  %i(col_sm_2 sm_2 sm2 small_2 small2).each do |c|
39
39
  @wrapper = nil
40
- expect(wrapper c).to render_with 'div.col-sm-2'
40
+ expect(wrapper(c).render).to have_tag 'div.col-sm-2'
41
41
  @wrapper = nil
42
42
  wrapper.column_size = c
43
- expect(wrapper).to render_with 'div.col-sm-2'
43
+ expect(wrapper.render).to have_tag 'div.col-sm-2'
44
44
  end
45
45
  end
46
46
 
47
47
  it 'sanitize medium classes' do
48
48
  %i(col_md_2 md_2 md2 medium_2 medium2).each do |c|
49
49
  @wrapper = nil
50
- expect(wrapper c).to render_with 'div.col-md-2'
50
+ expect(wrapper(c).render).to have_tag 'div.col-md-2'
51
51
  @wrapper = nil
52
52
  wrapper.column_size = c
53
- expect(wrapper).to render_with 'div.col-md-2'
53
+ expect(wrapper.render).to have_tag 'div.col-md-2'
54
54
  end
55
55
  end
56
56
 
57
57
  it 'sanitize large classes' do
58
58
  %i(col_lg_2 lg_2 lg2 large_2 large2).each do |c|
59
59
  @wrapper = nil
60
- expect(wrapper c).to render_with 'div.col-lg-2'
60
+ expect(wrapper(c).render).to have_tag 'div.col-lg-2'
61
61
  @wrapper = nil
62
62
  wrapper.column_size = c
63
- expect(wrapper).to render_with 'div.col-lg-2'
63
+ expect(wrapper.render).to have_tag 'div.col-lg-2'
64
64
  end
65
65
  end
66
66
 
67
67
  it '#column_size= accepts sizes as array' do
68
68
  wrapper.column_size = [:xs_2, :md_4]
69
- expect(wrapper).to render_with 'div.col-xs-2.col-md-4'
69
+ expect(wrapper.render).to have_tag 'div.col-xs-2.col-md-4'
70
70
  end
71
71
 
72
- it { expect(wrapper :sm3, :sm1).to render_with 'div[@class="col-sm-3"]' }
73
- it { expect(wrapper :sm12, :lg1).to render_with 'div.col-sm-12.col-lg-1' }
72
+ it 'omits second same size' do
73
+ expect(wrapper(:sm3, :sm1).render).to have_tag 'div[@class="col-sm-3"]'
74
+ end
75
+
76
+ it 'combines differ size types' do
77
+ expect(wrapper(:sm12, :lg1).render).to have_tag 'div.col-sm-12.col-lg-1'
78
+ end
74
79
  end
75
80
 
76
81
  describe BootstrapIt::ViewHelpers::PlacableColumn do
@@ -91,10 +96,10 @@ describe BootstrapIt::ViewHelpers::PlacableColumn do
91
96
  %I(col_xs_#{act}_2 xs_#{act}_2 extra_small_#{act}_2
92
97
  extrasmall#{act}2).each do |c|
93
98
  @wrapper = nil
94
- expect(wrapper c).to render_with "div.col-xs-#{act}-2"
99
+ expect(wrapper(c).render).to have_tag "div.col-xs-#{act}-2"
95
100
  @wrapper = nil
96
101
  wrapper.column_place = c
97
- expect(wrapper c).to render_with "div.col-xs-#{act}-2"
102
+ expect(wrapper(c).render).to have_tag "div.col-xs-#{act}-2"
98
103
  end
99
104
  end
100
105
 
@@ -102,10 +107,10 @@ describe BootstrapIt::ViewHelpers::PlacableColumn do
102
107
  %I(col_sm_#{act}_2 sm_#{act}_2 sm#{act}2 small_#{act}_2
103
108
  small#{act}2).each do |c|
104
109
  @wrapper = nil
105
- expect(wrapper c).to render_with "div.col-sm-#{act}-2"
110
+ expect(wrapper(c).render).to have_tag "div.col-sm-#{act}-2"
106
111
  @wrapper = nil
107
112
  wrapper.column_place = c
108
- expect(wrapper c).to render_with "div.col-sm-#{act}-2"
113
+ expect(wrapper(c).render).to have_tag "div.col-sm-#{act}-2"
109
114
  end
110
115
  end
111
116
 
@@ -113,10 +118,10 @@ describe BootstrapIt::ViewHelpers::PlacableColumn do
113
118
  %I(col_md_#{act}_2 md_#{act}_2 md#{act}2 medium_#{act}_2
114
119
  medium#{act}2).each do |c|
115
120
  @wrapper = nil
116
- expect(wrapper c).to render_with "div.col-md-#{act}-2"
121
+ expect(wrapper(c).render).to have_tag "div.col-md-#{act}-2"
117
122
  @wrapper = nil
118
123
  wrapper.column_place = c
119
- expect(wrapper c).to render_with "div.col-md-#{act}-2"
124
+ expect(wrapper(c).render).to have_tag "div.col-md-#{act}-2"
120
125
  end
121
126
  end
122
127
 
@@ -124,10 +129,10 @@ describe BootstrapIt::ViewHelpers::PlacableColumn do
124
129
  %I(col_lg_#{act}_2 lg_#{act}_2 lg#{act}2 large_#{act}_2
125
130
  large#{act}2).each do |c|
126
131
  @wrapper = nil
127
- expect(wrapper c).to render_with "div.col-lg-#{act}-2"
132
+ expect(wrapper(c).render).to have_tag "div.col-lg-#{act}-2"
128
133
  @wrapper = nil
129
134
  wrapper.column_place = c
130
- expect(wrapper c).to render_with "div.col-lg-#{act}-2"
135
+ expect(wrapper(c).render).to have_tag "div.col-lg-#{act}-2"
131
136
  end
132
137
  end
133
138
  end
@@ -139,34 +144,40 @@ end
139
144
 
140
145
  describe BootstrapIt::ViewHelpers::Disableable do
141
146
  it { expect(wrapper).to have_flag(:disabled).with(aliases: [:disable]) }
142
- it { expect(wrapper).to_not render_with '.disabled' }
143
- it { expect(wrapper :disabled).to render_with '.disabled' }
144
- it { expect(wrapper tag: :button).to_not render_with '[@disabled]' }
145
- it { expect(wrapper :disabled, tag: :button).to render_with '[@disabled]' }
146
- it { expect(wrapper :disabled, tag: :button).to_not render_with '.disabled' }
147
+ it { expect(wrapper.render).to_not have_tag '.disabled' }
148
+ it { expect(wrapper(:disabled).render).to have_tag '.disabled' }
149
+ it { expect(wrapper(tag: :button).render).to_not have_tag '[@disabled]' }
150
+
151
+ it 'includes disabled attr to buttons' do
152
+ expect(wrapper(:disabled, tag: :button).render).to have_tag '[@disabled]'
153
+ end
154
+
155
+ it 'avoid disabled class for buttons' do
156
+ expect(wrapper(:disabled, tag: :button).render).to_not have_tag '.disabled'
157
+ end
147
158
  end
148
159
 
149
160
  describe BootstrapIt::ViewHelpers::Sizable do
150
- it { expect(wrapper :lg).to render_with '.lg' }
151
- it { expect(wrapper :large).to render_with '.lg' }
152
- it { expect(wrapper :sm).to render_with '.sm' }
153
- it { expect(wrapper :small).to render_with '.sm' }
154
- it { expect(wrapper :xs).to render_with '.xs' }
155
- it { expect(wrapper :extrasmall).to render_with '.xs' }
156
- it { expect(wrapper :extra_small).to render_with '.xs' }
157
- it { expect(wrapper size: :large).to render_with '.lg' }
158
- it { expect(wrapper :small, size: :large).to render_with '.sm' }
161
+ it { expect(wrapper(:lg).render).to have_tag '.lg' }
162
+ it { expect(wrapper(:large).render).to have_tag '.lg' }
163
+ it { expect(wrapper(:sm).render).to have_tag '.sm' }
164
+ it { expect(wrapper(:small).render).to have_tag '.sm' }
165
+ it { expect(wrapper(:xs).render).to have_tag '.xs' }
166
+ it { expect(wrapper(:extrasmall).render).to have_tag '.xs' }
167
+ it { expect(wrapper(:extra_small).render).to have_tag '.xs' }
168
+ it { expect(wrapper(size: :large).render).to have_tag '.lg' }
169
+ it { expect(wrapper(:small, size: :large).render).to have_tag '.sm' }
159
170
 
160
171
  it 'adds class prefix' do
161
172
  wrapper_class.class_eval do
162
173
  html_class_prefix 'btn-'
163
174
  end
164
175
  @wrapper = nil
165
- expect(wrapper :lg).to render_with '.btn-lg'
176
+ expect(wrapper(:lg).render).to have_tag '.btn-lg'
166
177
  @wrapper = nil
167
- expect(wrapper :btn_lg).to render_with '.btn-lg'
178
+ expect(wrapper(:btn_lg).render).to have_tag '.btn-lg'
168
179
  @wrapper = nil
169
- expect(wrapper :btn_large).to render_with '.btn-lg'
180
+ expect(wrapper(:btn_large).render).to have_tag '.btn-lg'
170
181
  end
171
182
 
172
183
  it { expect(wrapper size: 'value').to_not have_option :size }
@@ -1,19 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe BootstrapIt::ViewHelpers::Nav do
4
- it { expect(helper).to render_with 'ul.nav' }
4
+ it { expect(helper.render).to have_tag 'ul.nav' }
5
5
 
6
6
  it { expect(helper).to be_kind_of BootstrapIt::ViewHelpers::Justifable }
7
- it { expect(helper).to be_kind_of WrapIt::Container }
7
+ it { expect(helper).to be_kind_of WrapIt::Base }
8
8
 
9
9
  it 'renders active links' do
10
- expect(helper { |h| h.link_item :active }).to render_with 'ul > li.active'
10
+ expect(helper { |h| h.link_item :active }.render).to have_tag(
11
+ 'ul > li.active'
12
+ )
11
13
  end
12
14
 
13
15
  it 'renders dropdowns' do
14
16
  expect(
15
- helper { |h| h.dropdown('text') { |d| d.header 'header' } }
16
- ).to render_with(
17
+ helper { |h| h.dropdown('text') { |d| d.header 'header' } }.render
18
+ ).to have_tag(
17
19
  'ul > li.dropdown' \
18
20
  ' > a.dropdown-toggle[@data-toggle="dropdown"]' \
19
21
  '[@href="#"][text()="text "]'
@@ -23,27 +25,29 @@ end
23
25
 
24
26
  describe BootstrapIt::ViewHelpers::NavPills do
25
27
  it { expect(helper).to be_kind_of BootstrapIt::ViewHelpers::Nav }
26
- it { expect(helper).to render_with 'ul.nav.nav-pills' }
28
+ it { expect(helper.render).to have_tag 'ul.nav.nav-pills' }
27
29
  end
28
30
 
29
31
  describe BootstrapIt::ViewHelpers::NavTabs do
30
32
  it { expect(helper).to be_kind_of BootstrapIt::ViewHelpers::Nav }
31
- it { expect(helper).to render_with 'ul.nav.nav-tabs' }
33
+ it { expect(helper.render).to have_tag 'ul.nav.nav-tabs' }
32
34
  end
33
35
 
34
36
  describe BootstrapIt::ViewHelpers::NavBar do
35
37
  it 'renders with all needed options' do
36
- expect(helper).to render_with(
38
+ expect(helper.render).to have_tag(
37
39
  'nav.navbar.navbar-default[@role="navigation"]'
38
40
  )
39
41
  end
40
42
 
41
43
  it 'renders with button' do
42
- expect(helper { |h| h.button }).to render_with 'nav > button.navbar-btn'
44
+ expect(helper { |h| h.button }.render).to have_tag(
45
+ 'nav > button.navbar-btn'
46
+ )
43
47
  end
44
48
 
45
49
  it 'renders with text' do
46
- expect(helper { |h| h.text 'some text' }).to render_with(
50
+ expect(helper { |h| h.text 'some text' }.render).to have_tag(
47
51
  'nav > p.navbar-text', text: 'some text'
48
52
  )
49
53
  end