7 |
8 |
9 |
10 | <%= link_to 'create (raw)', new_note_path(kind: 'raw') %>
11 | <%= link_to 'create (builder)', new_note_path(kind: 'builder') %>
12 | <%= link_to 'create (simple form)', new_note_path(kind: 'simple_form') %>
13 | <%= link_to 'create (no javascript)', new_note_path(kind: 'nojs') %>
14 |
--------------------------------------------------------------------------------
/spec/dummy/app/views/notes/new.html.erb:
--------------------------------------------------------------------------------
1 | <%= render "form_#{params[:kind]}", note: @note %>
2 |
--------------------------------------------------------------------------------
/spec/dummy/config.ru:
--------------------------------------------------------------------------------
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
5 |
--------------------------------------------------------------------------------
/spec/dummy/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | Bundler.require :default, ATTACHINARY_ORM
6 |
7 | begin
8 | require "#{ATTACHINARY_ORM}/railtie"
9 | rescue LoadError
10 | end
11 |
12 | require "attachinary"
13 |
14 | module Dummy
15 | class Application < Rails::Application
16 | # Settings in config/environments/* take precedence over those specified here.
17 | # Application configuration should go into files in config/initializers
18 | # -- all .rb files in that directory are automatically loaded.
19 |
20 | # Custom directories with classes and modules you want to be autoloadable.
21 | # config.autoload_paths += %W(#{config.root}/extras)
22 | config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
23 | config.autoload_paths += [ "#{config.root}/app/#{ATTACHINARY_ORM}" ]
24 |
25 | # Only load the plugins named here, in the order given (default is alphabetical).
26 | # :all can be used as a placeholder for all plugins not explicitly named.
27 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
28 |
29 | # Activate observers that should always be running.
30 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
31 |
32 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
33 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
34 | # config.time_zone = 'Central Time (US & Canada)'
35 |
36 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
37 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
38 | # config.i18n.default_locale = :de
39 |
40 | # Configure the default encoding used in templates for Ruby 1.9.
41 | config.encoding = "utf-8"
42 |
43 | config.eager_load = true
44 |
45 | # Configure sensitive parameters which will be filtered from the log file.
46 | config.filter_parameters += [:password]
47 |
48 | # Enable escaping HTML in JSON.
49 | config.active_support.escape_html_entities_in_json = true
50 |
51 | # Use SQL instead of Active Record's schema dumper when creating the database.
52 | # This is necessary if your schema can't be completely dumped by the schema dumper,
53 | # like if you have constraints or database-specific column types
54 | # config.active_record.schema_format = :sql
55 |
56 | if Rails::VERSION::MAJOR == 3
57 | config.active_record.whitelist_attributes = true
58 | end
59 |
60 | # Enable the asset pipeline
61 | config.assets.enabled = true
62 |
63 | # Version of your assets, change this if you want to expire all your assets
64 | config.assets.version = '1.0'
65 |
66 | config.secret_key_base = 'xxx'
67 |
68 | I18n.enforce_available_locales = false
69 | end
70 | end
71 |
72 |
--------------------------------------------------------------------------------
/spec/dummy/config/boot.rb:
--------------------------------------------------------------------------------
1 | unless defined?(ATTACHINARY_ORM)
2 | ATTACHINARY_ORM = (ENV["ATTACHINARY_ORM"] || :active_record).to_sym
3 | end
4 |
5 | require 'rubygems'
6 | # Set up gems listed in the Gemfile.
7 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
8 |
9 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
10 |
--------------------------------------------------------------------------------
/spec/dummy/config/cloudinary.yml.example:
--------------------------------------------------------------------------------
1 | default: &default
2 | enhance_image_tag: true
3 | static_image_support: true
4 | cdn_subdomain: true
5 | secure_distribution: false
6 | private_cdn: false
7 | cloud_name: zogash
8 | api_key: 'xxx'
9 | api_secret: xxx
10 |
11 | development:
12 | <<: *default
13 |
14 | test:
15 | <<: *default
16 |
--------------------------------------------------------------------------------
/spec/dummy/config/database.yml:
--------------------------------------------------------------------------------
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
26 |
--------------------------------------------------------------------------------
/spec/dummy/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the rails application
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the rails application
5 | Dummy::Application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/development.rb:
--------------------------------------------------------------------------------
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 | # Don't care if the mailer can't send
14 | config.action_mailer.raise_delivery_errors = false
15 |
16 | # Print deprecation notices to the Rails logger
17 | config.active_support.deprecation = :log
18 |
19 | # Only use best-standards-support built into browsers
20 | config.action_dispatch.best_standards_support = :builtin
21 |
22 | if Rails::VERSION::MAJOR == 3
23 | config.active_record.mass_assignment_sanitizer = :strict
24 | end
25 |
26 | # Do not compress assets
27 | config.assets.compress = false
28 |
29 | # Expands the lines which load the assets
30 | config.assets.debug = true
31 |
32 | config.eager_load = false
33 | end
34 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/production.rb:
--------------------------------------------------------------------------------
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 | # Compress JavaScripts and CSS
15 | config.assets.compress = true
16 |
17 | # Don't fallback to assets pipeline if a precompiled asset is missed
18 | config.assets.compile = false
19 |
20 | # Generate digests for assets URLs
21 | config.assets.digest = true
22 |
23 | # Defaults to nil and saved in location specified by config.assets.prefix
24 | # config.assets.manifest = YOUR_PATH
25 |
26 | # Specifies the header that your server uses for sending files
27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29 |
30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31 | # config.force_ssl = true
32 |
33 | # See everything in the log (default is :info)
34 | # config.log_level = :debug
35 |
36 | # Prepend all log lines with the following tags
37 | # config.log_tags = [ :subdomain, :uuid ]
38 |
39 | # Use a different logger for distributed setups
40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41 |
42 | # Use a different cache store in production
43 | # config.cache_store = :mem_cache_store
44 |
45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server
46 | # config.action_controller.asset_host = "http://assets.example.com"
47 |
48 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49 | # config.assets.precompile += %w( search.js )
50 |
51 | # Disable delivery errors, bad email addresses will be ignored
52 | # config.action_mailer.raise_delivery_errors = false
53 |
54 | # Enable threaded mode
55 | # config.threadsafe!
56 |
57 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58 | # the I18n.default_locale when a translation can not be found)
59 | config.i18n.fallbacks = true
60 |
61 | # Send deprecation notices to registered listeners
62 | config.active_support.deprecation = :notify
63 | end
64 |
--------------------------------------------------------------------------------
/spec/dummy/config/environments/test.rb:
--------------------------------------------------------------------------------
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 | # Tell Action Mailer not to deliver emails to the real world.
25 | # The :test delivery method accumulates sent emails in the
26 | # ActionMailer::Base.deliveries array.
27 | config.action_mailer.delivery_method = :test
28 |
29 | if Rails::VERSION::MAJOR == 3
30 | config.active_record.mass_assignment_sanitizer = :strict
31 | end
32 |
33 | # Print deprecation notices to the stderr
34 | config.active_support.deprecation = :stderr
35 |
36 | config.eager_load = false
37 | end
38 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/attachinary.rb:
--------------------------------------------------------------------------------
1 | require "attachinary/orm/#{ATTACHINARY_ORM}"
2 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
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!
8 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
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
16 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
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
6 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
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 = 'f183aecf8ec1f4324366308b34353d5e40beaca43b38dd65b122cdced57debe3e611d14aa40d6c654ce9c5311f31aee580d5b1f39debaad9430e09aafb1ec8c5'
8 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
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
9 |
--------------------------------------------------------------------------------
/spec/dummy/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
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]
9 | end
10 |
11 | # Disable root element in JSON by default.
12 | ActiveSupport.on_load(:active_record) do
13 | self.include_root_in_json = false
14 | end
15 |
--------------------------------------------------------------------------------
/spec/dummy/config/locales/en.yml:
--------------------------------------------------------------------------------
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"
6 |
--------------------------------------------------------------------------------
/spec/dummy/config/mongoid.yml:
--------------------------------------------------------------------------------
1 | development:
2 | # Configure available database sessions. (required)
3 | sessions:
4 | # Defines the default session. (required)
5 | default:
6 | # Defines the name of the default database that Mongoid can connect to.
7 | # (required).
8 | database: attachinary_development
9 | # Provides the hosts the default session can connect to. Must be an array
10 | # of host:port pairs. (required)
11 | hosts:
12 | - localhost:27017
13 | options:
14 | # Change whether the session persists in safe mode by default.
15 | # (default: false)
16 | # safe: false
17 |
18 | # Change the default consistency model to :eventual or :strong.
19 | # :eventual will send reads to secondaries, :strong sends everything
20 | # to master. (default: :eventual)
21 | consistency: :strong
22 | # Configure Mongoid specific options. (optional)
23 | options:
24 | # Configuration for whether or not to allow access to fields that do
25 | # not have a field definition on the model. (default: true)
26 | # allow_dynamic_fields: true
27 |
28 | # Enable the identity map, needed for eager loading. (default: false)
29 | # identity_map_enabled: false
30 |
31 | # Includes the root model name in json serialization. (default: false)
32 | # include_root_in_json: false
33 |
34 | # Include the _type field in serializaion. (default: false)
35 | # include_type_for_serialization: false
36 |
37 | # Preload all models in development, needed when models use
38 | # inheritance. (default: false)
39 | # preload_models: false
40 |
41 | # Protect id and type from mass assignment. (default: true)
42 | # protect_sensitive_fields: true
43 |
44 | # Raise an error when performing a #find and the document is not found.
45 | # (default: true)
46 | # raise_not_found_error: true
47 |
48 | # Raise an error when defining a scope with the same name as an
49 | # existing method. (default: false)
50 | # scope_overwrite_exception: false
51 |
52 | # Skip the database version check, used when connecting to a db without
53 | # admin access. (default: false)
54 | # skip_version_check: false
55 |
56 | # User Active Support's time zone in conversions. (default: true)
57 | # use_activesupport_time_zone: true
58 |
59 | # Ensure all times are UTC in the app side. (default: false)
60 | # use_utc: false
61 | test:
62 | sessions:
63 | default:
64 | database: attachinary_test
65 | hosts:
66 | - localhost:27017
67 | options:
68 | consistency: :strong
69 |
--------------------------------------------------------------------------------
/spec/dummy/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | mount Attachinary::Engine => "/attachinary"
3 | resources :notes
4 | root to: 'notes#index'
5 | end
6 |
--------------------------------------------------------------------------------
/spec/dummy/db/migrate/20120608091037_create_tables.rb:
--------------------------------------------------------------------------------
1 | class CreateTables < ActiveRecord::Migration
2 | def change
3 | create_table :attachinary_files do |t|
4 | t.references :attachinariable, polymorphic: true
5 | t.string :scope
6 |
7 | t.string :public_id
8 | t.string :version
9 | t.integer :width
10 | t.integer :height
11 | t.string :format
12 | t.string :resource_type
13 | t.timestamps
14 | end
15 | add_index :attachinary_files, [:attachinariable_type, :attachinariable_id, :scope], name: 'by_scoped_parent'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/dummy/db/migrate/20120608104143_create_notes.rb:
--------------------------------------------------------------------------------
1 | class CreateNotes < ActiveRecord::Migration
2 | def change
3 | create_table :notes do |t|
4 | t.text :body
5 |
6 | t.timestamps
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/spec/dummy/db/schema.rb:
--------------------------------------------------------------------------------
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 => 20120608104143) do
15 |
16 | create_table "attachinary_files", :force => true do |t|
17 | t.integer "attachinariable_id"
18 | t.string "attachinariable_type"
19 | t.string "scope"
20 | t.string "public_id"
21 | t.string "version"
22 | t.integer "width"
23 | t.integer "height"
24 | t.string "format"
25 | t.string "resource_type"
26 | t.datetime "created_at", :null => false
27 | t.datetime "updated_at", :null => false
28 | end
29 |
30 | add_index "attachinary_files", ["attachinariable_type", "attachinariable_id", "scope"], :name => "by_scoped_parent"
31 |
32 | create_table "notes", :force => true do |t|
33 | t.text "body"
34 | t.datetime "created_at", :null => false
35 | t.datetime "updated_at", :null => false
36 | end
37 |
38 | end
39 |
--------------------------------------------------------------------------------
/spec/dummy/lib/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy/lib/assets/.gitkeep
--------------------------------------------------------------------------------
/spec/dummy/log/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy/log/.gitkeep
--------------------------------------------------------------------------------
/spec/dummy/public/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy/public/.gitkeep
--------------------------------------------------------------------------------
/spec/dummy/script/rails:
--------------------------------------------------------------------------------
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'
7 |
--------------------------------------------------------------------------------
/spec/dummy/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # This file is copied to spec/ when you run 'rails generate rspec:install'
2 | ENV['RAILS_ENV'] ||= 'test'
3 | require File.expand_path("../../config/environment", __FILE__)
4 | # Prevent database truncation if the environment is production
5 | abort("The Rails environment is running in production mode!") if Rails.env.production?
6 | require 'spec_helper'
7 | require 'rspec/rails'
8 | # Add additional requires below this line. Rails is not loaded until this point!
9 | require '../spec_helper.rb'
10 | # Requires supporting ruby files with custom matchers and macros, etc, in
11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12 | # run as spec files by default. This means that files in spec/support that end
13 | # in _spec.rb will both be required and run as specs, causing the specs to be
14 | # run twice. It is recommended that you do not name files matching this glob to
15 | # end with _spec.rb. You can configure this pattern with the --pattern
16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17 | #
18 | # The following line is provided for convenience purposes. It has the downside
19 | # of increasing the boot-up time by auto-requiring all files in the support
20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
21 | # require only the support files necessary.
22 | #
23 | # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24 |
25 | RSpec.configure do |config|
26 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
27 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
28 |
29 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
30 | # examples within a transaction, remove the following line or assign false
31 | # instead of true.
32 | config.use_transactional_fixtures = true
33 |
34 | # RSpec Rails can automatically mix in different behaviours to your tests
35 | # based on their file location, for example enabling you to call `get` and
36 | # `post` in specs under `spec/controllers`.
37 | #
38 | # You can disable this behaviour by removing the line below, and instead
39 | # explicitly tag your specs with their type, e.g.:
40 | #
41 | # RSpec.describe UsersController, :type => :controller do
42 | # # ...
43 | # end
44 | #
45 | # The different available types are documented in the features, such as in
46 | # https://relishapp.com/rspec/rspec-rails/docs
47 | config.infer_spec_type_from_file_location!
48 | end
49 |
--------------------------------------------------------------------------------
/spec/dummy/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause
4 | # this file to always be loaded, without a need to explicitly require it in any
5 | # files.
6 | #
7 | # Given that it is always loaded, you are encouraged to keep this file as
8 | # light-weight as possible. Requiring heavyweight dependencies from this file
9 | # will add to the boot time of your test suite on EVERY test run, even for an
10 | # individual file that may not need all of that loaded. Instead, consider making
11 | # a separate helper file that requires the additional dependencies and performs
12 | # the additional setup, and require it from the spec files that actually need
13 | # it.
14 | #
15 | # The `.rspec` file also contains a few flags that are not defaults but that
16 | # users commonly want.
17 | #
18 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19 | RSpec.configure do |config|
20 | # rspec-expectations config goes here. You can use an alternate
21 | # assertion/expectation library such as wrong or the stdlib/minitest
22 | # assertions if you prefer.
23 | config.expect_with :rspec do |expectations|
24 | # This option will default to `true` in RSpec 4. It makes the `description`
25 | # and `failure_message` of custom matchers include text for helper methods
26 | # defined using `chain`, e.g.:
27 | # be_bigger_than(2).and_smaller_than(4).description
28 | # # => "be bigger than 2 and smaller than 4"
29 | # ...rather than:
30 | # # => "be bigger than 2"
31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32 | end
33 |
34 | # rspec-mocks config goes here. You can use an alternate test double
35 | # library (such as bogus or mocha) by changing the `mock_with` option here.
36 | config.mock_with :rspec do |mocks|
37 | # Prevents you from mocking or stubbing a method that does not exist on
38 | # a real object. This is generally recommended, and will default to
39 | # `true` in RSpec 4.
40 | mocks.verify_partial_doubles = true
41 | end
42 |
43 | # The settings below are suggested to provide a good initial experience
44 | # with RSpec, but feel free to customize to your heart's content.
45 | =begin
46 | # These two settings work together to allow you to limit a spec run
47 | # to individual examples or groups you care about by tagging them with
48 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49 | # get run.
50 | config.filter_run :focus
51 | config.run_all_when_everything_filtered = true
52 |
53 | # Allows RSpec to persist some state between runs in order to support
54 | # the `--only-failures` and `--next-failure` CLI options. We recommend
55 | # you configure your source control system to ignore this file.
56 | config.example_status_persistence_file_path = "spec/examples.txt"
57 |
58 | # Limits the available syntax to the non-monkey patched syntax that is
59 | # recommended. For more details, see:
60 | # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
61 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62 | # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
63 | config.disable_monkey_patching!
64 |
65 | # Many RSpec users commonly either run the entire suite or an individual
66 | # file, and it's useful to allow more verbose output when running an
67 | # individual spec file.
68 | if config.files_to_run.one?
69 | # Use the documentation formatter for detailed output,
70 | # unless a formatter has already been configured
71 | # (e.g. via a command-line flag).
72 | config.default_formatter = 'doc'
73 | end
74 |
75 | # Print the 10 slowest examples and example groups at the
76 | # end of the spec run, to help surface which specs are running
77 | # particularly slow.
78 | config.profile_examples = 10
79 |
80 | # Run specs in random order to surface order dependencies. If you find an
81 | # order dependency and want to debug it, you can fix the order by providing
82 | # the seed, which is printed after each run.
83 | # --seed 1234
84 | config.order = :random
85 |
86 | # Seed global randomization in this process using the `--seed` CLI option.
87 | # Setting this allows you to use `--seed` to deterministically reproduce
88 | # test failures related to randomization by passing the same `--seed` value
89 | # as the one that triggered the failure.
90 | Kernel.srand config.seed
91 | =end
92 | end
93 |
--------------------------------------------------------------------------------
/spec/dummy/vendor/assets/javascripts/jquery.iframe-transport.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery Iframe Transport Plugin 1.5
3 | * https://github.com/blueimp/jQuery-File-Upload
4 | *
5 | * Copyright 2011, Sebastian Tschan
6 | * https://blueimp.net
7 | *
8 | * Licensed under the MIT license:
9 | * http://www.opensource.org/licenses/MIT
10 | */
11 |
12 | /*jslint unparam: true, nomen: true */
13 | /*global define, window, document */
14 |
15 | (function (factory) {
16 | 'use strict';
17 | if (typeof define === 'function' && define.amd) {
18 | // Register as an anonymous AMD module:
19 | define(['jquery'], factory);
20 | } else {
21 | // Browser globals:
22 | factory(window.jQuery);
23 | }
24 | }(function ($) {
25 | 'use strict';
26 |
27 | // Helper variable to create unique names for the transport iframes:
28 | var counter = 0;
29 |
30 | // The iframe transport accepts three additional options:
31 | // options.fileInput: a jQuery collection of file input fields
32 | // options.paramName: the parameter name for the file form data,
33 | // overrides the name property of the file input field(s),
34 | // can be a string or an array of strings.
35 | // options.formData: an array of objects with name and value properties,
36 | // equivalent to the return data of .serializeArray(), e.g.:
37 | // [{name: 'a', value: 1}, {name: 'b', value: 2}]
38 | $.ajaxTransport('iframe', function (options) {
39 | if (options.async && (options.type === 'POST' || options.type === 'GET')) {
40 | var form,
41 | iframe;
42 | return {
43 | send: function (_, completeCallback) {
44 | form = $('');
45 | form.attr('accept-charset', options.formAcceptCharset);
46 | // javascript:false as initial iframe src
47 | // prevents warning popups on HTTPS in IE6.
48 | // IE versions below IE8 cannot set the name property of
49 | // elements that have already been added to the DOM,
50 | // so we set the name along with the iframe HTML markup:
51 | iframe = $(
52 | ''
54 | ).bind('load', function () {
55 | var fileInputClones,
56 | paramNames = $.isArray(options.paramName) ?
57 | options.paramName : [options.paramName];
58 | iframe
59 | .unbind('load')
60 | .bind('load', function () {
61 | var response;
62 | // Wrap in a try/catch block to catch exceptions thrown
63 | // when trying to access cross-domain iframe contents:
64 | try {
65 | response = iframe.contents();
66 | // Google Chrome and Firefox do not throw an
67 | // exception when calling iframe.contents() on
68 | // cross-domain requests, so we unify the response:
69 | if (!response.length || !response[0].firstChild) {
70 | throw new Error();
71 | }
72 | } catch (e) {
73 | response = undefined;
74 | }
75 | // The complete callback returns the
76 | // iframe content document as response object:
77 | completeCallback(
78 | 200,
79 | 'success',
80 | {'iframe': response}
81 | );
82 | // Fix for IE endless progress bar activity bug
83 | // (happens on form submits to iframe targets):
84 | $('')
85 | .appendTo(form);
86 | form.remove();
87 | });
88 | form
89 | .prop('target', iframe.prop('name'))
90 | .prop('action', options.url)
91 | .prop('method', options.type);
92 | if (options.formData) {
93 | $.each(options.formData, function (index, field) {
94 | $('')
95 | .prop('name', field.name)
96 | .val(field.value)
97 | .appendTo(form);
98 | });
99 | }
100 | if (options.fileInput && options.fileInput.length &&
101 | options.type === 'POST') {
102 | fileInputClones = options.fileInput.clone();
103 | // Insert a clone for each file input field:
104 | options.fileInput.after(function (index) {
105 | return fileInputClones[index];
106 | });
107 | if (options.paramName) {
108 | options.fileInput.each(function (index) {
109 | $(this).prop(
110 | 'name',
111 | paramNames[index] || options.paramName
112 | );
113 | });
114 | }
115 | // Appending the file input fields to the hidden form
116 | // removes them from their original location:
117 | form
118 | .append(options.fileInput)
119 | .prop('enctype', 'multipart/form-data')
120 | // enctype must be set as encoding for IE:
121 | .prop('encoding', 'multipart/form-data');
122 | }
123 | form.submit();
124 | // Insert the file input fields at their original location
125 | // by replacing the clones with the originals:
126 | if (fileInputClones && fileInputClones.length) {
127 | options.fileInput.each(function (index, input) {
128 | var clone = $(fileInputClones[index]);
129 | $(input).prop('name', clone.prop('name'));
130 | clone.replaceWith(input);
131 | });
132 | }
133 | });
134 | form.append(iframe).appendTo(document.body);
135 | },
136 | abort: function () {
137 | if (iframe) {
138 | // javascript:false as iframe src aborts the request
139 | // and prevents warning popups on HTTPS in IE6.
140 | // concat is used to avoid the "Script URL" JSLint error:
141 | iframe
142 | .unbind('load')
143 | .prop('src', 'javascript'.concat(':false;'));
144 | }
145 | if (form) {
146 | form.remove();
147 | }
148 | }
149 | };
150 | }
151 | });
152 |
153 | // The iframe transport returns the iframe content document as response.
154 | // The following adds converters from iframe to text, json, html, and script:
155 | $.ajaxSetup({
156 | converters: {
157 | 'iframe text': function (iframe) {
158 | return $(iframe[0].body).text();
159 | },
160 | 'iframe json': function (iframe) {
161 | return $.parseJSON($(iframe[0].body).text());
162 | },
163 | 'iframe html': function (iframe) {
164 | return $(iframe[0].body).html();
165 | },
166 | 'iframe script': function (iframe) {
167 | return $.globalEval($(iframe[0].body).text());
168 | }
169 | }
170 | });
171 |
172 | }));
173 |
--------------------------------------------------------------------------------
/spec/dummy/vendor/assets/javascripts/jquery.ui.widget.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery UI Widget 1.9.1+amd
3 | * https://github.com/blueimp/jQuery-File-Upload
4 | *
5 | * Copyright 2012 jQuery Foundation and other contributors
6 | * Released under the MIT license.
7 | * http://jquery.org/license
8 | *
9 | * http://api.jqueryui.com/jQuery.widget/
10 | */
11 |
12 | (function (factory) {
13 | if (typeof define === "function" && define.amd) {
14 | // Register as an anonymous AMD module:
15 | define(["jquery"], factory);
16 | } else {
17 | // Browser globals:
18 | factory(jQuery);
19 | }
20 | }(function( $, undefined ) {
21 |
22 | var uuid = 0,
23 | slice = Array.prototype.slice,
24 | _cleanData = $.cleanData;
25 | $.cleanData = function( elems ) {
26 | for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
27 | try {
28 | $( elem ).triggerHandler( "remove" );
29 | // http://bugs.jquery.com/ticket/8235
30 | } catch( e ) {}
31 | }
32 | _cleanData( elems );
33 | };
34 |
35 | $.widget = function( name, base, prototype ) {
36 | var fullName, existingConstructor, constructor, basePrototype,
37 | namespace = name.split( "." )[ 0 ];
38 |
39 | name = name.split( "." )[ 1 ];
40 | fullName = namespace + "-" + name;
41 |
42 | if ( !prototype ) {
43 | prototype = base;
44 | base = $.Widget;
45 | }
46 |
47 | // create selector for plugin
48 | $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
49 | return !!$.data( elem, fullName );
50 | };
51 |
52 | $[ namespace ] = $[ namespace ] || {};
53 | existingConstructor = $[ namespace ][ name ];
54 | constructor = $[ namespace ][ name ] = function( options, element ) {
55 | // allow instantiation without "new" keyword
56 | if ( !this._createWidget ) {
57 | return new constructor( options, element );
58 | }
59 |
60 | // allow instantiation without initializing for simple inheritance
61 | // must use "new" keyword (the code above always passes args)
62 | if ( arguments.length ) {
63 | this._createWidget( options, element );
64 | }
65 | };
66 | // extend with the existing constructor to carry over any static properties
67 | $.extend( constructor, existingConstructor, {
68 | version: prototype.version,
69 | // copy the object used to create the prototype in case we need to
70 | // redefine the widget later
71 | _proto: $.extend( {}, prototype ),
72 | // track widgets that inherit from this widget in case this widget is
73 | // redefined after a widget inherits from it
74 | _childConstructors: []
75 | });
76 |
77 | basePrototype = new base();
78 | // we need to make the options hash a property directly on the new instance
79 | // otherwise we'll modify the options hash on the prototype that we're
80 | // inheriting from
81 | basePrototype.options = $.widget.extend( {}, basePrototype.options );
82 | $.each( prototype, function( prop, value ) {
83 | if ( $.isFunction( value ) ) {
84 | prototype[ prop ] = (function() {
85 | var _super = function() {
86 | return base.prototype[ prop ].apply( this, arguments );
87 | },
88 | _superApply = function( args ) {
89 | return base.prototype[ prop ].apply( this, args );
90 | };
91 | return function() {
92 | var __super = this._super,
93 | __superApply = this._superApply,
94 | returnValue;
95 |
96 | this._super = _super;
97 | this._superApply = _superApply;
98 |
99 | returnValue = value.apply( this, arguments );
100 |
101 | this._super = __super;
102 | this._superApply = __superApply;
103 |
104 | return returnValue;
105 | };
106 | })();
107 | }
108 | });
109 | constructor.prototype = $.widget.extend( basePrototype, {
110 | // TODO: remove support for widgetEventPrefix
111 | // always use the name + a colon as the prefix, e.g., draggable:start
112 | // don't prefix for widgets that aren't DOM-based
113 | widgetEventPrefix: basePrototype.widgetEventPrefix || name
114 | }, prototype, {
115 | constructor: constructor,
116 | namespace: namespace,
117 | widgetName: name,
118 | // TODO remove widgetBaseClass, see #8155
119 | widgetBaseClass: fullName,
120 | widgetFullName: fullName
121 | });
122 |
123 | // If this widget is being redefined then we need to find all widgets that
124 | // are inheriting from it and redefine all of them so that they inherit from
125 | // the new version of this widget. We're essentially trying to replace one
126 | // level in the prototype chain.
127 | if ( existingConstructor ) {
128 | $.each( existingConstructor._childConstructors, function( i, child ) {
129 | var childPrototype = child.prototype;
130 |
131 | // redefine the child widget using the same prototype that was
132 | // originally used, but inherit from the new version of the base
133 | $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
134 | });
135 | // remove the list of existing child constructors from the old constructor
136 | // so the old child constructors can be garbage collected
137 | delete existingConstructor._childConstructors;
138 | } else {
139 | base._childConstructors.push( constructor );
140 | }
141 |
142 | $.widget.bridge( name, constructor );
143 | };
144 |
145 | $.widget.extend = function( target ) {
146 | var input = slice.call( arguments, 1 ),
147 | inputIndex = 0,
148 | inputLength = input.length,
149 | key,
150 | value;
151 | for ( ; inputIndex < inputLength; inputIndex++ ) {
152 | for ( key in input[ inputIndex ] ) {
153 | value = input[ inputIndex ][ key ];
154 | if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
155 | // Clone objects
156 | if ( $.isPlainObject( value ) ) {
157 | target[ key ] = $.isPlainObject( target[ key ] ) ?
158 | $.widget.extend( {}, target[ key ], value ) :
159 | // Don't extend strings, arrays, etc. with objects
160 | $.widget.extend( {}, value );
161 | // Copy everything else by reference
162 | } else {
163 | target[ key ] = value;
164 | }
165 | }
166 | }
167 | }
168 | return target;
169 | };
170 |
171 | $.widget.bridge = function( name, object ) {
172 | var fullName = object.prototype.widgetFullName;
173 | $.fn[ name ] = function( options ) {
174 | var isMethodCall = typeof options === "string",
175 | args = slice.call( arguments, 1 ),
176 | returnValue = this;
177 |
178 | // allow multiple hashes to be passed on init
179 | options = !isMethodCall && args.length ?
180 | $.widget.extend.apply( null, [ options ].concat(args) ) :
181 | options;
182 |
183 | if ( isMethodCall ) {
184 | this.each(function() {
185 | var methodValue,
186 | instance = $.data( this, fullName );
187 | if ( !instance ) {
188 | return $.error( "cannot call methods on " + name + " prior to initialization; " +
189 | "attempted to call method '" + options + "'" );
190 | }
191 | if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
192 | return $.error( "no such method '" + options + "' for " + name + " widget instance" );
193 | }
194 | methodValue = instance[ options ].apply( instance, args );
195 | if ( methodValue !== instance && methodValue !== undefined ) {
196 | returnValue = methodValue && methodValue.jquery ?
197 | returnValue.pushStack( methodValue.get() ) :
198 | methodValue;
199 | return false;
200 | }
201 | });
202 | } else {
203 | this.each(function() {
204 | var instance = $.data( this, fullName );
205 | if ( instance ) {
206 | instance.option( options || {} )._init();
207 | } else {
208 | new object( options, this );
209 | }
210 | });
211 | }
212 |
213 | return returnValue;
214 | };
215 | };
216 |
217 | $.Widget = function( /* options, element */ ) {};
218 | $.Widget._childConstructors = [];
219 |
220 | $.Widget.prototype = {
221 | widgetName: "widget",
222 | widgetEventPrefix: "",
223 | defaultElement: "
7 |
8 | <%= link_to 'Edit', edit_note_path(@note) %> |
9 | <%= link_to 'Back', notes_path %>
10 |
--------------------------------------------------------------------------------
/spec/dummy4/app/views/notes/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! @note, :id, :body, :created_at, :updated_at
2 |
--------------------------------------------------------------------------------
/spec/dummy4/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dummy4",
3 | "version": "1.2.6",
4 | "homepage": "https://github.com/assembler/attachinary",
5 | "authors": [
6 | "Amir Tocker "
7 | ],
8 | "license": "MIT",
9 | "ignore": [
10 | "**/.*",
11 | "node_modules",
12 | "bower_components",
13 | "test",
14 | "tests"
15 | ],
16 | "dependencies": {
17 | "jquery": ">=1.6",
18 | "blueimp-file-upload": ">=7.2.1"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/spec/dummy4/config.ru:
--------------------------------------------------------------------------------
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
5 |
--------------------------------------------------------------------------------
/spec/dummy4/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups, ATTACHINARY_ORM)
8 | begin
9 | require "#{ATTACHINARY_ORM}/railtie"
10 | rescue LoadError
11 | end
12 |
13 | require "attachinary"
14 |
15 | module Dummy4
16 | class Application < Rails::Application
17 | # Settings in config/environments/* take precedence over those specified here.
18 | # Application configuration should go into files in config/initializers
19 | # -- all .rb files in that directory are automatically loaded.
20 |
21 | # Custom directories with classes and modules you want to be autoloadable.
22 | # config.autoload_paths += %W(#{config.root}/extras)
23 | config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
24 | config.autoload_paths += [ "#{config.root}/app/#{ATTACHINARY_ORM}" ]
25 |
26 | # Only load the plugins named here, in the order given (default is alphabetical).
27 | # :all can be used as a placeholder for all plugins not explicitly named.
28 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
29 |
30 | # Activate observers that should always be running.
31 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
32 |
33 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
34 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
35 | # config.time_zone = 'Central Time (US & Canada)'
36 |
37 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
38 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
39 | # config.i18n.default_locale = :de
40 |
41 | # Do not swallow errors in after_commit/after_rollback callbacks.
42 | config.active_record.raise_in_transactional_callbacks = true
43 |
44 | config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
45 | if ATTACHINARY_ORM == 'mongoid'
46 | config.generators do |g|
47 | g.orm :mongoid
48 | end
49 | end
50 | end
51 | end
52 |
--------------------------------------------------------------------------------
/spec/dummy4/config/boot.rb:
--------------------------------------------------------------------------------
1 | unless defined?(ATTACHINARY_ORM)
2 | ATTACHINARY_ORM = (ENV["ATTACHINARY_ORM"] || :active_record).to_sym
3 | end
4 |
5 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
6 |
7 | require 'bundler/setup' # Set up gems listed in the Gemfile.
8 |
--------------------------------------------------------------------------------
/spec/dummy4/config/database.yml:
--------------------------------------------------------------------------------
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 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/spec/dummy4/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/dummy4/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.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 |
30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31 | # yet still be able to expire them through the digest params.
32 | config.assets.digest = true
33 |
34 | # Adds additional error checking when serving assets at runtime.
35 | # Checks for improperly declared sprockets dependencies.
36 | # Raises helpful error messages.
37 | config.assets.raise_runtime_errors = true
38 |
39 | # Raises error for missing translations
40 | # config.action_view.raise_on_missing_translations = true
41 | end
42 |
--------------------------------------------------------------------------------
/spec/dummy4/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.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 threaded 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
20 | # NGINX, varnish or squid.
21 | # config.action_dispatch.rack_cache = true
22 |
23 | # Disable serving static files from the `/public` folder by default since
24 | # Apache or NGINX already handles this.
25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26 |
27 | # Compress JavaScripts and CSS.
28 | config.assets.js_compressor = :uglifier
29 | # config.assets.css_compressor = :sass
30 |
31 | # Do not fallback to assets pipeline if a precompiled asset is missed.
32 | config.assets.compile = false
33 |
34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35 | # yet still be able to expire them through the digest params.
36 | config.assets.digest = true
37 |
38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39 |
40 | # Specifies the header that your server uses for sending files.
41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43 |
44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45 | # config.force_ssl = true
46 |
47 | # Use the lowest log level to ensure availability of diagnostic information
48 | # when problems arise.
49 | config.log_level = :debug
50 |
51 | # Prepend all log lines with the following tags.
52 | # config.log_tags = [ :subdomain, :uuid ]
53 |
54 | # Use a different logger for distributed setups.
55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56 |
57 | # Use a different cache store in production.
58 | # config.cache_store = :mem_cache_store
59 |
60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61 | # config.action_controller.asset_host = 'http://assets.example.com'
62 |
63 | # Ignore bad email addresses and do not raise email delivery errors.
64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65 | # config.action_mailer.raise_delivery_errors = false
66 |
67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68 | # the I18n.default_locale when a translation cannot be found).
69 | config.i18n.fallbacks = true
70 |
71 | # Send deprecation notices to registered listeners.
72 | config.active_support.deprecation = :notify
73 |
74 | # Use default logging formatter so that PID and timestamp are not suppressed.
75 | config.log_formatter = ::Logger::Formatter.new
76 |
77 | # Do not dump schema after migrations.
78 | config.active_record.dump_schema_after_migration = false
79 | end
80 |
--------------------------------------------------------------------------------
/spec/dummy4/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.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 file server for tests with Cache-Control for performance.
16 | config.serve_static_files = 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 | # Randomize the order test cases are executed.
35 | config.active_support.test_order = :random
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 |
9 | # Precompile additional assets.
10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11 | # Rails.application.config.assets.precompile += %w( search.js )
12 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/attachinary.rb:
--------------------------------------------------------------------------------
1 | require "attachinary/orm/#{ATTACHINARY_ORM}"
2 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
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!
8 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
4 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
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]
5 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
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
17 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_dummy4_session'
4 |
--------------------------------------------------------------------------------
/spec/dummy4/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
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
15 |
--------------------------------------------------------------------------------
/spec/dummy4/config/locales/en.yml:
--------------------------------------------------------------------------------
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"
24 |
--------------------------------------------------------------------------------
/spec/dummy4/config/mongoid.yml:
--------------------------------------------------------------------------------
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: dummy4_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 |
24 | # The name of the user for authentication.
25 | # user: 'user'
26 |
27 | # The password of the user for authentication.
28 | # password: 'password'
29 |
30 | # The user's database roles.
31 | # roles:
32 | # - 'dbOwner'
33 |
34 | # Change the default authentication mechanism. Valid options are: :scram,
35 | # :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default
36 | # on 2.4 and 2.6 is :plain)
37 | # auth_mech: :scram
38 |
39 | # The database or source to authenticate the user against. (default: admin)
40 | # auth_source: admin
41 |
42 | # Force a the driver cluster to behave in a certain manner instead of auto-
43 | # discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
44 | # when connecting to hidden members of a replica set.
45 | # connect: :direct
46 |
47 | # Changes the default time in seconds the server monitors refresh their status
48 | # via ismaster commands. (default: 10)
49 | # heartbeat_frequency: 10
50 |
51 | # The time in seconds for selecting servers for a near read preference. (default: 5)
52 | # local_threshold: 5
53 |
54 | # The timeout in seconds for selecting a server for an operation. (default: 30)
55 | # server_selection_timeout: 30
56 |
57 | # The maximum number of connections in the connection pool. (default: 5)
58 | # max_pool_size: 5
59 |
60 | # The minimum number of connections in the connection pool. (default: 1)
61 | # min_pool_size: 1
62 |
63 | # The time to wait, in seconds, in the connection pool for a connection
64 | # to be checked in before timing out. (default: 5)
65 | # wait_queue_timeout: 5
66 |
67 | # The time to wait to establish a connection before timing out, in seconds.
68 | # (default: 5)
69 | # connect_timeout: 5
70 |
71 | # The timeout to wait to execute operations on a socket before raising an error.
72 | # (default: 5)
73 | # socket_timeout: 5
74 |
75 | # The name of the replica set to connect to. Servers provided as seeds that do
76 | # not belong to this replica set will be ignored.
77 | # replica_set: name
78 |
79 | # Whether to connect to the servers via ssl. (default: false)
80 | # ssl: true
81 |
82 | # The certificate file used to identify the connection against MongoDB.
83 | # ssl_cert: /path/to/my.cert
84 |
85 | # The private keyfile used to identify the connection against MongoDB.
86 | # Note that even if the key is stored in the same file as the certificate,
87 | # both need to be explicitly specified.
88 | # ssl_key: /path/to/my.key
89 |
90 | # A passphrase for the private key.
91 | # ssl_key_pass_phrase: password
92 |
93 | # Whether or not to do peer certification validation. (default: false)
94 | # ssl_verify: true
95 |
96 | # The file containing a set of concatenated certification authority certifications
97 | # used to validate certs passed from the other end of the connection.
98 | # ssl_ca_cert: /path/to/ca.cert
99 |
100 |
101 | # Configure Mongoid specific options. (optional)
102 | options:
103 | # Includes the root model name in json serialization. (default: false)
104 | # include_root_in_json: false
105 |
106 | # Include the _type field in serialization. (default: false)
107 | # include_type_for_serialization: false
108 |
109 | # Preload all models in development, needed when models use
110 | # inheritance. (default: false)
111 | # preload_models: false
112 |
113 | # Raise an error when performing a #find and the document is not found.
114 | # (default: true)
115 | # raise_not_found_error: true
116 |
117 | # Raise an error when defining a scope with the same name as an
118 | # existing method. (default: false)
119 | # scope_overwrite_exception: false
120 |
121 | # Use Active Support's time zone in conversions. (default: true)
122 | # use_activesupport_time_zone: true
123 |
124 | # Ensure all times are UTC in the app side. (default: false)
125 | # use_utc: false
126 | test:
127 | clients:
128 | default:
129 | database: dummy4_test
130 | hosts:
131 | - localhost:27017
132 | options:
133 | # read:
134 | # mode: primary
135 | max_pool_size: 1
136 |
--------------------------------------------------------------------------------
/spec/dummy4/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | mount Attachinary::Engine => "/attachinary"
3 | resources :notes
4 | root to: 'notes#index'
5 |
6 | # The priority is based upon order of creation: first created -> highest priority.
7 | # See how all your routes lay out with "rake routes".
8 |
9 | # You can have the root of your site routed with "root"
10 | # root 'welcome#index'
11 |
12 | # Example of regular route:
13 | # get 'products/:id' => 'catalog#view'
14 |
15 | # Example of named route that can be invoked with purchase_url(id: product.id)
16 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
17 |
18 | # Example resource route (maps HTTP verbs to controller actions automatically):
19 | # resources :products
20 |
21 | # Example resource route with options:
22 | # resources :products do
23 | # member do
24 | # get 'short'
25 | # post 'toggle'
26 | # end
27 | #
28 | # collection do
29 | # get 'sold'
30 | # end
31 | # end
32 |
33 | # Example resource route with sub-resources:
34 | # resources :products do
35 | # resources :comments, :sales
36 | # resource :seller
37 | # end
38 |
39 | # Example resource route with more complex sub-resources:
40 | # resources :products do
41 | # resources :comments
42 | # resources :sales do
43 | # get 'recent', on: :collection
44 | # end
45 | # end
46 |
47 | # Example resource route with concerns:
48 | # concern :toggleable do
49 | # post 'toggle'
50 | # end
51 | # resources :posts, concerns: :toggleable
52 | # resources :photos, concerns: :toggleable
53 |
54 | # Example resource route within a namespace:
55 | # namespace :admin do
56 | # # Directs /admin/products/* to Admin::ProductsController
57 | # # (app/controllers/admin/products_controller.rb)
58 | # resources :products
59 | # end
60 | end
61 |
--------------------------------------------------------------------------------
/spec/dummy4/config/secrets.yml:
--------------------------------------------------------------------------------
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 the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | development:
14 | secret_key_base: b9534cf1d6b32c759212373d798dde4714e4c97d262bace0935c14607666195cf1f0e5ae10307db809cbebec9cffd9ac15125d4cb265032c48cc9731385319a9
15 |
16 | test:
17 | secret_key_base: d0c21d62451e9aed42658bbaa07bbac349ea37eab8fc5903490fcdffc141d1dac7941827baefde403481920c6b4f01d040d67b30b7f208c501a80fa22fb459d5
18 |
19 | # Do not keep production secrets in the repository,
20 | # instead read values from the environment.
21 | production:
22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
23 |
--------------------------------------------------------------------------------
/spec/dummy4/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
--------------------------------------------------------------------------------
/spec/dummy4/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/lib/assets/.keep
--------------------------------------------------------------------------------
/spec/dummy4/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/lib/tasks/.keep
--------------------------------------------------------------------------------
/spec/dummy4/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/log/.keep
--------------------------------------------------------------------------------
/spec/dummy4/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/spec/dummy4/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/public/favicon.ico
--------------------------------------------------------------------------------
/spec/dummy4/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/spec/dummy4/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # This file is copied to spec/ when you run 'rails generate rspec:install'
2 | ENV['RAILS_ENV'] ||= 'test'
3 | require File.expand_path('../../config/environment', __FILE__)
4 | # Prevent database truncation if the environment is production
5 | abort("The Rails environment is running in production mode!") if Rails.env.production?
6 | require 'spec_helper'
7 | require 'rspec/rails'
8 | # Add additional requires below this line. Rails is not loaded until this point!
9 |
10 | # Requires supporting ruby files with custom matchers and macros, etc, in
11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12 | # run as spec files by default. This means that files in spec/support that end
13 | # in _spec.rb will both be required and run as specs, causing the specs to be
14 | # run twice. It is recommended that you do not name files matching this glob to
15 | # end with _spec.rb. You can configure this pattern with the --pattern
16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17 | #
18 | # The following line is provided for convenience purposes. It has the downside
19 | # of increasing the boot-up time by auto-requiring all files in the support
20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
21 | # require only the support files necessary.
22 | #
23 | # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24 |
25 | # Checks for pending migrations before tests are run.
26 | # If you are not using ActiveRecord, you can remove this line.
27 | ActiveRecord::Migration.maintain_test_schema!
28 |
29 | RSpec.configure do |config|
30 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
31 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
32 |
33 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
34 | # examples within a transaction, remove the following line or assign false
35 | # instead of true.
36 | config.use_transactional_fixtures = true
37 |
38 | # RSpec Rails can automatically mix in different behaviours to your tests
39 | # based on their file location, for example enabling you to call `get` and
40 | # `post` in specs under `spec/controllers`.
41 | #
42 | # You can disable this behaviour by removing the line below, and instead
43 | # explicitly tag your specs with their type, e.g.:
44 | #
45 | # RSpec.describe UsersController, :type => :controller do
46 | # # ...
47 | # end
48 | #
49 | # The different available types are documented in the features, such as in
50 | # https://relishapp.com/rspec/rspec-rails/docs
51 | config.infer_spec_type_from_file_location!
52 | end
53 | require '../spec_helper.rb'
--------------------------------------------------------------------------------
/spec/dummy4/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause
4 | # this file to always be loaded, without a need to explicitly require it in any
5 | # files.
6 | #
7 | # Given that it is always loaded, you are encouraged to keep this file as
8 | # light-weight as possible. Requiring heavyweight dependencies from this file
9 | # will add to the boot time of your test suite on EVERY test run, even for an
10 | # individual file that may not need all of that loaded. Instead, consider making
11 | # a separate helper file that requires the additional dependencies and performs
12 | # the additional setup, and require it from the spec files that actually need
13 | # it.
14 | #
15 | # The `.rspec` file also contains a few flags that are not defaults but that
16 | # users commonly want.
17 | #
18 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19 | RSpec.configure do |config|
20 | # rspec-expectations config goes here. You can use an alternate
21 | # assertion/expectation library such as wrong or the stdlib/minitest
22 | # assertions if you prefer.
23 | config.expect_with :rspec do |expectations|
24 | # This option will default to `true` in RSpec 4. It makes the `description`
25 | # and `failure_message` of custom matchers include text for helper methods
26 | # defined using `chain`, e.g.:
27 | # be_bigger_than(2).and_smaller_than(4).description
28 | # # => "be bigger than 2 and smaller than 4"
29 | # ...rather than:
30 | # # => "be bigger than 2"
31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32 | end
33 |
34 | # rspec-mocks config goes here. You can use an alternate test double
35 | # library (such as bogus or mocha) by changing the `mock_with` option here.
36 | config.mock_with :rspec do |mocks|
37 | # Prevents you from mocking or stubbing a method that does not exist on
38 | # a real object. This is generally recommended, and will default to
39 | # `true` in RSpec 4.
40 | mocks.verify_partial_doubles = true
41 | end
42 |
43 | # The settings below are suggested to provide a good initial experience
44 | # with RSpec, but feel free to customize to your heart's content.
45 | =begin
46 | # These two settings work together to allow you to limit a spec run
47 | # to individual examples or groups you care about by tagging them with
48 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49 | # get run.
50 | config.filter_run :focus
51 | config.run_all_when_everything_filtered = true
52 |
53 | # Allows RSpec to persist some state between runs in order to support
54 | # the `--only-failures` and `--next-failure` CLI options. We recommend
55 | # you configure your source control system to ignore this file.
56 | config.example_status_persistence_file_path = "spec/examples.txt"
57 |
58 | # Limits the available syntax to the non-monkey patched syntax that is
59 | # recommended. For more details, see:
60 | # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
61 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62 | # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
63 | config.disable_monkey_patching!
64 |
65 | # Many RSpec users commonly either run the entire suite or an individual
66 | # file, and it's useful to allow more verbose output when running an
67 | # individual spec file.
68 | if config.files_to_run.one?
69 | # Use the documentation formatter for detailed output,
70 | # unless a formatter has already been configured
71 | # (e.g. via a command-line flag).
72 | config.default_formatter = 'doc'
73 | end
74 |
75 | # Print the 10 slowest examples and example groups at the
76 | # end of the spec run, to help surface which specs are running
77 | # particularly slow.
78 | config.profile_examples = 10
79 |
80 | # Run specs in random order to surface order dependencies. If you find an
81 | # order dependency and want to debug it, you can fix the order by providing
82 | # the seed, which is printed after each run.
83 | # --seed 1234
84 | config.order = :random
85 |
86 | # Seed global randomization in this process using the `--seed` CLI option.
87 | # Setting this allows you to use `--seed` to deterministically reproduce
88 | # test failures related to randomization by passing the same `--seed` value
89 | # as the one that triggered the failure.
90 | Kernel.srand config.seed
91 | =end
92 | end
93 |
--------------------------------------------------------------------------------
/spec/dummy4/test/controllers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/test/controllers/.keep
--------------------------------------------------------------------------------
/spec/dummy4/test/controllers/notes_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class NotesControllerTest < ActionController::TestCase
4 | setup do
5 | @note = notes(:one)
6 | end
7 |
8 | test "should get index" do
9 | get :index
10 | assert_response :success
11 | assert_not_nil assigns(:notes)
12 | end
13 |
14 | test "should get new" do
15 | get :new
16 | assert_response :success
17 | end
18 |
19 | test "should create note" do
20 | assert_difference('Note.count') do
21 | post :create, note: { body: @note.body }
22 | end
23 |
24 | assert_redirected_to note_path(assigns(:note))
25 | end
26 |
27 | test "should show note" do
28 | get :show, id: @note
29 | assert_response :success
30 | end
31 |
32 | test "should get edit" do
33 | get :edit, id: @note
34 | assert_response :success
35 | end
36 |
37 | test "should update note" do
38 | patch :update, id: @note, note: { body: @note.body }
39 | assert_redirected_to note_path(assigns(:note))
40 | end
41 |
42 | test "should destroy note" do
43 | assert_difference('Note.count', -1) do
44 | delete :destroy, id: @note
45 | end
46 |
47 | assert_redirected_to notes_path
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/spec/dummy4/test/fixtures/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/test/fixtures/.keep
--------------------------------------------------------------------------------
/spec/dummy4/test/fixtures/notes.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | one:
4 | body: MyString
5 |
6 | two:
7 | body: MyString
8 |
--------------------------------------------------------------------------------
/spec/dummy4/test/helpers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/test/helpers/.keep
--------------------------------------------------------------------------------
/spec/dummy4/test/integration/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/test/integration/.keep
--------------------------------------------------------------------------------
/spec/dummy4/test/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/test/mailers/.keep
--------------------------------------------------------------------------------
/spec/dummy4/test/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/test/models/.keep
--------------------------------------------------------------------------------
/spec/dummy4/test/models/note_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class NoteTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/spec/dummy4/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV['RAILS_ENV'] ||= 'test'
2 | require File.expand_path('../../config/environment', __FILE__)
3 | require 'rails/test_help'
4 |
5 | class ActiveSupport::TestCase
6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7 | fixtures :all
8 |
9 | # Add more helper methods to be used by all tests here...
10 | end
11 |
--------------------------------------------------------------------------------
/spec/dummy4/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/vendor/assets/javascripts/.keep
--------------------------------------------------------------------------------
/spec/dummy4/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/dummy4/vendor/assets/stylesheets/.keep
--------------------------------------------------------------------------------
/spec/factories.rb:
--------------------------------------------------------------------------------
1 | FactoryGirl.define do
2 |
3 | factory :note do
4 | sequence(:body) { |n| "Note ##{n}"}
5 | after(:build) do |note|
6 | note.photo ||= FactoryGirl.build(:file)
7 | end
8 | end
9 |
10 | factory :file, class: Attachinary::File do
11 | sequence(:public_id) { |n| "id#{n}"}
12 | sequence(:version) { |n| "#{n}"}
13 | width 800
14 | height 600
15 | format 'jpg'
16 | resource_type 'image'
17 | end
18 |
19 | end
20 |
--------------------------------------------------------------------------------
/spec/features/notes_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | describe 'Notes' do
4 | Capybara.default_wait_time = 15
5 |
6 | describe 'Creating new note' do
7 |
8 | shared_examples_for "any form" do
9 | before do
10 | visit path
11 | end
12 |
13 | it 'display an alert if invalid file format is uploaded', :js => true do
14 | within 'div.photo' do
15 | accept_alert 'Invalid file format' do
16 | attach_file 'note[photo]', "#{SPEC_ROOT}/support/A.txt"
17 | end
18 | end
19 | end
20 |
21 | it 'disables input when first photo is uploaded', :js => true do
22 | within 'div.photo' do
23 | attach_file "note[photo]", "#{SPEC_ROOT}/support/A.gif"
24 | page.should have_css 'input[disabled]'
25 | end
26 | end
27 |
28 | it 'allows multiple images to be uploaded', :js => true do
29 | within 'div.images' do
30 | attach_file "note[images][]", "#{SPEC_ROOT}/support/A.gif"
31 | value = find(:xpath, './/input[@name="note[images][]" and @type="hidden" and contains(@value, \'"A"\')]', :visible => false).value
32 | images = ActiveSupport::JSON.decode( value)
33 | images.length.should be 1
34 | images.map{|i| i["original_filename"]}.should eq ["A"]
35 |
36 | attach_file "note[images][]", "#{SPEC_ROOT}/support/B.gif"
37 | value = find(:xpath, './/input[@name="note[images][]" and @type="hidden" and contains(@value, \'"B"\')]', :visible => false).value
38 | images = ActiveSupport::JSON.decode( value)
39 | images.length.should be 2
40 | images.map{|i| i["original_filename"]}.sort.should eq ["A", "B"]
41 | end
42 | end
43 |
44 | it 'preserves uploaded photo across postbacks', :js => true do
45 | within 'div.photo' do
46 | attach_file "note[photo]", "#{SPEC_ROOT}/support/A.gif"
47 | page.should have_css 'img'
48 | end
49 |
50 | page.should have_button 'Create Note' # wait for it to appear
51 | click_button 'Create Note'
52 |
53 | within 'div.photo' do
54 | page.should have_css 'img'
55 | end
56 | end
57 |
58 | it 'validates presence of photo', :js => true do
59 | click_button 'Create Note'
60 | within 'div.photo' do
61 | page.should have_content "can't be blank"
62 | end
63 | end
64 |
65 | it 'saves the record', :js => true do
66 | fill_in 'note[body]', with: 'My Note'
67 | within 'div.photo' do
68 | attach_file "note[photo]", "#{SPEC_ROOT}/support/A.gif"
69 | end
70 | click_button 'Create Note'
71 |
72 | current_path.should == notes_path
73 | page.should have_content 'My Note'
74 | page.should have_css 'img'
75 | end
76 |
77 | end
78 |
79 |
80 | context 'raw form', :js do
81 | let(:path) { new_note_path(kind: 'raw') }
82 | it_behaves_like "any form"
83 | end
84 |
85 | context 'builder form', :js do
86 | let(:path) { new_note_path(kind: 'builder') }
87 | it_behaves_like "any form"
88 | end
89 |
90 |
91 | context 'simple_form', :js do
92 | let(:path) { new_note_path(kind: 'simple_form') }
93 | it_behaves_like "any form"
94 | end
95 |
96 | end
97 |
98 | end
99 |
--------------------------------------------------------------------------------
/spec/models/attachinary/file_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Attachinary::File do
4 | subject { build(:file) }
5 |
6 | describe 'validations' do
7 | it { should be_valid }
8 | it { should_not have_valid(:public_id).when(nil) }
9 | it { should_not have_valid(:version).when(nil) }
10 | it { should_not have_valid(:resource_type).when(nil) }
11 | end
12 |
13 | describe '#path(custom_format=nil)' do
14 | context "image resource_type" do
15 | subject { build(:file, public_id: 'id', version: '1', format: 'jpg', resource_type: 'image') }
16 |
17 | it 'allows you to pick format' do
18 | subject.path.should == 'v1/id.jpg'
19 | subject.path('png').should == 'v1/id.png'
20 | subject.path(false).should == 'v1/id'
21 | end
22 | end
23 |
24 | context "raw resource_type" do
25 | subject { build(:file, public_id: 'id.txt', version: '1', format: '', resource_type: 'raw') }
26 |
27 | it 'ignores the format' do
28 | subject.path.should == 'v1/id.txt'
29 | subject.path('png').should == 'v1/id.txt'
30 | subject.path(false).should == 'v1/id.txt'
31 | end
32 | end
33 | end
34 |
35 | describe '#fullpath(options={})' do
36 | it 'delegates to Cloudinary' do
37 | Cloudinary::Utils.stub(:cloudinary_url).with('v1/id1.png', {resource_type: "image"}).and_return('http_png')
38 | subject.public_id = 'id1'
39 | subject.version = '1'
40 | subject.fullpath(format: 'png').should == 'http_png'
41 | end
42 | end
43 |
44 | end
45 |
--------------------------------------------------------------------------------
/spec/models/note_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Note do
4 | subject { build(:note) }
5 |
6 | describe 'validations' do
7 | it { should be_valid }
8 | it { should_not have_valid(:photo).when(nil) }
9 | end
10 |
11 |
12 | describe "callbacks" do
13 | let(:photo) { build(:file) }
14 |
15 | describe "after_destroy" do
16 | after(:each) do
17 | Cloudinary.config.delete_field(:attachinary_keep_remote) if Cloudinary.config.respond_to?(:attachinary_keep_remote)
18 | end
19 |
20 | it "destroys attached files" do
21 | note = create(:note, photo: photo)
22 | Cloudinary::Uploader.should_receive(:destroy).with(photo.public_id)
23 | note.destroy
24 | end
25 |
26 | it "keeps attached files if Cloudinary.config.attachinary_keep_remote == true" do
27 | Cloudinary.config.attachinary_keep_remote = true
28 | note = create(:note, photo: photo)
29 | Cloudinary::Uploader.should_not_receive(:destroy).with(photo.public_id)
30 | note.destroy
31 | end
32 | end
33 |
34 | describe "after_create" do
35 | it "removes attachinary_tmp tag from files" do
36 | Cloudinary::Uploader.should_receive(:remove_tag).with(Attachinary::TMPTAG, [photo.public_id])
37 | create(:note, photo: photo)
38 | end
39 | end
40 | end
41 |
42 | describe 'photo attachment' do
43 | describe '#photo' do
44 | it 'manages photo' do
45 | photo1 = build(:file)
46 | subject.photo = photo1
47 | subject.photo.should == photo1
48 |
49 | photo2 = build(:file)
50 | subject.photo = photo2
51 | subject.photo.should == photo2
52 |
53 | subject.photo = nil
54 | subject.photo.should be_nil
55 | end
56 |
57 | it 'accepts stringified JSON' do
58 | file = build(:file)
59 | subject.photo = file.to_json
60 | subject.photo.public_id.should == file.public_id
61 | end
62 |
63 | it 'handles invalid JSON from bad browsers (IE)' do
64 | file = build(:file)
65 | subject.photo = "[null]"
66 | subject.photo.should be_nil
67 | end
68 |
69 | it 'accepts IO objects' do
70 | image = StringIO.new("")
71 | file = build(:file)
72 | expected_id = file.public_id
73 | Cloudinary::Uploader.should_receive(:upload).with(image, resource_type: 'auto').and_return(file.attributes)
74 |
75 | subject.photo = image
76 | subject.photo.public_id.should == expected_id
77 | end
78 | end
79 |
80 | describe '#photo_url=(url)' do
81 | let(:url) { "http://placehold.it/100x100" }
82 | let(:file) { build(:file) }
83 | let(:json) { file.attributes.to_json }
84 |
85 | before do
86 | Cloudinary::Uploader.should_receive(:upload).with(url, resource_type: 'auto').and_return(json)
87 | end
88 |
89 | it 'uploads photo via url' do
90 | subject.photo_url = url
91 | subject.photo.public_id.should == file.public_id
92 | end
93 | end
94 |
95 | describe '#photo?' do
96 | it 'checks whether photo is present' do
97 | subject.photo?.should be_truthy
98 | subject.photo = nil
99 | subject.photo?.should be_falsey
100 | end
101 | end
102 |
103 | describe '#photo_metadata' do
104 | it 'returns association metadata' do
105 | subject.photo_metadata[:maximum].should == 1
106 | subject.photo_metadata[:single].should == true
107 | end
108 | end
109 | end
110 |
111 | describe 'image attachments' do
112 | describe '#images' do
113 | it 'manages images' do
114 | subject.images?.should be_falsey
115 |
116 | image1 = build(:file)
117 | subject.images << image1
118 | subject.images.should == [image1]
119 |
120 | image2 = build(:file)
121 | subject.images << image2
122 | subject.images.should == [image1, image2]
123 |
124 | subject.images = nil
125 | subject.images.should be_blank
126 | end
127 |
128 | it 'accepts stringified JSON' do
129 | file = build(:file)
130 |
131 | subject.images = file.to_json
132 | subject.images.first.public_id.should == file.public_id
133 | end
134 |
135 | it 'accepts IO objects' do
136 | images = [1,2].map { StringIO.new("") }
137 | files = build_list(:file, images.length)
138 | files_ids = files.map(&:public_id)
139 |
140 | files.each.with_index do |file, index|
141 | Cloudinary::Uploader.should_receive(:upload).with(images[index], resource_type: 'auto').and_return(file.attributes)
142 | end
143 |
144 | subject.images = images
145 | subject.images.map(&:public_id).should =~ files_ids
146 | end
147 | end
148 |
149 | describe '#image_urls=(urls)' do
150 | let(:urls) { %w[ 1 2 3 ] }
151 | let(:files) { build_list(:file, urls.length) }
152 | let(:files_ids) { files.map(&:public_id)}
153 |
154 | before do
155 | files_ids
156 | files.each.with_index do |file, index|
157 | Cloudinary::Uploader.should_receive(:upload).with(urls[index], resource_type: 'auto').and_return(file.attributes)
158 | end
159 | end
160 |
161 | it 'upload photos via urls' do
162 | subject.image_urls = urls
163 | subject.images.map(&:public_id).should =~ files_ids
164 | end
165 | end
166 |
167 | describe '#images_metadata' do
168 | it 'returns association metadata' do
169 | subject.images_metadata[:single].should == false
170 | end
171 | end
172 | end
173 | end
174 |
--------------------------------------------------------------------------------
/spec/orm/active_record.rb:
--------------------------------------------------------------------------------
1 | ActiveRecord::Migration.verbose = false
2 | ActiveRecord::Base.logger = Logger.new(nil)
3 |
4 | ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/")
5 |
--------------------------------------------------------------------------------
/spec/orm/mongoid.rb:
--------------------------------------------------------------------------------
1 | Mongoid.logger = Logger.new(nil)
2 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # Configure Rails Envinronment
2 | ENV["RAILS_ENV"] = "test"
3 | ATTACHINARY_ORM ||= (ENV["ATTACHINARY_ORM"] || :active_record).to_sym
4 |
5 | # $:.unshift File.dirname(__FILE__)
6 | # require 'rspec/rails'
7 | # require "dummy/config/environment.rb"
8 | SPEC_ROOT = "#{::Rails.root}/.."
9 | require "#{SPEC_ROOT}/orm/#{ATTACHINARY_ORM}"
10 |
11 | require 'valid_attribute'
12 | require 'capybara/rspec'
13 |
14 | require 'factory_girl'
15 | require "#{SPEC_ROOT}/factories"
16 |
17 | require 'database_cleaner'
18 |
19 | require "capybara/webkit"
20 | Capybara.javascript_driver = :webkit
21 |
22 | Capybara::Webkit.configure do |config|
23 | config.allow_url("api.cloudinary.com")
24 | config.allow_url("res.cloudinary.com")
25 | end
26 |
27 | # ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
28 |
29 | # Requires supporting ruby files with custom matchers and macros, etc,
30 | # in spec/support/ and its subdirectories.
31 | # Uncomment next line to load all support files, if you have more than one
32 | # Uncomment next line to load all support files, if you have more than one
33 | # Dir[File.join(ENGINE_RAILS_ROOT, "../../spec/support/**/*.rb")].each {|f| require f }
34 | require "#{SPEC_ROOT}/support/request_helpers"
35 |
36 | RSpec.configure do |config|
37 | config.color = true
38 | config.treat_symbols_as_metadata_keys_with_true_values = true
39 | config.filter_run focus: true
40 | config.run_all_when_everything_filtered = true
41 |
42 | config.use_transactional_fixtures = false
43 | config.include FactoryGirl::Syntax::Methods
44 | config.include RequestHelpers, type: :feature
45 |
46 | config.before(:suite) do
47 | DatabaseCleaner.strategy = :truncation
48 | end
49 |
50 | config.before(:each) do |example|
51 | DatabaseCleaner.start
52 | end
53 |
54 | config.after(:each) do
55 | DatabaseCleaner.clean
56 | end
57 |
58 | config.after(:suite) do
59 | print "\n\n Cleaning up uploaded files"
60 |
61 | begin
62 | Cloudinary::Api.delete_resources_by_tag('test_env')
63 | print " (done)"
64 | rescue Cloudinary::Api::RateLimited => e
65 | print " (#{e.message})"
66 | end
67 |
68 | print "\n\n"
69 | end
70 | end
71 |
--------------------------------------------------------------------------------
/spec/support/A.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/support/A.gif
--------------------------------------------------------------------------------
/spec/support/A.txt:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/spec/support/B.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/support/B.gif
--------------------------------------------------------------------------------
/spec/support/C.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/assembler/attachinary/98a895be22edc74b1928ffa3ae116d24bd9818fd/spec/support/C.gif
--------------------------------------------------------------------------------
/spec/support/request_helpers.rb:
--------------------------------------------------------------------------------
1 | module RequestHelpers
2 |
3 | def handle_alert
4 | page.execute_script "window.original_alert_function = window.alert"
5 | page.execute_script "window.alert_message = null"
6 | page.execute_script "window.alert = function(msg) { window.alert_message = msg; }"
7 | yield
8 | ensure
9 | page.execute_script "window.alert = window.original_alert_function"
10 | end
11 |
12 | def alert_message
13 | page.evaluate_script "window.alert_message"
14 | end
15 |
16 | end
17 |
--------------------------------------------------------------------------------