booties 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/booties/application_helper.rb +113 -16
- data/lib/booties.rb +6 -1
- data/lib/booties/modal.rb +104 -0
- data/lib/booties/panel.rb +66 -0
- data/lib/booties/version.rb +1 -1
- data/lib/booties_test.rb +11 -0
- data/test/booties/modal_test.rb +136 -0
- data/test/booties/panel_test.rb +82 -0
- data/test/dummy/app/controllers/home_controller.rb +13 -1
- data/test/dummy/app/views/home/badge.html.erb +3 -0
- data/test/dummy/app/views/home/breadcrumbs.html.erb +4 -0
- data/test/dummy/app/views/home/{show.html.erb → flag.html.erb} +0 -5
- data/test/dummy/app/views/home/modal.html.erb +16 -0
- data/test/dummy/app/views/home/panel.html.erb +21 -0
- data/test/dummy/config/locales/booties.yml +4 -0
- data/test/dummy/config/routes.rb +5 -3
- data/test/dummy/log/development.log +420 -0
- data/test/dummy/log/test.log +3982 -0
- data/test/dummy/test/controllers/home_controller_test.rb +52 -7
- data/test/helpers/booties/application_helper_test.rb +55 -0
- data/test/stub_view.rb +36 -0
- metadata +23 -6
- data/test/booties_test.rb +0 -7
@@ -1,13 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class HomeControllerTest < ActionController::TestCase
|
4
|
-
test "should get show" do
|
5
|
-
get :show
|
6
|
-
assert_response :success
|
7
|
-
end
|
8
|
-
|
9
4
|
test 'page renders breadcrumbs' do
|
10
|
-
get :
|
5
|
+
get :breadcrumbs
|
11
6
|
|
12
7
|
assert_select 'ol.breadcrumb' do
|
13
8
|
assert_select 'li', 'Foo'
|
@@ -16,10 +11,60 @@ class HomeControllerTest < ActionController::TestCase
|
|
16
11
|
end
|
17
12
|
|
18
13
|
test 'page renders flags' do
|
19
|
-
get :
|
14
|
+
get :flag
|
20
15
|
|
21
16
|
assert_select 'span.label.label-default', 'foo'
|
22
17
|
assert_select 'span.label.label-primary', 'bar'
|
23
18
|
assert_select 'span#baz.label.label-danger', 'baz'
|
24
19
|
end
|
20
|
+
|
21
|
+
test 'page renders badges' do
|
22
|
+
get :badge
|
23
|
+
|
24
|
+
assert_select 'span.badge', 'foo'
|
25
|
+
assert_select 'span.badge.foo', 'bar'
|
26
|
+
assert_select 'span.badge#foo', 'bar'
|
27
|
+
end
|
28
|
+
|
29
|
+
test 'page renders a modal' do
|
30
|
+
get :modal
|
31
|
+
|
32
|
+
assert_select 'div.modal.fade#confirm' do
|
33
|
+
assert_select 'div.modal-dialog' do
|
34
|
+
assert_select 'div.modal-content' do
|
35
|
+
assert_select 'div.modal-header' do
|
36
|
+
assert_select 'button[class="close"][data-dismiss="modal"][type="button"]' do
|
37
|
+
assert_select 'span[class="glyphicon glyphicon-remove"]'
|
38
|
+
end
|
39
|
+
assert_select 'h4.modal-title', 'Modal header'
|
40
|
+
end
|
41
|
+
assert_select 'div.modal-body' do
|
42
|
+
assert_select 'p', 'Modal body'
|
43
|
+
end
|
44
|
+
assert_select 'div.modal-footer' do
|
45
|
+
assert_select 'button[class="btn btn-default"][data-dismiss="modal"][type="button"]', 'Dismiss'
|
46
|
+
assert_select 'a[class="btn btn-primary"][href="#"]', 'Confirm'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
test 'page renders a panel' do
|
54
|
+
get :panel
|
55
|
+
|
56
|
+
assert_select 'div.panel.panel-default' do
|
57
|
+
assert_select 'div.panel-heading' do
|
58
|
+
assert_select 'h3.panel-title', 'Panel title'
|
59
|
+
end
|
60
|
+
assert_select 'div.panel-body', 'Panel body'
|
61
|
+
assert_select 'div.panel-footer', 'Panel footer'
|
62
|
+
end
|
63
|
+
|
64
|
+
assert_select 'div.panel.panel-info' do
|
65
|
+
assert_select 'div.panel-heading', 'Panel heading'
|
66
|
+
assert_select 'div.panel-body', 'Panel body'
|
67
|
+
assert_select 'div.panel-footer', 'Panel footer'
|
68
|
+
end
|
69
|
+
end
|
25
70
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'minitest/mock'
|
2
3
|
|
3
4
|
module Booties
|
4
5
|
class ApplicationHelperTest < ActionView::TestCase
|
@@ -31,5 +32,59 @@ module Booties
|
|
31
32
|
expected = '<span class="label label-default foo">content</span>'
|
32
33
|
assert_equal expected, flag('content', class: 'foo')
|
33
34
|
end
|
35
|
+
|
36
|
+
test '#badge renders span tag with badge class' do
|
37
|
+
expected = '<span class="badge">content</span>'
|
38
|
+
assert_equal expected, badge('content')
|
39
|
+
end
|
40
|
+
|
41
|
+
test '#badge passes miscellaneous options through to #content_tag' do
|
42
|
+
expected = '<span class="badge" id="foo">content</span>'
|
43
|
+
assert_equal expected, badge('content', id: 'foo')
|
44
|
+
end
|
45
|
+
|
46
|
+
test '#badge merges optional classes with badge class' do
|
47
|
+
expected = '<span class="badge foo">content</span>'
|
48
|
+
assert_equal expected, badge('content', class: 'foo')
|
49
|
+
end
|
50
|
+
|
51
|
+
test '#modal instantiates a new Modal and calls render' do
|
52
|
+
modal_class = Minitest::Mock.new
|
53
|
+
modal_instance = Minitest::Mock.new
|
54
|
+
|
55
|
+
modal_class.expect :new, modal_instance, [self, id: 'foo', fade: true]
|
56
|
+
modal_instance.expect :render, true
|
57
|
+
|
58
|
+
modal 'foo', with: modal_class
|
59
|
+
|
60
|
+
modal_class.verify
|
61
|
+
modal_instance.verify
|
62
|
+
end
|
63
|
+
|
64
|
+
test '#panel instantiates a new Panel and calls render' do
|
65
|
+
panel_class = Minitest::Mock.new
|
66
|
+
panel_instance = Minitest::Mock.new
|
67
|
+
|
68
|
+
panel_class.expect :new, panel_instance, [self, {}]
|
69
|
+
panel_instance.expect :render, true
|
70
|
+
|
71
|
+
panel with: panel_class
|
72
|
+
|
73
|
+
panel_class.verify
|
74
|
+
panel_instance.verify
|
75
|
+
end
|
76
|
+
|
77
|
+
test '#panel instantiates a new Panel with the given context' do
|
78
|
+
panel_class = Minitest::Mock.new
|
79
|
+
panel_instance = Minitest::Mock.new
|
80
|
+
|
81
|
+
panel_class.expect :new, panel_instance, [self, { context: :primary }]
|
82
|
+
panel_instance.expect :render, true
|
83
|
+
|
84
|
+
panel context: :primary, with: panel_class
|
85
|
+
|
86
|
+
panel_class.verify
|
87
|
+
panel_instance.verify
|
88
|
+
end
|
34
89
|
end
|
35
90
|
end
|
data/test/stub_view.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class StubView
|
2
|
+
def button_tag(content, options = nil, &block)
|
3
|
+
content_tag :button, content, options, &block
|
4
|
+
end
|
5
|
+
|
6
|
+
def capture(*args, &block)
|
7
|
+
block.call *args
|
8
|
+
end
|
9
|
+
|
10
|
+
def content_tag(tag, content, options = nil, &block)
|
11
|
+
options, content = content, capture(&block) if options.nil?
|
12
|
+
"<#{tag} #{attributes options}>#{content}</#{tag}>"
|
13
|
+
end
|
14
|
+
|
15
|
+
def raw(content)
|
16
|
+
content
|
17
|
+
end
|
18
|
+
|
19
|
+
def translate(*args)
|
20
|
+
I18n.translate *args
|
21
|
+
end
|
22
|
+
alias t translate
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def attributes(prefix = nil, **attrs)
|
27
|
+
prefix = "#{prefix}-" if prefix
|
28
|
+
attrs.map { |key, value|
|
29
|
+
if Hash === value
|
30
|
+
attributes key, value
|
31
|
+
else
|
32
|
+
"#{prefix}#{key}=\"#{Array(value).compact.join(' ')}\""
|
33
|
+
end
|
34
|
+
}.join ' '
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: booties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Parker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -97,9 +97,13 @@ files:
|
|
97
97
|
- config/routes.rb
|
98
98
|
- lib/booties.rb
|
99
99
|
- lib/booties/engine.rb
|
100
|
+
- lib/booties/modal.rb
|
101
|
+
- lib/booties/panel.rb
|
100
102
|
- lib/booties/version.rb
|
103
|
+
- lib/booties_test.rb
|
101
104
|
- lib/tasks/booties_tasks.rake
|
102
|
-
- test/
|
105
|
+
- test/booties/modal_test.rb
|
106
|
+
- test/booties/panel_test.rb
|
103
107
|
- test/dummy/README.rdoc
|
104
108
|
- test/dummy/Rakefile
|
105
109
|
- test/dummy/app/assets/javascripts/application.js
|
@@ -110,7 +114,11 @@ files:
|
|
110
114
|
- test/dummy/app/controllers/home_controller.rb
|
111
115
|
- test/dummy/app/helpers/application_helper.rb
|
112
116
|
- test/dummy/app/helpers/home_helper.rb
|
113
|
-
- test/dummy/app/views/home/
|
117
|
+
- test/dummy/app/views/home/badge.html.erb
|
118
|
+
- test/dummy/app/views/home/breadcrumbs.html.erb
|
119
|
+
- test/dummy/app/views/home/flag.html.erb
|
120
|
+
- test/dummy/app/views/home/modal.html.erb
|
121
|
+
- test/dummy/app/views/home/panel.html.erb
|
114
122
|
- test/dummy/app/views/layouts/application.html.erb
|
115
123
|
- test/dummy/bin/bundle
|
116
124
|
- test/dummy/bin/rails
|
@@ -131,6 +139,7 @@ files:
|
|
131
139
|
- test/dummy/config/initializers/mime_types.rb
|
132
140
|
- test/dummy/config/initializers/session_store.rb
|
133
141
|
- test/dummy/config/initializers/wrap_parameters.rb
|
142
|
+
- test/dummy/config/locales/booties.yml
|
134
143
|
- test/dummy/config/locales/en.yml
|
135
144
|
- test/dummy/config/routes.rb
|
136
145
|
- test/dummy/config/secrets.yml
|
@@ -143,6 +152,7 @@ files:
|
|
143
152
|
- test/dummy/test/controllers/home_controller_test.rb
|
144
153
|
- test/helpers/booties/application_helper_test.rb
|
145
154
|
- test/integration/navigation_test.rb
|
155
|
+
- test/stub_view.rb
|
146
156
|
- test/test_helper.rb
|
147
157
|
homepage: https://github.com/jparker/booties
|
148
158
|
licenses:
|
@@ -169,7 +179,8 @@ signing_key:
|
|
169
179
|
specification_version: 4
|
170
180
|
summary: Rails view helpers for Twitter Bootstrap.
|
171
181
|
test_files:
|
172
|
-
- test/
|
182
|
+
- test/booties/modal_test.rb
|
183
|
+
- test/booties/panel_test.rb
|
173
184
|
- test/dummy/app/assets/javascripts/application.js
|
174
185
|
- test/dummy/app/assets/javascripts/home.js
|
175
186
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -178,7 +189,11 @@ test_files:
|
|
178
189
|
- test/dummy/app/controllers/home_controller.rb
|
179
190
|
- test/dummy/app/helpers/application_helper.rb
|
180
191
|
- test/dummy/app/helpers/home_helper.rb
|
181
|
-
- test/dummy/app/views/home/
|
192
|
+
- test/dummy/app/views/home/badge.html.erb
|
193
|
+
- test/dummy/app/views/home/breadcrumbs.html.erb
|
194
|
+
- test/dummy/app/views/home/flag.html.erb
|
195
|
+
- test/dummy/app/views/home/modal.html.erb
|
196
|
+
- test/dummy/app/views/home/panel.html.erb
|
182
197
|
- test/dummy/app/views/layouts/application.html.erb
|
183
198
|
- test/dummy/bin/bundle
|
184
199
|
- test/dummy/bin/rails
|
@@ -198,6 +213,7 @@ test_files:
|
|
198
213
|
- test/dummy/config/initializers/mime_types.rb
|
199
214
|
- test/dummy/config/initializers/session_store.rb
|
200
215
|
- test/dummy/config/initializers/wrap_parameters.rb
|
216
|
+
- test/dummy/config/locales/booties.yml
|
201
217
|
- test/dummy/config/locales/en.yml
|
202
218
|
- test/dummy/config/routes.rb
|
203
219
|
- test/dummy/config/secrets.yml
|
@@ -213,4 +229,5 @@ test_files:
|
|
213
229
|
- test/dummy/test/controllers/home_controller_test.rb
|
214
230
|
- test/helpers/booties/application_helper_test.rb
|
215
231
|
- test/integration/navigation_test.rb
|
232
|
+
- test/stub_view.rb
|
216
233
|
- test/test_helper.rb
|