lolita 3.1.10 → 3.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/.document +5 -5
  2. data/.rspec +2 -2
  3. data/GUIDELINES.rdoc +24 -24
  4. data/Gemfile +26 -26
  5. data/History.rdoc +162 -154
  6. data/LICENSE.txt +22 -22
  7. data/README.rdoc +98 -98
  8. data/Rakefile +40 -40
  9. data/VERSION +1 -1
  10. data/app/controllers/lolita/info_controller.rb +41 -41
  11. data/app/controllers/lolita/rest_controller.rb +130 -130
  12. data/app/helpers/components/lolita/configuration/list_component.rb +10 -10
  13. data/app/helpers/lolita_helper.rb +11 -11
  14. data/app/views/components/lolita/configuration/column/_display.html.erb +4 -4
  15. data/app/views/components/lolita/configuration/column/_header.html.erb +7 -7
  16. data/app/views/components/lolita/configuration/column/_sort.html.erb +4 -4
  17. data/app/views/components/lolita/configuration/columns/_body.html.erb +4 -4
  18. data/app/views/components/lolita/configuration/columns/_display.html.erb +1 -1
  19. data/app/views/components/lolita/configuration/columns/_first.html.erb +2 -2
  20. data/app/views/components/lolita/configuration/columns/_first_column_header.html.erb +3 -3
  21. data/app/views/components/lolita/configuration/columns/_header.html.erb +8 -8
  22. data/app/views/components/lolita/configuration/columns/_last.html.erb +4 -4
  23. data/app/views/components/lolita/configuration/columns/_last_column_header.html.erb +2 -2
  24. data/app/views/components/lolita/configuration/columns/_row.html.erb +7 -7
  25. data/app/views/components/lolita/configuration/field/_display.html.erb +9 -9
  26. data/app/views/components/lolita/configuration/field/_label.html.erb +1 -1
  27. data/app/views/components/lolita/configuration/field/_object.html.erb +1 -1
  28. data/app/views/components/lolita/configuration/field/array/_display.html.erb +4 -4
  29. data/app/views/components/lolita/configuration/field/array/habtm/_display.html.erb +26 -26
  30. data/app/views/components/lolita/configuration/field/array/select/_display.html.erb +5 -5
  31. data/app/views/components/lolita/configuration/field/boolean/filter/_display.html.erb +1 -1
  32. data/app/views/components/lolita/configuration/field/date/_display.html.erb +1 -1
  33. data/app/views/components/lolita/configuration/field/date_time/date/_display.html.erb +1 -1
  34. data/app/views/components/lolita/configuration/field/integer/_display.html.erb +1 -1
  35. data/app/views/components/lolita/configuration/field/string/_display.html.erb +4 -4
  36. data/app/views/components/lolita/configuration/field/string/disabled/_display.html.erb +1 -1
  37. data/app/views/components/lolita/configuration/field/string/password/_display.html.erb +3 -3
  38. data/app/views/components/lolita/configuration/field/string/text/_display.html.erb +18 -18
  39. data/app/views/components/lolita/configuration/field_set/_display.html.erb +5 -5
  40. data/app/views/components/lolita/configuration/list/_display.html.erb +10 -10
  41. data/app/views/components/lolita/configuration/list/_filter.html.erb +7 -7
  42. data/app/views/components/lolita/configuration/list/_new_resource.html.erb +4 -4
  43. data/app/views/components/lolita/configuration/list/_title.html.erb +4 -4
  44. data/app/views/components/lolita/configuration/tab/_display.html.erb +17 -17
  45. data/app/views/components/lolita/configuration/tab/_fields.html.erb +6 -6
  46. data/app/views/components/lolita/configuration/tab/content/_display.html.erb +1 -1
  47. data/app/views/components/lolita/configuration/tab/default/_display.html.erb +8 -8
  48. data/app/views/components/lolita/configuration/tabs/_display.html.erb +10 -10
  49. data/app/views/components/lolita/navigation/_display.html.erb +2 -2
  50. data/app/views/components/lolita/navigation/_tree.html.erb +38 -38
  51. data/app/views/components/lolita/shared/_flash.html.erb +5 -5
  52. data/app/views/components/lolita/shared/_header.html.erb +8 -8
  53. data/app/views/components/lolita/shared/_right_sidebar.html.erb +13 -13
  54. data/app/views/layouts/lolita/application.html.erb +44 -44
  55. data/app/views/lolita/info/index.html.erb +232 -232
  56. data/app/views/lolita/rest/form.html.erb +1 -1
  57. data/app/views/lolita/rest/index.html.erb +1 -1
  58. data/author +1 -1
  59. data/config/locales/default/lv.yml +180 -180
  60. data/config/locales/en.yml +20 -20
  61. data/config/locales/lv.yml +20 -20
  62. data/config/routes.rb +3 -3
  63. data/db/seed.rb +1 -1
  64. data/features/create_page.feature +19 -19
  65. data/features/step_definitions/lolita_steps.rb +7 -7
  66. data/features/step_definitions/web_steps.rb +219 -219
  67. data/features/support/env.rb +73 -73
  68. data/features/support/paths.rb +35 -35
  69. data/lib/generators/helpers/file_helper.rb +22 -22
  70. data/lib/generators/lolita/assets_generator.rb +18 -18
  71. data/lib/generators/lolita/install_generator.rb +28 -28
  72. data/lib/generators/templates/lolita.rb +19 -19
  73. data/lib/lolita.rb +184 -184
  74. data/lib/lolita/adapter/abstract_adapter.rb +13 -13
  75. data/lib/lolita/adapter/active_record.rb +148 -148
  76. data/lib/lolita/adapter/mongoid.rb +127 -127
  77. data/lib/lolita/base_configuration.rb +165 -165
  78. data/lib/lolita/builder.rb +249 -249
  79. data/lib/lolita/configuration/base.rb +76 -76
  80. data/lib/lolita/configuration/column.rb +93 -94
  81. data/lib/lolita/configuration/columns.rb +66 -66
  82. data/lib/lolita/configuration/factory.rb +55 -55
  83. data/lib/lolita/configuration/field.rb +216 -216
  84. data/lib/lolita/configuration/field/array.rb +75 -75
  85. data/lib/lolita/configuration/field/big_decimal.rb +12 -12
  86. data/lib/lolita/configuration/field/boolean.rb +12 -12
  87. data/lib/lolita/configuration/field/date.rb +12 -12
  88. data/lib/lolita/configuration/field/date_time.rb +13 -13
  89. data/lib/lolita/configuration/field/integer.rb +12 -12
  90. data/lib/lolita/configuration/field/string.rb +13 -13
  91. data/lib/lolita/configuration/field/time.rb +13 -13
  92. data/lib/lolita/configuration/field_set.rb +25 -25
  93. data/lib/lolita/configuration/fields.rb +35 -35
  94. data/lib/lolita/configuration/filter.rb +108 -108
  95. data/lib/lolita/configuration/list.rb +104 -104
  96. data/lib/lolita/configuration/page.rb +125 -124
  97. data/lib/lolita/configuration/tab.rb +187 -187
  98. data/lib/lolita/configuration/tab/content.rb +21 -21
  99. data/lib/lolita/configuration/tab/default.rb +25 -25
  100. data/lib/lolita/configuration/tabs.rb +132 -132
  101. data/lib/lolita/controllers/component_helpers.rb +127 -127
  102. data/lib/lolita/controllers/internal_helpers.rb +109 -109
  103. data/lib/lolita/controllers/url_helpers.rb +111 -111
  104. data/lib/lolita/controllers/user_helpers.rb +32 -32
  105. data/lib/lolita/controllers/view_user_helpers.rb +12 -12
  106. data/lib/lolita/dbi/base.rb +50 -50
  107. data/lib/lolita/errors.rb +12 -12
  108. data/lib/lolita/hooks.rb +355 -355
  109. data/lib/lolita/hooks/named_hook.rb +125 -125
  110. data/lib/lolita/lazy_loader.rb +46 -46
  111. data/lib/lolita/mapping.rb +55 -55
  112. data/lib/lolita/modules.rb +6 -6
  113. data/lib/lolita/modules/rest.rb +10 -10
  114. data/lib/lolita/navigation/branch.rb +132 -132
  115. data/lib/lolita/navigation/tree.rb +116 -116
  116. data/lib/lolita/observed_array.rb +74 -74
  117. data/lib/lolita/rails.rb +20 -20
  118. data/lib/lolita/rails/all.rb +10 -10
  119. data/lib/lolita/rails/routes.rb +133 -133
  120. data/lib/lolita/ruby_ext/accessors.rb +26 -26
  121. data/lib/lolita/support/formatter.rb +62 -62
  122. data/lib/lolita/support/formatter/rails.rb +56 -56
  123. data/lib/lolita/test/matchers.rb +77 -77
  124. data/lolita.gemspec +2 -2
  125. data/public/javascripts/jquery-1.6.min.js +15 -15
  126. data/public/javascripts/jquery-ui-1.8.13.min.js +407 -407
  127. data/public/javascripts/lolita/main.js +39 -39
  128. data/public/javascripts/lolita/tab.js +41 -41
  129. data/public/javascripts/modernizr-1.7.min.js +1 -1
  130. data/public/javascripts/rails.js +137 -137
  131. data/public/javascripts/tinymce/langs/en.js +221 -221
  132. data/public/javascripts/tinymce/license.txt +504 -504
  133. data/public/javascripts/tinymce/themes/advanced/about.htm +52 -52
  134. data/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -26
  135. data/public/javascripts/tinymce/themes/advanced/charmap.htm +51 -51
  136. data/public/javascripts/tinymce/themes/advanced/color_picker.htm +74 -74
  137. data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1328 -1328
  138. data/public/javascripts/tinymce/themes/advanced/image.htm +80 -80
  139. data/public/javascripts/tinymce/themes/advanced/js/about.js +73 -73
  140. data/public/javascripts/tinymce/themes/advanced/js/anchor.js +42 -42
  141. data/public/javascripts/tinymce/themes/advanced/js/charmap.js +354 -354
  142. data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -329
  143. data/public/javascripts/tinymce/themes/advanced/js/image.js +247 -247
  144. data/public/javascripts/tinymce/themes/advanced/js/link.js +153 -153
  145. data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -56
  146. data/public/javascripts/tinymce/themes/advanced/langs/en.js +68 -68
  147. data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +53 -53
  148. data/public/javascripts/tinymce/themes/advanced/link.htm +57 -57
  149. data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -47
  150. data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
  151. data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
  152. data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
  153. data/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -25
  154. data/public/javascripts/tinymce/tiny_mce_popup.js +4 -4
  155. data/public/javascripts/tinymce_config.js +15 -15
  156. data/public/stylesheets/lolita/default.css +169 -169
  157. data/public/stylesheets/lolita/style.css +253 -253
  158. data/spec/adapter_helper.rb +43 -43
  159. data/spec/builder_spec.rb +120 -120
  160. data/spec/configuration/base_spec.rb +44 -44
  161. data/spec/configuration/column_spec.rb +89 -89
  162. data/spec/configuration/columns_spec.rb +54 -54
  163. data/spec/configuration/field_set_spec.rb +12 -12
  164. data/spec/configuration/field_spec.rb +118 -118
  165. data/spec/configuration/filter_spec.rb +122 -122
  166. data/spec/configuration/list_spec.rb +76 -76
  167. data/spec/configuration/page_spec.rb +19 -19
  168. data/spec/configuration/tab_spec.rb +165 -165
  169. data/spec/configuration/tabs_spec.rb +106 -106
  170. data/spec/controllers/component_helpers_spec.rb +5 -5
  171. data/spec/controllers/internal_helpers_spec.rb +76 -76
  172. data/spec/controllers/lolita_rest_nested_resources_spec.rb +33 -33
  173. data/spec/controllers/lolita_rest_spec.rb +53 -53
  174. data/spec/dbi/base_spec.rb +44 -44
  175. data/spec/hooks_spec.rb +257 -257
  176. data/spec/lolita_spec.rb +13 -13
  177. data/spec/mapping_spec.rb +29 -29
  178. data/spec/navigation/branch_spec.rb +81 -81
  179. data/spec/navigation/tree_spec.rb +73 -73
  180. data/spec/orm/mongoid.rb +11 -11
  181. data/spec/rails_app/app/controllers/application_controller.rb +3 -3
  182. data/spec/rails_app/app/helpers/application_helper.rb +3 -3
  183. data/spec/rails_app/app/mongoid/address.rb +7 -7
  184. data/spec/rails_app/app/mongoid/category.rb +5 -5
  185. data/spec/rails_app/app/mongoid/comment.rb +5 -5
  186. data/spec/rails_app/app/mongoid/post.rb +18 -18
  187. data/spec/rails_app/app/mongoid/preference.rb +5 -5
  188. data/spec/rails_app/app/mongoid/profile.rb +13 -13
  189. data/spec/rails_app/app/mongoid/tag.rb +3 -3
  190. data/spec/rails_app/app/views/components/lolita/configuration/list/_body_cell.html.erb +1 -1
  191. data/spec/rails_app/config/application.rb +26 -26
  192. data/spec/rails_app/config/boot.rb +13 -13
  193. data/spec/rails_app/config/environment.rb +5 -5
  194. data/spec/rails_app/config/environments/development.rb +19 -19
  195. data/spec/rails_app/config/environments/production.rb +33 -33
  196. data/spec/rails_app/config/environments/test.rb +33 -33
  197. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -7
  198. data/spec/rails_app/config/initializers/inflections.rb +2 -2
  199. data/spec/rails_app/config/initializers/secret_token.rb +1 -1
  200. data/spec/rails_app/config/routes.rb +2 -2
  201. data/spec/rails_app/lib/lolita/configuration/field/my_custom_collection.rb +13 -13
  202. data/spec/rails_app/public/javascripts/jquery-1.5.1.min.js +15 -15
  203. data/spec/rails_app/public/javascripts/lolita/main.js +6 -6
  204. data/spec/rails_app/public/javascripts/lolita/tab.js +40 -40
  205. data/spec/rails_app/public/javascripts/modernizr-1.7.min.js +1 -1
  206. data/spec/rails_app/public/javascripts/rails.js +137 -137
  207. data/spec/rails_app/public/javascripts/tinymce/langs/en.js +221 -221
  208. data/spec/rails_app/public/javascripts/tinymce/license.txt +504 -504
  209. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/about.htm +52 -52
  210. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -26
  211. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/charmap.htm +51 -51
  212. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/color_picker.htm +74 -74
  213. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1328 -1328
  214. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/image.htm +80 -80
  215. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/about.js +73 -73
  216. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/anchor.js +42 -42
  217. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/charmap.js +354 -354
  218. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -329
  219. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/image.js +247 -247
  220. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/link.js +153 -153
  221. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -56
  222. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en.js +68 -68
  223. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +53 -53
  224. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/link.htm +57 -57
  225. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -47
  226. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
  227. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
  228. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
  229. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -25
  230. data/spec/rails_app/public/javascripts/tinymce/tiny_mce_popup.js +4 -4
  231. data/spec/rails_app/public/stylesheets/lolita/default.css +169 -169
  232. data/spec/rails_app/public/stylesheets/lolita/style.css +214 -214
  233. data/spec/routing/routes_spec.rb +15 -15
  234. data/spec/spec_helper.rb +46 -46
  235. data/spec/support/factories/category.rb +3 -3
  236. data/spec/support/factories/post.rb +4 -4
  237. data/spec/support/factories/tag.rb +2 -2
  238. data/spec/support/formatter_spec.rb +42 -42
  239. metadata +31 -31
@@ -1,15 +1,15 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe "Default Lolita routes" do
4
-
5
- it "should have routes for posts" do
6
- # ActionController::Routing::Routes.routes.each do |r|
7
- # puts r
8
- # end
9
- # ActionController::Routing::Routes.named_routes.routes.each do |name, route|
10
- # puts "%20s: %s" % [name, route]
11
- # end
12
- {:get=>'/lolita/posts'}.should be_routable
13
- end
14
- end
15
-
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Default Lolita routes" do
4
+
5
+ it "should have routes for posts" do
6
+ # ActionController::Routing::Routes.routes.each do |r|
7
+ # puts r
8
+ # end
9
+ # ActionController::Routing::Routes.named_routes.routes.each do |name, route|
10
+ # puts "%20s: %s" % [name, route]
11
+ # end
12
+ {:get=>'/lolita/posts'}.should be_routable
13
+ end
14
+ end
15
+
data/spec/spec_helper.rb CHANGED
@@ -1,47 +1,47 @@
1
- #require 'cover_me'
2
- #CoverMe.config do |c|
3
- # # where is your project's root:
4
- # c.project.root="c:/a_work/ruby_docs/lolita3" # => "Rails.root" (default)
5
- #
6
- # # what files are you interested in coverage for:
7
- # #c.file_pattern # => /(#{CoverMe.config.project.root}\/app\/.+\.rb|#{CoverMe.config.project.root}\/lib\/.+\.rb)/i (default)
8
- #
9
- # # where do you want the HTML generated:
10
- # c.html_formatter.output_path # => File.join(CoverMe.config.project.root, 'coverage') (default)
11
- #
12
- # # what do you want to happen when it finishes:
13
- # c.at_exit # => Proc.new {
14
- # if CoverMe.config.formatter == CoverMe::HtmlFormatter
15
- # index = File.join(CoverMe.config.html_formatter.output_path, 'index.html')
16
- # if File.exists?(index)
17
- # `open #{index}`
18
- # end
19
- # end
20
- #
21
- #end
22
-
23
- require 'rubygems'
24
- #require 'ruby-debug'
25
- LOLITA_ORM=:mongoid
26
- require "orm/#{LOLITA_ORM}"
27
- require "rails"
28
- require "rails_app/config/environment"
29
- require 'rspec/rails'
30
- require 'ffaker'
31
- require 'factory_girl'
32
-
33
- Dir["#{File.dirname(__FILE__)}/support/factories/**/*.rb"].each {|f| require f}
34
- RSpec.configure do |config|
35
- # config.mock_with :mocha
36
- # config.mock_with :flexmock
37
- # config.mock_with :rr
38
- config.mock_with :rspec
39
-
40
- if LOLITA_ORM==:active_record
41
- #config.fixture_path = "#{::Rails.root}/spec/fixtures"
42
- config.use_transactional_fixtures = true
43
- end
44
- end
45
- #CoverMe.complete!
46
- #require 'simplecov'
1
+ #require 'cover_me'
2
+ #CoverMe.config do |c|
3
+ # # where is your project's root:
4
+ # c.project.root="c:/a_work/ruby_docs/lolita3" # => "Rails.root" (default)
5
+ #
6
+ # # what files are you interested in coverage for:
7
+ # #c.file_pattern # => /(#{CoverMe.config.project.root}\/app\/.+\.rb|#{CoverMe.config.project.root}\/lib\/.+\.rb)/i (default)
8
+ #
9
+ # # where do you want the HTML generated:
10
+ # c.html_formatter.output_path # => File.join(CoverMe.config.project.root, 'coverage') (default)
11
+ #
12
+ # # what do you want to happen when it finishes:
13
+ # c.at_exit # => Proc.new {
14
+ # if CoverMe.config.formatter == CoverMe::HtmlFormatter
15
+ # index = File.join(CoverMe.config.html_formatter.output_path, 'index.html')
16
+ # if File.exists?(index)
17
+ # `open #{index}`
18
+ # end
19
+ # end
20
+ #
21
+ #end
22
+
23
+ require 'rubygems'
24
+ #require 'ruby-debug'
25
+ LOLITA_ORM=:mongoid
26
+ require "orm/#{LOLITA_ORM}"
27
+ require "rails"
28
+ require "rails_app/config/environment"
29
+ require 'rspec/rails'
30
+ require 'ffaker'
31
+ require 'factory_girl'
32
+
33
+ Dir["#{File.dirname(__FILE__)}/support/factories/**/*.rb"].each {|f| require f}
34
+ RSpec.configure do |config|
35
+ # config.mock_with :mocha
36
+ # config.mock_with :flexmock
37
+ # config.mock_with :rr
38
+ config.mock_with :rspec
39
+
40
+ if LOLITA_ORM==:active_record
41
+ #config.fixture_path = "#{::Rails.root}/spec/fixtures"
42
+ config.use_transactional_fixtures = true
43
+ end
44
+ end
45
+ #CoverMe.complete!
46
+ #require 'simplecov'
47
47
  #SimpleCov.start 'rails'
@@ -1,3 +1,3 @@
1
- Factory.define(:category, :class=>Category) do |f|
2
- f.name Faker::Name.name
3
- end
1
+ Factory.define(:category, :class=>Category) do |f|
2
+ f.name Faker::Name.name
3
+ end
@@ -1,4 +1,4 @@
1
- Factory.define(:post, :class=>Post) do |f|
2
- f.title Faker::Lorem.sentence
3
- f.association :category
4
- end
1
+ Factory.define(:post, :class=>Post) do |f|
2
+ f.title Faker::Lorem.sentence
3
+ f.association :category
4
+ end
@@ -1,3 +1,3 @@
1
- Factory.define(:tag) do |f|
2
- f.name Faker::Name.name
1
+ Factory.define(:tag) do |f|
2
+ f.name Faker::Name.name
3
3
  end
@@ -1,42 +1,42 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../simple_spec_helper')
2
-
3
- describe Lolita::Support::Formatter do
4
- let(:klass){Lolita::Support::Formatter}
5
-
6
- context "create new" do
7
-
8
- it "should accept value as format" do
9
- formatter=klass.new("%Y-%m")
10
- formatter.format.should == "%Y-%m"
11
- end
12
-
13
- it "should accept block" do
14
- formatter=klass.new do |value|
15
- value**2
16
- end
17
- formatter.block.should_not be_nil
18
- end
19
- end
20
-
21
- context "calling formatter" do
22
- it "should call block" do
23
- formatter=klass.new do |value|
24
- value.to_i+1
25
- end
26
- formatter.with(2).should == 3
27
- end
28
-
29
- it "should try to call #format method on given value" do
30
- formatter=klass.new("M")
31
- object=mock(Object)
32
- object.stub!(:format).and_return(1)
33
- object.stub!(:respond_to?).with(:format).and_return(true)
34
- formatter.with(object).should == 1
35
- end
36
-
37
- it "should convert received value to string and call #unpack" do
38
- formatter=klass.new("%.3f")
39
- formatter.with(44.88).should == "44.880"
40
- end
41
- end
42
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/../simple_spec_helper')
2
+
3
+ describe Lolita::Support::Formatter do
4
+ let(:klass){Lolita::Support::Formatter}
5
+
6
+ context "create new" do
7
+
8
+ it "should accept value as format" do
9
+ formatter=klass.new("%Y-%m")
10
+ formatter.format.should == "%Y-%m"
11
+ end
12
+
13
+ it "should accept block" do
14
+ formatter=klass.new do |value|
15
+ value**2
16
+ end
17
+ formatter.block.should_not be_nil
18
+ end
19
+ end
20
+
21
+ context "calling formatter" do
22
+ it "should call block" do
23
+ formatter=klass.new do |value|
24
+ value.to_i+1
25
+ end
26
+ formatter.with(2).should == 3
27
+ end
28
+
29
+ it "should try to call #format method on given value" do
30
+ formatter=klass.new("M")
31
+ object=mock(Object)
32
+ object.stub!(:format).and_return(1)
33
+ object.stub!(:respond_to?).with(:format).and_return(true)
34
+ formatter.with(object).should == 1
35
+ end
36
+
37
+ it "should convert received value to string and call #unpack" do
38
+ formatter=klass.new("%.3f")
39
+ formatter.with(44.88).should == "44.880"
40
+ end
41
+ end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolita
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.10
4
+ version: 3.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-06 00:00:00.000000000 +03:00
12
+ date: 2011-07-15 00:00:00.000000000 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &74405330 !ruby/object:Gem::Requirement
17
+ requirement: &82827030 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.7
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *74405330
25
+ version_requirements: *82827030
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: kaminari
28
- requirement: &74395050 !ruby/object:Gem::Requirement
28
+ requirement: &82826440 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.12.4
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *74395050
36
+ version_requirements: *82826440
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: abstract
39
- requirement: &74394750 !ruby/object:Gem::Requirement
39
+ requirement: &82825690 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *74394750
47
+ version_requirements: *82825690
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: builder
50
- requirement: &74394390 !ruby/object:Gem::Requirement
50
+ requirement: &82824830 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 2.1.2
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *74394390
58
+ version_requirements: *82824830
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: jeweler
61
- requirement: &74394070 !ruby/object:Gem::Requirement
61
+ requirement: &82823920 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.5.2
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *74394070
69
+ version_requirements: *82823920
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
- requirement: &74393750 !ruby/object:Gem::Requirement
72
+ requirement: &82823110 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 2.6.0
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *74393750
80
+ version_requirements: *82823110
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec-rails
83
- requirement: &74393500 !ruby/object:Gem::Requirement
83
+ requirement: &82822330 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 2.6.0
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *74393500
91
+ version_requirements: *82822330
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: factory_girl
94
- requirement: &74393060 !ruby/object:Gem::Requirement
94
+ requirement: &82796720 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *74393060
102
+ version_requirements: *82796720
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: ffaker
105
- requirement: &74392690 !ruby/object:Gem::Requirement
105
+ requirement: &82796060 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *74392690
113
+ version_requirements: *82796060
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: ruby-debug19
116
- requirement: &74392300 !ruby/object:Gem::Requirement
116
+ requirement: &82794650 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *74392300
124
+ version_requirements: *82794650
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: cucumber-rails
127
- requirement: &74391860 !ruby/object:Gem::Requirement
127
+ requirement: &82793470 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *74391860
135
+ version_requirements: *82793470
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: capybara
138
- requirement: &74391410 !ruby/object:Gem::Requirement
138
+ requirement: &82792730 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ! '>='
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: '0'
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *74391410
146
+ version_requirements: *82792730
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: database_cleaner
149
- requirement: &74390950 !ruby/object:Gem::Requirement
149
+ requirement: &82792260 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ! '>='
@@ -154,10 +154,10 @@ dependencies:
154
154
  version: '0'
155
155
  type: :development
156
156
  prerelease: false
157
- version_requirements: *74390950
157
+ version_requirements: *82792260
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: akephalos
160
- requirement: &74390380 !ruby/object:Gem::Requirement
160
+ requirement: &82791050 !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
163
  - - ! '>='
@@ -165,7 +165,7 @@ dependencies:
165
165
  version: '0'
166
166
  type: :development
167
167
  prerelease: false
168
- version_requirements: *74390380
168
+ version_requirements: *82791050
169
169
  description: ! 'Great Rails CMS, that turns your business logic into good-looking,
170
170
  fully functional workspace. '
171
171
  email: support@ithouse.lv
@@ -498,7 +498,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
498
498
  version: '0'
499
499
  segments:
500
500
  - 0
501
- hash: -383942609
501
+ hash: -966399281
502
502
  required_rubygems_version: !ruby/object:Gem::Requirement
503
503
  none: false
504
504
  requirements: