bootstrap_helper 2.1.2 → 2.1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.rspec +1 -0
  2. data/CHANGELOG +1 -0
  3. data/Gemfile +4 -0
  4. data/bootstrap_helper.gemspec +3 -0
  5. data/config/initializers/simple_form.rb +142 -140
  6. data/lib/bootstrap_helper.rb +2 -0
  7. data/lib/bootstrap_helper/engine.rb +1 -0
  8. data/lib/bootstrap_helper/helper.rb +1 -1
  9. data/lib/bootstrap_helper/version.rb +1 -1
  10. data/spec/dummy/.rspec +1 -0
  11. data/spec/dummy/README.rdoc +261 -0
  12. data/spec/dummy/Rakefile +7 -0
  13. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/spec/dummy/app/controllers/application_controller.rb +6 -0
  16. data/spec/dummy/app/controllers/welcome_controller.rb +6 -0
  17. data/spec/dummy/app/helpers/application_helper.rb +3 -0
  18. data/spec/dummy/app/mailers/.gitkeep +0 -0
  19. data/spec/dummy/app/models/.gitkeep +0 -0
  20. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  21. data/spec/dummy/app/views/welcome/index.html.erb +0 -0
  22. data/spec/dummy/config.ru +4 -0
  23. data/spec/dummy/config/application.rb +65 -0
  24. data/spec/dummy/config/boot.rb +10 -0
  25. data/spec/dummy/config/database.yml +25 -0
  26. data/spec/dummy/config/environment.rb +5 -0
  27. data/spec/dummy/config/environments/development.rb +37 -0
  28. data/spec/dummy/config/environments/production.rb +67 -0
  29. data/spec/dummy/config/environments/test.rb +37 -0
  30. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/spec/dummy/config/initializers/inflections.rb +15 -0
  32. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  33. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  34. data/spec/dummy/config/initializers/session_store.rb +8 -0
  35. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  36. data/spec/dummy/config/locales/en.yml +5 -0
  37. data/spec/dummy/config/routes.rb +59 -0
  38. data/spec/dummy/db/test.sqlite3 +0 -0
  39. data/spec/dummy/lib/assets/.gitkeep +0 -0
  40. data/spec/dummy/log/.gitkeep +0 -0
  41. data/spec/dummy/log/development.log +0 -0
  42. data/spec/dummy/log/test.log +415 -0
  43. data/spec/dummy/public/404.html +26 -0
  44. data/spec/dummy/public/422.html +26 -0
  45. data/spec/dummy/public/500.html +25 -0
  46. data/spec/dummy/public/favicon.ico +0 -0
  47. data/spec/dummy/script/rails +6 -0
  48. data/spec/helpers/application_helper_spec.rb +110 -0
  49. data/spec/integration/view_homepage_spec.rb +15 -0
  50. data/spec/spec_helper.rb +44 -0
  51. metadata +132 -8
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,110 @@
1
+ require 'spec_helper'
2
+
3
+ describe ApplicationHelper do
4
+
5
+ describe "yield_or_default" do
6
+ it "should return yield_name" do
7
+ yield_or_default(:xxx).should == :xxx
8
+ end
9
+
10
+ it "should return default message" do
11
+ yield_or_default(nil).should == ""
12
+ end
13
+ end
14
+
15
+ describe "render_page_title" do
16
+ it "should return 'SITENAME' when @page_title and SITE_NAME not given" do
17
+ render_page_title.should == "<title>SITE_NAME</title>"
18
+ end
19
+
20
+ it "should return 'SITENAME' when @page_title not given" do
21
+ SITE_NAME = "Foo"
22
+ render_page_title.should == "<title>Foo</title>"
23
+ end
24
+
25
+ it "should return @page_title when @page_title is given" do
26
+ @page_title = "Bar"
27
+ render_page_title.should == "<title>Foo | Bar</title>"
28
+ end
29
+ end
30
+
31
+
32
+ describe "notice_message" do
33
+
34
+ it "should return flash message" do
35
+ stub!(:flash).and_return({:warning => "Update Success!"})
36
+ notice_message.should == "<div class=\"alert fade in alert-warning\"><a href=\"#\" class=\"close\" data-dismiss=\"alert\">x</a>Update Success!</div>"
37
+ end
38
+
39
+ it "should return alert-success message when use notice message" do
40
+ stub!(:flash).and_return({:notice => "Update Success!"})
41
+ notice_message.should == "<div class=\"alert fade in alert-success\"><a href=\"#\" class=\"close\" data-dismiss=\"alert\">x</a>Update Success!</div>"
42
+ end
43
+
44
+ end
45
+
46
+ describe "s" do
47
+
48
+ let(:tags) { %w(table thead tbody tr td th ol ul li div span font img sup sub br hr a pre p h1 h2 h3 h4 h5 h6)}
49
+ let(:poison_string) {"javascript: alert('hello');"}
50
+
51
+
52
+ def sanitize_tags(tags,attributes)
53
+ tags.each do |tag|
54
+ attributes.each do |attribute|
55
+ html_tag = content_tag(tag, "", attribute.to_sym => poison_string )
56
+ s(html_tag).should == content_tag(tag, "")
57
+ end
58
+ end
59
+ end
60
+
61
+ it "should sanitize javascripts hiddln in tags using href src" do
62
+ attributes = %w(href src)
63
+ sanitize_tags(tags,attributes)
64
+ end
65
+
66
+
67
+ it "should sanitize javascripts hiddlen in tags using style" do
68
+ attributes = %w(style)
69
+ tags.each do |tag|
70
+ attributes.each do |attribute|
71
+ html_tag = content_tag(tag, "", attribute.to_sym => poison_string )
72
+ s(html_tag).should == content_tag(tag, "", attribute => "")
73
+ end
74
+ end
75
+ end
76
+
77
+ end
78
+
79
+ describe "render_list" do
80
+ before do
81
+ self.stub!("current_page?").and_return(true)
82
+ end
83
+
84
+ def render_some_list(options={})
85
+ list = render_list options do |li|
86
+ li << link_to("Link 1", "#")
87
+ li << link_to("Link 2", "#")
88
+ li << link_to("Link 3", "#")
89
+ end
90
+ end
91
+
92
+
93
+ it "should return ul & li" do
94
+ list = render_some_list
95
+ list.should == "<ul><li class=\"first active\"><a href=\"#\">Link 1</a></li><li class=\"active\"><a href=\"#\">Link 2</a></li><li class=\"last active\"><a href=\"#\">Link 3</a></li></ul>"
96
+ end
97
+
98
+ it "should return ul with class_name" do
99
+ options = { :class => "foo" }
100
+ list = render_some_list(options)
101
+ list.should == "<ul class=\"foo\"><li class=\"first active\"><a href=\"#\">Link 1</a></li><li class=\"active\"><a href=\"#\">Link 2</a></li><li class=\"last active\"><a href=\"#\">Link 3</a></li></ul>"
102
+ end
103
+
104
+ it "should return ul with id_name" do
105
+ options = { :id => "bar" }
106
+ list = render_some_list(options)
107
+ list.should == "<ul id=\"bar\"><li class=\"first active\"><a href=\"#\">Link 1</a></li><li class=\"active\"><a href=\"#\">Link 2</a></li><li class=\"last active\"><a href=\"#\">Link 3</a></li></ul>"
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'View the homepage' do
4
+
5
+ scenario 'page should have breadcrumb' do
6
+ visit_homepage
7
+ page.should have_css(".breadcrumb")
8
+ end
9
+
10
+
11
+ def visit_homepage
12
+ visit root_path
13
+ end
14
+
15
+ end
@@ -0,0 +1,44 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../dummy/config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ # Configure capybara for integration testing
8
+ require "capybara/rails"
9
+ Capybara.default_driver = :rack_test
10
+ Capybara.default_selector = :css
11
+
12
+ # Load support files
13
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
14
+
15
+
16
+ RSpec.configure do |config|
17
+ # ## Mock Framework
18
+ #
19
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
20
+ #
21
+ # config.mock_with :mocha
22
+ # config.mock_with :flexmock
23
+ # config.mock_with :rr
24
+
25
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
26
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
27
+
28
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
29
+ # examples within a transaction, remove the following line or assign false
30
+ # instead of true.
31
+ config.use_transactional_fixtures = true
32
+
33
+ # If true, the base class of anonymous controllers will be inferred
34
+ # automatically. This will be the default behavior in future versions of
35
+ # rspec-rails.
36
+ # config.infer_base_class_for_anonymous_controllers = false
37
+
38
+ # Run specs in random order to surface order dependencies. If you find an
39
+ # order dependency and want to debug it, you can fix the order by providing
40
+ # the seed, which is printed after each run.
41
+ # --seed 1234
42
+ # config.order = "random"
43
+
44
+ end
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 2
7
7
  - 1
8
8
  - 2
9
- version: 2.1.2
9
+ - 1
10
+ version: 2.1.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - xdite
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2012-10-12 00:00:00 +08:00
18
+ date: 2012-12-04 00:00:00 +08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -76,9 +77,50 @@ dependencies:
76
77
  type: :runtime
77
78
  version_requirements: *id004
78
79
  - !ruby/object:Gem::Dependency
79
- name: bundler
80
+ name: rspec-rails
80
81
  prerelease: false
81
82
  requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ name: capybara
94
+ prerelease: false
95
+ requirement: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ segments:
101
+ - 0
102
+ - 4
103
+ - 0
104
+ version: 0.4.0
105
+ type: :development
106
+ version_requirements: *id006
107
+ - !ruby/object:Gem::Dependency
108
+ name: sqlite3
109
+ prerelease: false
110
+ requirement: &id007 !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ type: :development
119
+ version_requirements: *id007
120
+ - !ruby/object:Gem::Dependency
121
+ name: bundler
122
+ prerelease: false
123
+ requirement: &id008 !ruby/object:Gem::Requirement
82
124
  none: false
83
125
  requirements:
84
126
  - - ">="
@@ -89,11 +131,11 @@ dependencies:
89
131
  - 0
90
132
  version: 1.0.0
91
133
  type: :development
92
- version_requirements: *id005
134
+ version_requirements: *id008
93
135
  - !ruby/object:Gem::Dependency
94
136
  name: rails
95
137
  prerelease: false
96
- requirement: &id006 !ruby/object:Gem::Requirement
138
+ requirement: &id009 !ruby/object:Gem::Requirement
97
139
  none: false
98
140
  requirements:
99
141
  - - ~>
@@ -103,7 +145,7 @@ dependencies:
103
145
  - 0
104
146
  version: "3.0"
105
147
  type: :development
106
- version_requirements: *id006
148
+ version_requirements: *id009
107
149
  description: Twitter Bootstrap HTML Helper
108
150
  email:
109
151
  - xuite.joke@gmail.com
@@ -115,6 +157,7 @@ extra_rdoc_files: []
115
157
 
116
158
  files:
117
159
  - .gitignore
160
+ - .rspec
118
161
  - CHANGELOG
119
162
  - Gemfile
120
163
  - README.md
@@ -129,6 +172,47 @@ files:
129
172
  - lib/bootstrap_helper/helper.rb
130
173
  - lib/bootstrap_helper/railtie.rb
131
174
  - lib/bootstrap_helper/version.rb
175
+ - spec/dummy/.rspec
176
+ - spec/dummy/README.rdoc
177
+ - spec/dummy/Rakefile
178
+ - spec/dummy/app/assets/javascripts/application.js
179
+ - spec/dummy/app/assets/stylesheets/application.css
180
+ - spec/dummy/app/controllers/application_controller.rb
181
+ - spec/dummy/app/controllers/welcome_controller.rb
182
+ - spec/dummy/app/helpers/application_helper.rb
183
+ - spec/dummy/app/mailers/.gitkeep
184
+ - spec/dummy/app/models/.gitkeep
185
+ - spec/dummy/app/views/layouts/application.html.erb
186
+ - spec/dummy/app/views/welcome/index.html.erb
187
+ - spec/dummy/config.ru
188
+ - spec/dummy/config/application.rb
189
+ - spec/dummy/config/boot.rb
190
+ - spec/dummy/config/database.yml
191
+ - spec/dummy/config/environment.rb
192
+ - spec/dummy/config/environments/development.rb
193
+ - spec/dummy/config/environments/production.rb
194
+ - spec/dummy/config/environments/test.rb
195
+ - spec/dummy/config/initializers/backtrace_silencers.rb
196
+ - spec/dummy/config/initializers/inflections.rb
197
+ - spec/dummy/config/initializers/mime_types.rb
198
+ - spec/dummy/config/initializers/secret_token.rb
199
+ - spec/dummy/config/initializers/session_store.rb
200
+ - spec/dummy/config/initializers/wrap_parameters.rb
201
+ - spec/dummy/config/locales/en.yml
202
+ - spec/dummy/config/routes.rb
203
+ - spec/dummy/db/test.sqlite3
204
+ - spec/dummy/lib/assets/.gitkeep
205
+ - spec/dummy/log/.gitkeep
206
+ - spec/dummy/log/development.log
207
+ - spec/dummy/log/test.log
208
+ - spec/dummy/public/404.html
209
+ - spec/dummy/public/422.html
210
+ - spec/dummy/public/500.html
211
+ - spec/dummy/public/favicon.ico
212
+ - spec/dummy/script/rails
213
+ - spec/helpers/application_helper_spec.rb
214
+ - spec/integration/view_homepage_spec.rb
215
+ - spec/spec_helper.rb
132
216
  has_rdoc: true
133
217
  homepage: https://github.com/xdite/bootstrap-helper
134
218
  licenses: []
@@ -161,5 +245,45 @@ rubygems_version: 1.3.7.1
161
245
  signing_key:
162
246
  specification_version: 3
163
247
  summary: Twitter Bootstrap HTML Helper
164
- test_files: []
165
-
248
+ test_files:
249
+ - spec/dummy/.rspec
250
+ - spec/dummy/README.rdoc
251
+ - spec/dummy/Rakefile
252
+ - spec/dummy/app/assets/javascripts/application.js
253
+ - spec/dummy/app/assets/stylesheets/application.css
254
+ - spec/dummy/app/controllers/application_controller.rb
255
+ - spec/dummy/app/controllers/welcome_controller.rb
256
+ - spec/dummy/app/helpers/application_helper.rb
257
+ - spec/dummy/app/mailers/.gitkeep
258
+ - spec/dummy/app/models/.gitkeep
259
+ - spec/dummy/app/views/layouts/application.html.erb
260
+ - spec/dummy/app/views/welcome/index.html.erb
261
+ - spec/dummy/config.ru
262
+ - spec/dummy/config/application.rb
263
+ - spec/dummy/config/boot.rb
264
+ - spec/dummy/config/database.yml
265
+ - spec/dummy/config/environment.rb
266
+ - spec/dummy/config/environments/development.rb
267
+ - spec/dummy/config/environments/production.rb
268
+ - spec/dummy/config/environments/test.rb
269
+ - spec/dummy/config/initializers/backtrace_silencers.rb
270
+ - spec/dummy/config/initializers/inflections.rb
271
+ - spec/dummy/config/initializers/mime_types.rb
272
+ - spec/dummy/config/initializers/secret_token.rb
273
+ - spec/dummy/config/initializers/session_store.rb
274
+ - spec/dummy/config/initializers/wrap_parameters.rb
275
+ - spec/dummy/config/locales/en.yml
276
+ - spec/dummy/config/routes.rb
277
+ - spec/dummy/db/test.sqlite3
278
+ - spec/dummy/lib/assets/.gitkeep
279
+ - spec/dummy/log/.gitkeep
280
+ - spec/dummy/log/development.log
281
+ - spec/dummy/log/test.log
282
+ - spec/dummy/public/404.html
283
+ - spec/dummy/public/422.html
284
+ - spec/dummy/public/500.html
285
+ - spec/dummy/public/favicon.ico
286
+ - spec/dummy/script/rails
287
+ - spec/helpers/application_helper_spec.rb
288
+ - spec/integration/view_homepage_spec.rb
289
+ - spec/spec_helper.rb