commenteux 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +49 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/commenteux/application.js.coffee +72 -0
  6. data/app/controllers/commenteux/application_controller.rb +3 -0
  7. data/app/controllers/commenteux/notes_controller.rb +63 -0
  8. data/app/helpers/commenteux/application_helper.rb +4 -0
  9. data/app/helpers/commenteux/notes_helper.rb +11 -0
  10. data/app/views/commenteux/notes/index.html.erb +31 -0
  11. data/app/views/commenteux/notes/new.html.erb +31 -0
  12. data/config/cucumber.yml +8 -0
  13. data/config/initializers/simple_form.rb +145 -0
  14. data/config/initializers/simple_form_bootstrap.rb +45 -0
  15. data/config/locales/simple_form.en.yml +26 -0
  16. data/config/routes.rb +7 -0
  17. data/lib/commenteux/engine.rb +5 -0
  18. data/lib/commenteux/version.rb +3 -0
  19. data/lib/commenteux.rb +4 -0
  20. data/lib/tasks/cucumber.rake +65 -0
  21. data/lib/tasks/notes_tasks.rake +4 -0
  22. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  23. data/spec/controllers/commenteux/notes_controller_spec.rb +95 -0
  24. data/spec/dummy/README.rdoc +28 -0
  25. data/spec/dummy/Rakefile +6 -0
  26. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  27. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  28. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  30. data/spec/dummy/app/models/comment.rb +15 -0
  31. data/spec/dummy/app/models/dummy_model.rb +3 -0
  32. data/spec/dummy/app/models/user.rb +3 -0
  33. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  34. data/spec/dummy/bin/bundle +3 -0
  35. data/spec/dummy/bin/rails +4 -0
  36. data/spec/dummy/bin/rake +4 -0
  37. data/spec/dummy/config/application.rb +32 -0
  38. data/spec/dummy/config/boot.rb +5 -0
  39. data/spec/dummy/config/database.yml +45 -0
  40. data/spec/dummy/config/environment.rb +5 -0
  41. data/spec/dummy/config/environments/development.rb +29 -0
  42. data/spec/dummy/config/environments/production.rb +80 -0
  43. data/spec/dummy/config/environments/test.rb +36 -0
  44. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  45. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  46. data/spec/dummy/config/initializers/inflections.rb +16 -0
  47. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  48. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  49. data/spec/dummy/config/initializers/session_store.rb +3 -0
  50. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  51. data/spec/dummy/config/locales/en.yml +23 -0
  52. data/spec/dummy/config/routes.rb +5 -0
  53. data/spec/dummy/config.ru +4 -0
  54. data/spec/dummy/db/migrate/20140311235439_create_dummy_models.rb +10 -0
  55. data/spec/dummy/db/migrate/20140312000846_create_comments.rb +20 -0
  56. data/spec/dummy/db/schema.rb +37 -0
  57. data/spec/dummy/log/development.log +3249 -0
  58. data/spec/dummy/log/test.log +1333 -0
  59. data/spec/dummy/public/404.html +58 -0
  60. data/spec/dummy/public/422.html +58 -0
  61. data/spec/dummy/public/500.html +57 -0
  62. data/spec/dummy/public/favicon.ico +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/078e8a1b7bb61498dbae0070239e8f4c +0 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/170c21adaedf3190ec389a68d1eb6151 +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/1957ff8c0d834428d5beca5bf51669b2 +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/6e1da15bffb0094059fbe56ddb206c07 +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/9fbd3d6762f09cbefd55f6775cf9bebe +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/af00b28760a09c0a6fd6fe584cbb839d +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/e03f14f32457f143247847a1d28529eb +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/eaa5f4faca3d7f7b7dd6889cc842471d +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/ec516d6bcfdc219883f1ddb03b5a635b +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  78. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  79. data/spec/dummy/tmp/cache/assets/test/sprockets/170c21adaedf3190ec389a68d1eb6151 +0 -0
  80. data/spec/dummy/tmp/cache/assets/test/sprockets/1957ff8c0d834428d5beca5bf51669b2 +0 -0
  81. data/spec/dummy/tmp/cache/assets/test/sprockets/1961e9a889917e26f9b92f7e3678b9d8 +0 -0
  82. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  83. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  84. data/spec/dummy/tmp/cache/assets/test/sprockets/6e1da15bffb0094059fbe56ddb206c07 +0 -0
  85. data/spec/dummy/tmp/cache/assets/test/sprockets/9fbd3d6762f09cbefd55f6775cf9bebe +0 -0
  86. data/spec/dummy/tmp/cache/assets/test/sprockets/af00b28760a09c0a6fd6fe584cbb839d +0 -0
  87. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  88. data/spec/dummy/tmp/cache/assets/test/sprockets/d72f8bdb1dcb7ea80d1869cb2c6ebbd3 +0 -0
  89. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  90. data/spec/dummy/tmp/cache/assets/test/sprockets/db2a42fb4a2ea58dddbe086ea7cbd8c3 +0 -0
  91. data/spec/dummy/tmp/cache/assets/test/sprockets/e03f14f32457f143247847a1d28529eb +0 -0
  92. data/spec/dummy/tmp/cache/assets/test/sprockets/eaa5f4faca3d7f7b7dd6889cc842471d +0 -0
  93. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  94. data/spec/fabricators/dummy_models_fabricator.rb +3 -0
  95. data/spec/helpers/commenteux/notes_helper_spec.rb +15 -0
  96. data/spec/spec_helper.rb +48 -0
  97. metadata +271 -0
@@ -0,0 +1,95 @@
1
+ require 'spec_helper'
2
+
3
+ module Commenteux
4
+ describe NotesController do
5
+ routes { Commenteux::Engine.routes }
6
+
7
+ before(:each) do
8
+ @dummy_model = mock_model(DummyModel)
9
+ @comments = double(Object)
10
+ end
11
+
12
+ describe "GET 'index'" do
13
+
14
+ it "doit fetché la ressource passé en paramètre, le layout de l'application hôte sera utilisé" do
15
+
16
+ DummyModel.should_receive(:find).with('1').and_return(@dummy_model)
17
+ @dummy_model.stub(:comments) { @comments }
18
+ @comments.stub(:all) { [] }
19
+ get 'index', 'resource' => 'dummy_model', 'resource_id' => '1'
20
+
21
+ assert_template layout: 'application'
22
+
23
+ end
24
+
25
+ it "si l'appel provient d'un call Ajax, on n'affiche pas de layout" do
26
+
27
+ DummyModel.should_receive(:find).with('1').and_return(@dummy_model)
28
+ @dummy_model.stub(:comments) { @comments }
29
+ @comments.stub(:all) { [] }
30
+ xhr :get, 'index', 'resource' => 'dummy_model', 'resource_id' => '1'
31
+
32
+ assert_template layout: false
33
+
34
+ end
35
+
36
+ end
37
+
38
+ describe "GET 'new'" do
39
+
40
+ it "doit fetché la ressource en paramètre et préparé le nouveau commentaire a saisir, le layout de l'application hôte sera utilisé" do
41
+
42
+ subject.should_receive(:fetch_resource).and_return(@dummy_model)
43
+ @dummy_model.stub(:comments) { @comments }
44
+ @comments.should_receive(:new)
45
+
46
+ get 'new', 'resource' => 'dummy_model', 'resource_id' => '1'
47
+
48
+ assert_template layout: 'application'
49
+
50
+ end
51
+
52
+ it "si l'appel provient d'un call Ajax, on n'affiche pas de layout" do
53
+
54
+ subject.should_receive(:fetch_resource).and_return(@dummy_model)
55
+ @dummy_model.stub(:comments) { @comments }
56
+ @comments.should_receive(:new)
57
+
58
+ xhr :get, 'new', 'resource' => 'dummy_model', 'resource_id' => '1'
59
+
60
+ assert_template layout: false
61
+
62
+ end
63
+
64
+ end
65
+
66
+ describe "POST 'create'" do
67
+
68
+ it "Doit créer le commentaire saisi sur la ressource en paramètre" do
69
+
70
+ DummyModel.should_receive(:find).with('1').and_return(@dummy_model)
71
+ @dummy_model.stub(:comments) { @comments }
72
+ @comments.should_receive(:create).with( { 'title' => 'Titre', 'comment' => 'Commentaire'} )
73
+
74
+ post 'create', 'resource' => 'dummy_model', 'resource_id' => '1', 'parent_div' => 'parent_div', :comments => { :title => 'Titre', :comment => 'Commentaire'}
75
+
76
+ end
77
+
78
+ end
79
+
80
+ describe "Comportement de la méthode 'classify_namespace'" do
81
+
82
+ it "s'il n'y a pas de namespace, on fait un simple classify" do
83
+ subject.classify_namespace('dummy_model').should eq 'DummyModel'
84
+ subject.classify_namespace('customer').should eq 'Customer'
85
+ end
86
+
87
+ it "s'il y a un namespace, on fait un classify sur tous les éléments" do
88
+ subject.classify_namespace('client::customers').should eq 'Client::Customer'
89
+ subject.classify_namespace('namespace::dummy_model').should eq 'Namespace::DummyModel'
90
+ end
91
+
92
+ end
93
+
94
+ end
95
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
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
+
6
+ Dummy::Application.load_tasks
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,15 @@
1
+ class Comment < ActiveRecord::Base
2
+
3
+ include ActsAsCommentable::Comment
4
+
5
+ belongs_to :commentable, :polymorphic => true
6
+
7
+ default_scope -> { order('created_at ASC') }
8
+
9
+ # NOTE: install the acts_as_votable plugin if you
10
+ # want user to vote on the quality of comments.
11
+ #acts_as_voteable
12
+
13
+ # NOTE: Comments belong to a user
14
+ belongs_to :user
15
+ end
@@ -0,0 +1,3 @@
1
+ class DummyModel < ActiveRecord::Base
2
+ acts_as_commentable
3
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6
+ <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "commenteux"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+
11
+ config.generators do |g|
12
+
13
+ g.test_framework :rspec
14
+ g.view_specs false
15
+ g.helper_specs false
16
+
17
+ end
18
+
19
+ # Settings in config/environments/* take precedence over those specified here.
20
+ # Application configuration should go into files in config/initializers
21
+ # -- all .rb files in that directory are automatically loaded.
22
+
23
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
24
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
25
+ # config.time_zone = 'Central Time (US & Canada)'
26
+
27
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
28
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
29
+ # config.i18n.default_locale = :de
30
+ end
31
+ end
32
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,45 @@
1
+ # MySQL. Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MYSQL driver
4
+ # gem install mysql2
5
+ #
6
+ # Ensure the MySQL gem is defined in your Gemfile
7
+ # gem 'mysql2'
8
+ #
9
+ # And be sure to use new-style password hashing:
10
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
11
+ development:
12
+ adapter: mysql2
13
+ encoding: utf8
14
+ reconnect: false
15
+ database: notes_dummy_bd_development
16
+ pool: 5
17
+ username: root
18
+ password:
19
+ host: localhost
20
+
21
+ # Warning: The database defined as "test" will be erased and
22
+ # re-generated from your development database when you run "rake".
23
+ # Do not set this db to the same as development or production.
24
+ test: &test
25
+ adapter: mysql2
26
+ encoding: utf8
27
+ reconnect: false
28
+ database: notes_dummy_bd_test
29
+ pool: 5
30
+ username: root
31
+ password:
32
+ host: localhost
33
+
34
+ production:
35
+ adapter: mysql2
36
+ encoding: utf8
37
+ reconnect: false
38
+ database: notes_dummy_bd_development
39
+ pool: 5
40
+ username: root
41
+ password:
42
+ host: localhost
43
+
44
+ cucumber:
45
+ <<: *test
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!
@@ -0,0 +1,29 @@
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 web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end
@@ -0,0 +1,80 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js.coffee, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end
@@ -0,0 +1,36 @@
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
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Print deprecation notices to the stderr.
35
+ config.active_support.deprecation = :stderr
36
+ end
@@ -0,0 +1,7 @@
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!
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ Dummy::Application.config.secret_key_base = 'c93695ce568fe43950173cc67bd59911be61b8cb2b5c86c38ccfe4de90fd8e7e3e1ac20c73740abd63ecb2fa4c4c6e2d49b1da17a6ef7b24e57ed8151d12692b'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount Commenteux::Engine => "/"
4
+
5
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,10 @@
1
+ class CreateDummyModels < ActiveRecord::Migration
2
+ def change
3
+ create_table :dummy_models do |t|
4
+
5
+ t.text :text
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ class CreateComments < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :comments do |t|
4
+ t.string :title, :limit => 50, :default => ""
5
+ t.text :comment
6
+ t.references :commentable, :polymorphic => true
7
+ t.references :user
8
+ t.string :role, :default => "comments"
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :comments, :commentable_type
13
+ add_index :comments, :commentable_id
14
+ add_index :comments, :user_id
15
+ end
16
+
17
+ def self.down
18
+ drop_table :comments
19
+ end
20
+ end
@@ -0,0 +1,37 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140312000846) do
15
+
16
+ create_table "comments", force: true do |t|
17
+ t.string "title", limit: 50, default: ""
18
+ t.text "comment"
19
+ t.integer "commentable_id"
20
+ t.string "commentable_type"
21
+ t.integer "user_id"
22
+ t.string "role", default: "comments"
23
+ t.datetime "created_at"
24
+ t.datetime "updated_at"
25
+ end
26
+
27
+ add_index "comments", ["commentable_id"], name: "index_comments_on_commentable_id", using: :btree
28
+ add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type", using: :btree
29
+ add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
30
+
31
+ create_table "dummy_models", force: true do |t|
32
+ t.text "text"
33
+ t.datetime "created_at"
34
+ t.datetime "updated_at"
35
+ end
36
+
37
+ end