draper 4.0.2 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -2
  3. data/CHANGELOG.md +24 -0
  4. data/README.md +26 -7
  5. data/lib/draper/automatic_delegation.rb +14 -4
  6. data/lib/draper/collection_decorator.rb +0 -6
  7. data/lib/draper/compatibility/broadcastable.rb +24 -0
  8. data/lib/draper/compatibility/global_id.rb +9 -5
  9. data/lib/draper/decoratable/collection_proxy.rb +15 -0
  10. data/lib/draper/decoratable.rb +7 -2
  11. data/lib/draper/decorator.rb +2 -18
  12. data/lib/draper/query_methods.rb +1 -1
  13. data/lib/draper/railtie.rb +14 -5
  14. data/lib/draper/version.rb +1 -1
  15. data/lib/draper/view_context/build_strategy.rb +1 -9
  16. data/lib/draper.rb +0 -6
  17. metadata +16 -235
  18. data/.github/PULL_REQUEST_TEMPLATE.md +0 -24
  19. data/.github/workflows/ci.yml +0 -55
  20. data/.gitignore +0 -18
  21. data/Gemfile +0 -24
  22. data/bin/bundle +0 -114
  23. data/bin/rake +0 -29
  24. data/draper.gemspec +0 -34
  25. data/spec/draper/collection_decorator_spec.rb +0 -291
  26. data/spec/draper/configuration_spec.rb +0 -49
  27. data/spec/draper/decoratable/equality_spec.rb +0 -10
  28. data/spec/draper/decoratable_spec.rb +0 -235
  29. data/spec/draper/decorated_association_spec.rb +0 -82
  30. data/spec/draper/decorates_assigned_spec.rb +0 -71
  31. data/spec/draper/decorator_spec.rb +0 -872
  32. data/spec/draper/draper_spec.rb +0 -25
  33. data/spec/draper/factory_spec.rb +0 -247
  34. data/spec/draper/finders_spec.rb +0 -166
  35. data/spec/draper/helper_proxy_spec.rb +0 -61
  36. data/spec/draper/lazy_helpers_spec.rb +0 -21
  37. data/spec/draper/query_methods/load_strategy_spec.rb +0 -26
  38. data/spec/draper/query_methods_spec.rb +0 -70
  39. data/spec/draper/undecorate_chain_spec.rb +0 -20
  40. data/spec/draper/undecorate_spec.rb +0 -19
  41. data/spec/draper/view_context/build_strategy_spec.rb +0 -132
  42. data/spec/draper/view_context_spec.rb +0 -182
  43. data/spec/draper/view_helpers_spec.rb +0 -8
  44. data/spec/dummy/.rspec +0 -2
  45. data/spec/dummy/Rakefile +0 -7
  46. data/spec/dummy/app/assets/config/manifest.js +0 -3
  47. data/spec/dummy/app/controllers/application_controller.rb +0 -2
  48. data/spec/dummy/app/controllers/base_controller.rb +0 -4
  49. data/spec/dummy/app/controllers/localized_urls.rb +0 -5
  50. data/spec/dummy/app/controllers/posts_controller.rb +0 -20
  51. data/spec/dummy/app/decorators/mongoid_post_decorator.rb +0 -4
  52. data/spec/dummy/app/decorators/post_decorator.rb +0 -60
  53. data/spec/dummy/app/helpers/application_helper.rb +0 -5
  54. data/spec/dummy/app/jobs/publish_post_job.rb +0 -7
  55. data/spec/dummy/app/mailers/application_mailer.rb +0 -3
  56. data/spec/dummy/app/mailers/post_mailer.rb +0 -19
  57. data/spec/dummy/app/models/admin.rb +0 -5
  58. data/spec/dummy/app/models/application_record.rb +0 -3
  59. data/spec/dummy/app/models/mongoid_post.rb +0 -5
  60. data/spec/dummy/app/models/post.rb +0 -3
  61. data/spec/dummy/app/models/user.rb +0 -5
  62. data/spec/dummy/app/views/layouts/application.html.erb +0 -11
  63. data/spec/dummy/app/views/post_mailer/decorated_email.html.erb +0 -1
  64. data/spec/dummy/app/views/posts/_post.html.erb +0 -42
  65. data/spec/dummy/app/views/posts/show.html.erb +0 -1
  66. data/spec/dummy/bin/rails +0 -4
  67. data/spec/dummy/config/application.rb +0 -68
  68. data/spec/dummy/config/boot.rb +0 -5
  69. data/spec/dummy/config/database.yml +0 -25
  70. data/spec/dummy/config/environment.rb +0 -5
  71. data/spec/dummy/config/environments/development.rb +0 -35
  72. data/spec/dummy/config/environments/production.rb +0 -59
  73. data/spec/dummy/config/environments/test.rb +0 -35
  74. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  75. data/spec/dummy/config/initializers/draper.rb +0 -3
  76. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  77. data/spec/dummy/config/initializers/inflections.rb +0 -15
  78. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  79. data/spec/dummy/config/initializers/secret_token.rb +0 -8
  80. data/spec/dummy/config/initializers/session_store.rb +0 -8
  81. data/spec/dummy/config/locales/en.yml +0 -5
  82. data/spec/dummy/config/mongoid.yml +0 -142
  83. data/spec/dummy/config/routes.rb +0 -9
  84. data/spec/dummy/config/storage.yml +0 -7
  85. data/spec/dummy/config.ru +0 -4
  86. data/spec/dummy/db/migrate/20121019115657_create_posts.rb +0 -8
  87. data/spec/dummy/db/schema.rb +0 -21
  88. data/spec/dummy/db/seeds.rb +0 -2
  89. data/spec/dummy/fast_spec/post_decorator_spec.rb +0 -37
  90. data/spec/dummy/lib/tasks/test.rake +0 -16
  91. data/spec/dummy/log/.gitkeep +0 -0
  92. data/spec/dummy/public/404.html +0 -26
  93. data/spec/dummy/public/422.html +0 -26
  94. data/spec/dummy/public/500.html +0 -25
  95. data/spec/dummy/public/favicon.ico +0 -0
  96. data/spec/dummy/script/rails +0 -6
  97. data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +0 -12
  98. data/spec/dummy/spec/decorators/devise_spec.rb +0 -55
  99. data/spec/dummy/spec/decorators/helpers_spec.rb +0 -21
  100. data/spec/dummy/spec/decorators/post_decorator_spec.rb +0 -64
  101. data/spec/dummy/spec/decorators/spec_type_spec.rb +0 -7
  102. data/spec/dummy/spec/decorators/view_context_spec.rb +0 -22
  103. data/spec/dummy/spec/jobs/publish_post_job_spec.rb +0 -9
  104. data/spec/dummy/spec/mailers/post_mailer_spec.rb +0 -25
  105. data/spec/dummy/spec/models/application_spec.rb +0 -7
  106. data/spec/dummy/spec/models/mongoid_post_spec.rb +0 -8
  107. data/spec/dummy/spec/models/post_spec.rb +0 -15
  108. data/spec/dummy/spec/shared_examples/decoratable.rb +0 -22
  109. data/spec/dummy/spec/spec_helper.rb +0 -8
  110. data/spec/dummy/test/decorators/minitest/devise_test.rb +0 -55
  111. data/spec/dummy/test/decorators/minitest/helpers_test.rb +0 -21
  112. data/spec/dummy/test/decorators/minitest/spec_type_test.rb +0 -52
  113. data/spec/dummy/test/decorators/minitest/view_context_test.rb +0 -24
  114. data/spec/dummy/test/decorators/test_unit/devise_test.rb +0 -55
  115. data/spec/dummy/test/decorators/test_unit/helpers_test.rb +0 -21
  116. data/spec/dummy/test/decorators/test_unit/view_context_test.rb +0 -24
  117. data/spec/dummy/test/minitest_helper.rb +0 -2
  118. data/spec/dummy/test/test_helper.rb +0 -3
  119. data/spec/generators/controller/controller_generator_spec.rb +0 -23
  120. data/spec/generators/decorator/decorator_generator_spec.rb +0 -93
  121. data/spec/generators/install/install_generator_spec.rb +0 -19
  122. data/spec/integration/integration_spec.rb +0 -70
  123. data/spec/performance/active_record.rb +0 -4
  124. data/spec/performance/benchmark.rb +0 -55
  125. data/spec/performance/decorators.rb +0 -45
  126. data/spec/performance/models.rb +0 -20
  127. data/spec/spec_helper.rb +0 -50
  128. data/spec/support/dummy_app.rb +0 -85
  129. data/spec/support/matchers/have_text.rb +0 -50
  130. data/spec/support/shared_examples/decoratable_equality.rb +0 -40
  131. data/spec/support/shared_examples/view_helpers.rb +0 -39
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- 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,35 +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 web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Show full error reports and disable caching
10
- config.consider_all_requests_local = true
11
- config.action_controller.perform_caching = false
12
-
13
- # Print deprecation notices to the Rails logger
14
- config.active_support.deprecation = :log
15
-
16
- # Only use best-standards-support built into browsers
17
- config.action_dispatch.best_standards_support = :builtin
18
-
19
- config.eager_load = false
20
-
21
- # Raise exception on mass assignment protection for Active Record models
22
- # config.active_record.mass_assignment_sanitizer = :strict
23
-
24
- # Log the query plan for queries taking more than this (works
25
- # with SQLite, MySQL, and PostgreSQL)
26
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
27
-
28
- # Do not compress assets
29
- # config.assets.compress = false
30
-
31
- # Expands the lines which load the assets
32
- # config.assets.debug = true
33
-
34
- config.active_storage.service = :local
35
- end
@@ -1,59 +0,0 @@
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
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
13
-
14
- config.eager_load = true
15
-
16
- # Defaults to nil and saved in location specified by config.assets.prefix
17
- # config.assets.manifest = YOUR_PATH
18
-
19
- # Specifies the header that your server uses for sending files
20
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
21
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
22
-
23
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
24
- # config.force_ssl = true
25
-
26
- # See everything in the log (default is :info)
27
- # config.log_level = :debug
28
-
29
- # Prepend all log lines with the following tags
30
- # config.log_tags = [ :subdomain, :uuid ]
31
-
32
- # Use a different logger for distributed setups
33
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
34
-
35
- # Use a different cache store in production
36
- # config.cache_store = :mem_cache_store
37
-
38
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
39
- # config.action_controller.asset_host = "http://assets.example.com"
40
-
41
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
42
- # config.assets.precompile += %w( search.js )
43
-
44
- # Enable threaded mode
45
- # config.threadsafe!
46
-
47
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
48
- # the I18n.default_locale when a translation can not be found)
49
- config.i18n.fallbacks = true
50
-
51
- # Send deprecation notices to registered listeners
52
- config.active_support.deprecation = :notify
53
-
54
- # Log the query plan for queries taking more than this (works
55
- # with SQLite, MySQL, and PostgreSQL)
56
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
57
-
58
- config.active_storage.service = :local
59
- end
@@ -1,35 +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
- # Configure static asset server for tests with Cache-Control for performance
11
- # config.serve_static_assets = true
12
- # config.static_cache_control = "public, max-age=3600"
13
-
14
- # Show full error reports and disable caching
15
- config.consider_all_requests_local = true
16
- config.action_controller.perform_caching = false
17
-
18
- # Raise exceptions instead of rendering exception templates
19
- config.action_dispatch.show_exceptions = false
20
-
21
- # Disable request forgery protection in test environment
22
- config.action_controller.allow_forgery_protection = false
23
-
24
- # Raise exception on mass assignment protection for Active Record models
25
- # config.active_record.mass_assignment_sanitizer = :strict
26
-
27
- # Print deprecation notices to the stderr
28
- config.active_support.deprecation = :stderr
29
-
30
- config.eager_load = false
31
-
32
- config.active_job.queue_adapter = :test
33
-
34
- config.active_storage.service = :test
35
- 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,3 +0,0 @@
1
- Draper.configure do |config|
2
- config.default_controller = BaseController
3
- end
@@ -1,4 +0,0 @@
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]
@@ -1,15 +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
11
- #
12
- # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
- # inflect.acronym 'RESTful'
15
- # 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,8 +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_key_base = 'c2e3474d3816f60bf6dd0f3b983e7283c7ff5373e11a96935340b544a31964dbe5ee077136165ee2975e0005f5e80207c0059e6d5589699031242ba5a06dcb87'
8
- Dummy::Application.config.secret_token = 'c2e3474d3816f60bf6dd0f3b983e7283c7ff5373e11a96935340b544a31964dbe5ee077136165ee2975e0005f5e80207c0059e6d5589699031242ba5a06dcb87'
@@ -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 https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,142 +0,0 @@
1
- development:
2
- # Configure available database clients. (required)
3
- clients:
4
- # Defines the default client. (required)
5
- default:
6
- # Defines the name of the default database that Mongoid can connect to.
7
- # (required).
8
- database: dummy_development
9
- # Provides the hosts the default client can connect to. Must be an array
10
- # of host:port pairs. (required)
11
- hosts:
12
- - localhost:27017
13
- options:
14
- # Change the default write concern. (default = { w: 1 })
15
- # write:
16
- # w: 1
17
-
18
- # Change the default read preference. Valid options for mode are: :secondary,
19
- # :secondary_preferred, :primary, :primary_preferred, :nearest
20
- # (default: primary)
21
- # read:
22
- # mode: :secondary_preferred
23
- # tag_sets:
24
- # - use: web
25
-
26
- # The name of the user for authentication.
27
- # user: 'user'
28
-
29
- # The password of the user for authentication.
30
- # password: 'password'
31
-
32
- # The user's database roles.
33
- # roles:
34
- # - 'dbOwner'
35
-
36
- # Change the default authentication mechanism. Valid options are: :scram,
37
- # :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default
38
- # on 2.4 and 2.6 is :plain)
39
- # auth_mech: :scram
40
-
41
- # The database or source to authenticate the user against. (default: admin)
42
- # auth_source: admin
43
-
44
- # Force a the driver cluster to behave in a certain manner instead of auto-
45
- # discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
46
- # when connecting to hidden members of a replica set.
47
- # connect: :direct
48
-
49
- # Changes the default time in seconds the server monitors refresh their status
50
- # via ismaster commands. (default: 10)
51
- # heartbeat_frequency: 10
52
-
53
- # The time in seconds for selecting servers for a near read preference. (default: 5)
54
- # local_threshold: 5
55
-
56
- # The timeout in seconds for selecting a server for an operation. (default: 30)
57
- # server_selection_timeout: 30
58
-
59
- # The maximum number of connections in the connection pool. (default: 5)
60
- # max_pool_size: 5
61
-
62
- # The minimum number of connections in the connection pool. (default: 1)
63
- # min_pool_size: 1
64
-
65
- # The time to wait, in seconds, in the connection pool for a connection
66
- # to be checked in before timing out. (default: 5)
67
- # wait_queue_timeout: 5
68
-
69
- # The time to wait to establish a connection before timing out, in seconds.
70
- # (default: 5)
71
- # connect_timeout: 5
72
-
73
- # The timeout to wait to execute operations on a socket before raising an error.
74
- # (default: 5)
75
- # socket_timeout: 5
76
-
77
- # The name of the replica set to connect to. Servers provided as seeds that do
78
- # not belong to this replica set will be ignored.
79
- # replica_set: name
80
-
81
- # Whether to connect to the servers via ssl. (default: false)
82
- # ssl: true
83
-
84
- # The certificate file used to identify the connection against MongoDB.
85
- # ssl_cert: /path/to/my.cert
86
-
87
- # The private keyfile used to identify the connection against MongoDB.
88
- # Note that even if the key is stored in the same file as the certificate,
89
- # both need to be explicitly specified.
90
- # ssl_key: /path/to/my.key
91
-
92
- # A passphrase for the private key.
93
- # ssl_key_pass_phrase: password
94
-
95
- # Whether or not to do peer certification validation. (default: true)
96
- # ssl_verify: true
97
-
98
- # The file containing a set of concatenated certification authority certifications
99
- # used to validate certs passed from the other end of the connection.
100
- # ssl_ca_cert: /path/to/ca.cert
101
-
102
-
103
- # Configure Mongoid specific options. (optional)
104
- options:
105
- # Includes the root model name in json serialization. (default: false)
106
- # include_root_in_json: false
107
-
108
- # Include the _type field in serialization. (default: false)
109
- # include_type_for_serialization: false
110
-
111
- # Preload all models in development, needed when models use
112
- # inheritance. (default: false)
113
- # preload_models: false
114
-
115
- # Raise an error when performing a #find and the document is not found.
116
- # (default: true)
117
- # raise_not_found_error: true
118
-
119
- # Raise an error when defining a scope with the same name as an
120
- # existing method. (default: false)
121
- # scope_overwrite_exception: false
122
-
123
- # Use Active Support's time zone in conversions. (default: true)
124
- # use_activesupport_time_zone: true
125
-
126
- # Ensure all times are UTC in the app side. (default: false)
127
- # use_utc: false
128
-
129
- # Set the Mongoid and Ruby driver log levels when not in a Rails
130
- # environment. The Mongoid logger will be set to the Rails logger
131
- # otherwise.(default: :info)
132
- # log_level: :info
133
- test:
134
- clients:
135
- default:
136
- database: dummy_test
137
- hosts:
138
- - localhost:27017
139
- options:
140
- read:
141
- mode: :primary
142
- max_pool_size: 1
@@ -1,9 +0,0 @@
1
- Dummy::Application.routes.draw do
2
- scope "(:locale)", locale: /en|zh/ do
3
- resources :posts, only: [:show] do
4
- get "mail", on: :member
5
- end
6
- end
7
-
8
- devise_for :users, :admins if defined?(Devise)
9
- end
@@ -1,7 +0,0 @@
1
- test:
2
- service: Disk
3
- root: <%= Rails.root.join("tmp/storage") %>
4
-
5
- local:
6
- service: Disk
7
- root: <%= Rails.root.join("storage") %>
data/spec/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,8 +0,0 @@
1
- class CreatePosts < ActiveRecord::Migration[4.2]
2
- def change
3
- create_table :posts do |t|
4
-
5
- t.timestamps
6
- end
7
- end
8
- end
@@ -1,21 +0,0 @@
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 to check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20121019115657) do
15
-
16
- create_table "posts", force: true do |t|
17
- t.datetime "created_at", null: false
18
- t.datetime "updated_at", null: false
19
- end
20
-
21
- end
@@ -1,2 +0,0 @@
1
- Post.delete_all
2
- Post.create id: 1
@@ -1,37 +0,0 @@
1
- require 'draper'
2
-
3
- require 'active_model/naming'
4
- require_relative '../app/decorators/post_decorator'
5
-
6
- Draper::ViewContext.test_strategy :fast
7
-
8
- Post = Struct.new(:id) { extend ActiveModel::Naming }
9
-
10
- describe PostDecorator do
11
- let(:decorator) { PostDecorator.new(object) }
12
- let(:object) { Post.new(42) }
13
-
14
- it "can use built-in helpers" do
15
- expect(decorator.truncated).to eq "Once upon a..."
16
- end
17
-
18
- it "can use built-in private helpers" do
19
- expect(decorator.html_escaped).to eq "&lt;script&gt;danger&lt;/script&gt;"
20
- end
21
-
22
- it "can't use user-defined helpers from app/helpers" do
23
- expect{decorator.hello_world}.to raise_error NoMethodError, /hello_world/
24
- end
25
-
26
- it "can't use path helpers" do
27
- expect{decorator.path_with_model}.to raise_error NoMethodError, /post_path/
28
- end
29
-
30
- it "can't use url helpers" do
31
- expect{decorator.url_with_model}.to raise_error NoMethodError, /post_url/
32
- end
33
-
34
- it "can't be passed implicitly to url_for" do
35
- expect{decorator.link}.to raise_error ArgumentError
36
- end
37
- end
@@ -1,16 +0,0 @@
1
- require 'rake/testtask'
2
- require 'rspec/core/rake_task'
3
-
4
- Rake::Task[:test].clear
5
- Rake::TestTask.new :test do |t|
6
- t.libs << "test"
7
- t.pattern = "test/**/*_test.rb"
8
- end
9
-
10
- RSpec::Core::RakeTask.new :spec
11
-
12
- RSpec::Core::RakeTask.new :fast_spec do |t|
13
- t.pattern = "fast_spec/**/*_spec.rb"
14
- end
15
-
16
- task default: [:test, :spec, :fast_spec]
File without changes
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</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/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
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>
@@ -1,25 +0,0 @@
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
@@ -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,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Draper::CollectionDecorator do
4
- describe "#active_model_serializer" do
5
- it "returns ActiveModel::Serializer::CollectionSerializer" do
6
- collection_decorator = Draper::CollectionDecorator.new([])
7
- collection_serializer = ActiveModel::Serializer.serializer_for(collection_decorator)
8
-
9
- expect(collection_serializer).to be ActiveModel::Serializer::CollectionSerializer
10
- end
11
- end
12
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- if defined?(Devise)
4
- describe "A decorator spec" do
5
- it "can sign in a real user" do
6
- user = User.new
7
- sign_in user
8
-
9
- expect(helper.current_user).to be user
10
- end
11
-
12
- it "can sign in a mock user" do
13
- user = double("User")
14
- sign_in :user, user
15
-
16
- expect(helper.current_user).to be user
17
- end
18
-
19
- it "can sign in a real admin" do
20
- admin = Admin.new
21
- sign_in admin
22
-
23
- expect(helper.current_admin).to be admin
24
- end
25
-
26
- it "can sign in a mock admin" do
27
- admin = double("Admin")
28
- sign_in :admin, admin
29
-
30
- expect(helper.current_admin).to be admin
31
- end
32
-
33
- it "can sign out a real user" do
34
- user = User.new
35
- sign_in user
36
- sign_out user
37
-
38
- expect(helper.current_user).to be_nil
39
- end
40
-
41
- it "can sign out a mock user" do
42
- user = double("User")
43
- sign_in :user, user
44
- sign_out :user
45
-
46
- expect(helper.current_user).to be_nil
47
- end
48
-
49
- it "can sign out without a user" do
50
- sign_out :user
51
-
52
- expect(helper.current_user).to be_nil
53
- end
54
- end
55
- end