h2ocube_rails_helper 0.0.16 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/Gemfile +0 -3
  4. data/README.md +0 -1
  5. data/Rakefile +7 -7
  6. data/h2ocube_rails_helper.gemspec +9 -1
  7. data/h2ocube_rails_helper.sublime-project +15 -0
  8. data/lib/h2ocube_rails_helper.rb +93 -89
  9. data/spec/fake_app/models.rb +14 -0
  10. data/spec/fake_app/rails_app.rb +33 -0
  11. data/spec/helpers/render_canonical_spec.rb +16 -0
  12. data/spec/helpers/render_description_spec.rb +37 -0
  13. data/spec/helpers/render_ga_spec.rb +38 -0
  14. data/{test/render_html_class_test.rb → spec/helpers/render_html_class_spec.rb} +44 -45
  15. data/spec/helpers/render_keywords_spec.rb +39 -0
  16. data/spec/helpers/render_title_spec.rb +56 -0
  17. data/spec/spec_helper.rb +24 -0
  18. metadata +120 -57
  19. data/test/dummy/Rakefile +0 -7
  20. data/test/dummy/app/controllers/application_controller.rb +0 -3
  21. data/test/dummy/app/helpers/application_helper.rb +0 -2
  22. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  23. data/test/dummy/config.ru +0 -4
  24. data/test/dummy/config/application.rb +0 -20
  25. data/test/dummy/config/boot.rb +0 -10
  26. data/test/dummy/config/database.yml +0 -22
  27. data/test/dummy/config/environment.rb +0 -5
  28. data/test/dummy/config/environments/development.rb +0 -23
  29. data/test/dummy/config/environments/production.rb +0 -49
  30. data/test/dummy/config/environments/test.rb +0 -24
  31. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  32. data/test/dummy/config/initializers/inflections.rb +0 -10
  33. data/test/dummy/config/initializers/mime_types.rb +0 -5
  34. data/test/dummy/config/initializers/secret_token.rb +0 -7
  35. data/test/dummy/config/initializers/session_store.rb +0 -8
  36. data/test/dummy/config/locales/en.yml +0 -5
  37. data/test/dummy/config/routes.rb +0 -58
  38. data/test/dummy/script/rails +0 -6
  39. data/test/render_canonical_test.rb +0 -16
  40. data/test/render_description_test.rb +0 -37
  41. data/test/render_ga_test.rb +0 -37
  42. data/test/render_keywords_test.rb +0 -41
  43. data/test/render_title_test.rb +0 -56
  44. data/test/test_helper.rb +0 -7
data/test/dummy/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
- require 'rake'
6
-
7
- Dummy::Application.load_tasks
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag :all %>
6
- <%= javascript_include_tag :defaults %>
7
- <%= csrf_meta_tag %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
data/test/dummy/config.ru DELETED
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
@@ -1,20 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- #require "active_model/railtie"
4
- require "action_controller/railtie"
5
- #require "action_view/railtie"
6
-
7
- Bundler.require
8
-
9
- Dir[File.dirname(__FILE__) << '/../../../']
10
-
11
- module Dummy
12
- class Application < Rails::Application
13
-
14
- # Configure the default encoding used in templates for Ruby 1.9.
15
- config.encoding = "utf-8"
16
-
17
- # Configure sensitive parameters which will be filtered from the log file.
18
- config.filter_parameters += [:password]
19
- end
20
- end
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,22 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- development:
4
- adapter: sqlite3
5
- database: db/development.sqlite3
6
- pool: 5
7
- timeout: 5000
8
-
9
- # Warning: The database defined as "test" will be erased and
10
- # re-generated from your development database when you run "rake".
11
- # Do not set this db to the same as development or production.
12
- test:
13
- adapter: sqlite3
14
- database: db/test.sqlite3
15
- pool: 5
16
- timeout: 5000
17
-
18
- production:
19
- adapter: sqlite3
20
- database: db/production.sqlite3
21
- pool: 5
22
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
@@ -1,23 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the webserver when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
-
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
15
- config.action_controller.perform_caching = false
16
-
17
- # Print deprecation notices to the Rails logger
18
- config.active_support.deprecation = :log
19
-
20
- # Only use best-standards-support built into browsers
21
- config.action_dispatch.best_standards_support = :builtin
22
- end
23
-
@@ -1,49 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # The production environment is meant for finished, "live" apps.
5
- # Code is not reloaded between requests
6
- config.cache_classes = true
7
-
8
- # Full error reports are disabled and caching is turned on
9
- config.consider_all_requests_local = false
10
- config.action_controller.perform_caching = true
11
-
12
- # Specifies the header that your server uses for sending files
13
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
-
15
- # For nginx:
16
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
-
18
- # If you have no front-end server that supports something like X-Sendfile,
19
- # just comment this out and Rails will serve the files
20
-
21
- # See everything in the log (default is :info)
22
- # config.log_level = :debug
23
-
24
- # Use a different logger for distributed setups
25
- # config.logger = SyslogLogger.new
26
-
27
- # Use a different cache store in production
28
- # config.cache_store = :mem_cache_store
29
-
30
- # Disable Rails's static asset server
31
- # In production, Apache or nginx will already do this
32
- config.serve_static_assets = false
33
-
34
- # Enable serving of images, stylesheets, and javascripts from an asset server
35
- config.action_controller.asset_host = "http://assets.com"
36
-
37
- # Disable delivery errors, bad email addresses will be ignored
38
- # config.action_mailer.raise_delivery_errors = false
39
-
40
- # Enable threaded mode
41
- # config.threadsafe!
42
-
43
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
- # the I18n.default_locale when a translation can not be found)
45
- config.i18n.fallbacks = true
46
-
47
- # Send deprecation notices to registered listeners
48
- config.active_support.deprecation = :notify
49
- end
@@ -1,24 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Show full error reports and disable caching
11
- config.consider_all_requests_local = true
12
- config.action_controller.perform_caching = false
13
-
14
- # Raise exceptions instead of rendering exception templates
15
- config.action_dispatch.show_exceptions = false
16
-
17
- # Disable request forgery protection in test environment
18
- config.action_controller.allow_forgery_protection = false
19
-
20
- # Print deprecation notices to the stderr
21
- config.active_support.deprecation = :stderr
22
-
23
- config.eager_load = false if config.respond_to?(:eager_load)
24
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = 'ca3f29ce2033cebff511999f2fce3f4777dda12be7b8ad71e3f82bead7b95c26cd995ece00052674ee35dfd7892b7c78d0faaaffc9274fcf1b9bb49805ff0a2e'
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rails generate session_migration")
8
- # Dummy::Application.config.session_store :active_record_store
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,58 +0,0 @@
1
- Dummy::Application.routes.draw do
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
4
-
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
8
-
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
12
-
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
- # resources :products
15
-
16
- # Sample resource route with options:
17
- # resources :products do
18
- # member do
19
- # get 'short'
20
- # post 'toggle'
21
- # end
22
- #
23
- # collection do
24
- # get 'sold'
25
- # end
26
- # end
27
-
28
- # Sample resource route with sub-resources:
29
- # resources :products do
30
- # resources :comments, :sales
31
- # resource :seller
32
- # end
33
-
34
- # Sample resource route with more complex sub-resources
35
- # resources :products do
36
- # resources :comments
37
- # resources :sales do
38
- # get 'recent', :on => :collection
39
- # end
40
- # end
41
-
42
- # Sample resource route within a namespace:
43
- # namespace :admin do
44
- # # Directs /admin/products/* to Admin::ProductsController
45
- # # (app/controllers/admin/products_controller.rb)
46
- # resources :products
47
- # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => "welcome#index"
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- # match ':controller(/:action(/:id(.:format)))'
58
- end
@@ -1,6 +0,0 @@
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'
@@ -1,16 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RenderCanonicalClass < ActionView::TestCase
4
- test 'simple' do
5
- assert_equal render_canonical, ''
6
- end
7
-
8
- test '@canonical' do
9
- @canonical = '@canonical'
10
- assert_equal render_canonical, '<link rel="canonical" href="@canonical" />'
11
- [' ', '', nil].each do |desc|
12
- @canonical = desc
13
- assert_equal render_canonical, ''
14
- end
15
- end
16
- end
@@ -1,37 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RenderDescriptionClass < ActionView::TestCase
4
- test 'simple' do
5
- assert_equal render_description, '<meta name="description" content="description" />'
6
- end
7
-
8
- test '@description' do
9
- @description = '@description'
10
- assert_equal render_description, '<meta name="description" content="@description" />'
11
- [' ', '', nil].each do |desc|
12
- @description = desc
13
- assert_equal render_description, ''
14
- end
15
- end
16
-
17
- test '@item' do
18
- @item = Item.new
19
- assert_equal render_description, '<meta name="description" content="item_description" />'
20
- end
21
-
22
- test 'opts' do
23
- assert_equal render_description(description: 'opts'), '<meta name="description" content="opts" />'
24
- end
25
- end
26
-
27
- class HelperSettings
28
- def self.description
29
- 'description'
30
- end
31
- end
32
-
33
- class Item
34
- def description
35
- 'item_description'
36
- end
37
- end
@@ -1,37 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RenderGaClass < ActionView::TestCase
4
- test 'default' do
5
- assert render_ga.include?('ga_code')
6
- end
7
-
8
- test 'with option' do
9
- assert render_ga(ga: '123').include?('123')
10
- end
11
-
12
- test 'with nil' do
13
- assert (render_ga(ga: nil) == '')
14
- end
15
- end
16
-
17
- class HelperSettings
18
- def self.title
19
- 'title'
20
- end
21
-
22
- def self.keywords
23
- 'keywords'
24
- end
25
-
26
- def self.description
27
- 'description'
28
- end
29
-
30
- def self.ga
31
- 'ga_code'
32
- end
33
-
34
- def self.domain
35
- 'domain'
36
- end
37
- end
@@ -1,41 +0,0 @@
1
- # coding: utf-8
2
-
3
- require 'test_helper'
4
-
5
- class RenderKeywordsClass < ActionView::TestCase
6
- test 'simple' do
7
- assert_equal render_keywords, '<meta name="keywords" content="keywords" />'
8
- end
9
-
10
- test '@keywords' do
11
- @keywords = '@keywords'
12
- assert_equal render_keywords, '<meta name="keywords" content="@keywords" />'
13
- @keywords = ['@keywords', ' ', '', nil]
14
- assert_equal render_keywords, '<meta name="keywords" content="@keywords" />'
15
- [' ', '', nil].each do |key|
16
- @keywords = key
17
- assert_equal render_keywords, ''
18
- end
19
- end
20
-
21
- test '@item' do
22
- @item = Item.new
23
- assert_equal render_keywords, '<meta name="keywords" content="item,item_keywords" />'
24
- end
25
-
26
- test 'opts' do
27
- assert_equal render_keywords(keywords: 'opts,a,b,c'), '<meta name="keywords" content="opts,a,b,c" />'
28
- end
29
- end
30
-
31
- class HelperSettings
32
- def self.keywords
33
- 'keywords'
34
- end
35
- end
36
-
37
- class Item
38
- def keywords
39
- 'item,item_keywords'
40
- end
41
- end