diff --git a/.gitignore b/.gitignore index 7a39f62d..0ae33f8c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,3 @@ spec/dummy/config/cloudinary.yml bin/ .rspec -config/cloudinary.yml diff --git a/CHANGELOG b/CHANGELOG index 14b531b7..966d04eb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ += Version 1.3.2 + * Compress uploaded images + += Version 1.3.1 + * Don't delete files if there's an existing public ID reference + = Version 1.3.0 * Added support for Rails 4 (thanks @rochers) * Use resource type when building cloudinary urls diff --git a/Gemfile.lock b/Gemfile.lock index 563d1b81..d93cbbca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,223 +1,189 @@ PATH remote: . specs: - attachinary (1.3.1) - cloudinary (~> 1.1.0) + attachinary (1.3.0) + cloudinary (~> 1.0.69) rails (>= 3.2) GEM remote: http://rubygems.org/ specs: - actionmailer (4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.3) - actionview (= 4.2.3) - activesupport (= 4.2.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) + actionmailer (4.0.3) + actionpack (= 4.0.3) + mail (~> 2.5.4) + actionpack (4.0.3) + activesupport (= 4.0.3) + builder (~> 3.1.0) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.3) - activesupport (= 4.2.3) - globalid (>= 0.3.0) - activemodel (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) - activerecord (4.2.3) - activemodel (= 4.2.3) - activesupport (= 4.2.3) - arel (~> 6.0) - activesupport (4.2.3) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.3.8) - arel (6.0.3) - aws_cf_signer (0.1.3) - bson (3.1.2) - builder (3.2.2) - capybara (2.4.4) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.3) + activesupport (= 4.0.3) + builder (~> 3.1.0) + activerecord (4.0.3) + activemodel (= 4.0.3) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.3) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.3) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + addressable (2.3.5) + arel (4.0.2) + atomic (1.1.14) + aws_cf_signer (0.1.2) + bson (1.9.2) + builder (3.1.4) + capybara (2.2.1) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - capybara-webkit (1.6.0) - capybara (>= 2.3.0, < 2.5.0) + capybara-webkit (1.1.0) + capybara (~> 2.0, >= 2.0.2) json - cloudinary (1.1.0) + celluloid (0.15.2) + timers (~> 1.1.0) + celluloid-io (0.15.0) + celluloid (>= 0.15.0) + nio4r (>= 0.5.0) + cloudinary (1.0.69) aws_cf_signer rest-client coderay (1.1.0) - coffee-rails (4.1.0) + coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) - coffee-script (2.4.1) + coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.9.1.1) - connection_pool (2.2.0) - database_cleaner (1.4.1) + coffee-script-source (1.7.0) + database_cleaner (1.2.0) diff-lcs (1.2.5) - domain_name (0.5.24) - unf (>= 0.0.5, < 1.0.0) + durran-validatable (2.0.1) erubis (2.7.0) - execjs (2.5.2) - factory_girl (4.5.0) + execjs (2.0.2) + factory_girl (4.4.0) activesupport (>= 3.0.0) - factory_girl_rails (4.5.0) - factory_girl (~> 4.5.0) + factory_girl_rails (4.4.0) + factory_girl (~> 4.4.0) railties (>= 3.0.0) - ffi (1.9.10) - formatador (0.2.5) - globalid (0.3.6) - activesupport (>= 4.1.0) - guard (2.12.8) + ffi (1.9.3) + formatador (0.2.4) + guard (2.5.1) formatador (>= 0.2.4) - listen (>= 2.7, <= 4.0) + listen (~> 2.6) lumberjack (~> 1.0) - nenv (~> 0.1) - notiffany (~> 0.0) pry (>= 0.9.12) - shellany (~> 0.0) thor (>= 0.18.1) - guard-compat (1.2.1) - guard-rspec (4.6.2) + guard-rspec (4.2.7) guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) - http-cookie (1.0.2) - domain_name (~> 0.5) - i18n (0.7.0) - jquery-rails (4.0.4) - rails-dom-testing (~> 1.0) - railties (>= 4.2.0) + rspec (>= 2.14, < 4.0) + hike (1.2.3) + i18n (0.6.9) + jquery-rails (3.1.0) + railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.8.3) - launchy (2.4.3) + json (1.8.1) + launchy (2.4.2) addressable (~> 2.3) - listen (3.0.2) + leshill-will_paginate (2.3.11) + listen (2.6.1) + celluloid (>= 0.15.2) + celluloid-io (>= 0.15.0) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) - loofah (2.0.2) - nokogiri (>= 1.5.9) - lumberjack (1.0.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) + lumberjack (1.0.4) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) method_source (0.8.2) - mime-types (2.6.1) - mini_portile (0.6.2) - minitest (5.7.0) - mongoid (4.0.2) - activemodel (~> 4.0) - moped (~> 2.0.0) - origin (~> 2.1) - tzinfo (>= 0.3.37) - moped (2.0.6) - bson (~> 3.0) - connection_pool (~> 2.0) - optionable (~> 0.2.0) - nenv (0.2.0) - netrc (0.10.3) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - notiffany (0.0.6) - nenv (~> 0.1) - shellany (~> 0.0) - optionable (0.2.0) - origin (2.1.1) - pry (0.10.1) - coderay (~> 1.1.0) - method_source (~> 0.8.1) + mime-types (1.25.1) + mini_portile (0.5.2) + minitest (4.7.5) + mongo (1.9.2) + bson (~> 1.9.2) + mongoid (1.0.6) + activesupport (>= 2.2.2) + durran-validatable (>= 2.0.1) + leshill-will_paginate (>= 2.3.11) + mongo (>= 0.18.2) + multi_json (1.8.4) + nio4r (1.0.0) + nokogiri (1.6.1) + mini_portile (~> 0.5.0) + polyglot (0.3.4) + pry (0.9.12.6) + coderay (~> 1.0) + method_source (~> 0.8) slop (~> 3.4) - rack (1.6.4) - rack-test (0.6.3) + rack (1.5.2) + rack-test (0.6.2) rack (>= 1.0) - rails (4.2.3) - actionmailer (= 4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) - activemodel (= 4.2.3) - activerecord (= 4.2.3) - activesupport (= 4.2.3) + rails (4.0.3) + actionmailer (= 4.0.3) + actionpack (= 4.0.3) + activerecord (= 4.0.3) + activesupport (= 4.0.3) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.3) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.6) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) - loofah (~> 2.0) - railties (4.2.3) - actionpack (= 4.2.3) - activesupport (= 4.2.3) + railties (= 4.0.3) + sprockets-rails (~> 2.0.0) + railties (4.0.3) + actionpack (= 4.0.3) + activesupport (= 4.0.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rb-fsevent (0.9.5) - rb-inotify (0.9.5) + rake (10.1.1) + rb-fsevent (0.9.4) + rb-inotify (0.9.3) ffi (>= 0.5.0) - rest-client (1.8.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) - rspec (3.3.0) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-core (3.3.2) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-rails (3.3.3) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - shellany (0.0.1) - simple_form (3.1.0) - actionpack (~> 4.0) - activemodel (~> 4.0) - slop (3.6.0) - sprockets (3.3.4) + rest-client (1.6.7) + mime-types (>= 1.16) + rspec (2.14.1) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + rspec-core (2.14.7) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.6) + rspec-rails (2.14.1) + actionpack (>= 3.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + simple_form (3.0.1) + actionpack (>= 4.0.0, < 4.1) + activemodel (>= 4.0.0, < 4.1) + slop (3.4.7) + sprockets (2.11.0) + hike (~> 1.2) + multi_json (~> 1.0) rack (~> 1.0) - sprockets-rails (2.3.3) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.1) actionpack (>= 3.0) activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.10) - thor (0.19.1) - thread_safe (0.3.5) - tzinfo (1.2.2) - thread_safe (~> 0.1) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.1) - valid_attribute (2.0.0) + sprockets (~> 2.8) + sqlite3 (1.3.9) + thor (0.18.1) + thread_safe (0.1.3) + atomic + tilt (1.4.1) + timers (1.1.0) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.38) + valid_attribute (1.3.1) xpath (2.0.0) nokogiri (~> 1.3) diff --git a/README.md b/README.md index 2e596133..7cb13cbd 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Here comes the good part. There is no need to transform images on your server. I ```erb <% if @user.avatar? %> - <%= cl_image_tag(@user.avatar.path, { size: '50x50', crop: :thumb, gravity: :face }) %> + <%= cl_image_tag(@user.avatar.path, { size: '50x50', crop: :fit, gravity: :face }) %> <% end %> <% @user.photos.each do |photo| %> @@ -157,20 +157,6 @@ If you don't want fancy JS features, all you have to do is just switch to `:inpu <%= f.input :images, as: :file, input_html: { multiple: true } %> ``` -### Preventing n+1 queries when loading attachinary associations - -You can eager load attachinary associations. - -For example, I have a `user` model that has `photo` and `avatar` as attachments. - -```rb -# user.rb - has_attachment :avatar - has_attachments :photos - -# users_controller.rb - User.includes(:avatar_files, :photo_files).all -``` ## Conventions diff --git a/app/controllers/attachinary/cors_controller.rb b/app/controllers/attachinary/cors_controller.rb index eabbe9b8..e22d1f8a 100644 --- a/app/controllers/attachinary/cors_controller.rb +++ b/app/controllers/attachinary/cors_controller.rb @@ -1,10 +1,9 @@ module Attachinary class CorsController < Attachinary::ApplicationController + respond_to :json def show - respond_to do |format| - format.json { render json: request.query_parameters, content_type: "text/plain" } - end + respond_with request.query_parameters, :content_type => 'text/plain' end end end diff --git a/attachinary.gemspec b/attachinary.gemspec index 8a8d8806..e381cbc1 100644 --- a/attachinary.gemspec +++ b/attachinary.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.test_files = Dir["test/**/*"] s.add_dependency 'rails', '>= 3.2' - s.add_dependency 'cloudinary', '~> 1.1.0' + s.add_dependency 'cloudinary', '~> 1.0.69' s.add_development_dependency 'sqlite3' s.add_development_dependency 'rspec-rails' diff --git a/db/migrate/20190513104000_add_public_id_index.rb b/db/migrate/20190513104000_add_public_id_index.rb new file mode 100644 index 00000000..d7387540 --- /dev/null +++ b/db/migrate/20190513104000_add_public_id_index.rb @@ -0,0 +1,5 @@ +class AddPublicIdIndex < ActiveRecord::Migration + def change + add_index :attachinary_files, [:public_id], name: 'attch_index_public_id', length: 10 + end +end diff --git a/lib/assets/javascripts/attachinary.js.coffee b/lib/assets/javascripts/attachinary.js.coffee index 483bb253..0d636f81 100644 --- a/lib/assets/javascripts/attachinary.js.coffee +++ b/lib/assets/javascripts/attachinary.js.coffee @@ -1,3 +1,8 @@ +#= require canvas-to-blob.min +#= require load-image.all.min +#= require jquery.fileupload-process +#= require jquery.fileupload-image + (($) -> $.attachinary = @@ -62,6 +67,19 @@ dropZone: @config.dropZone || @$input sequentialUploads: true + # attach the pasteZone option if the user has specified it + if @options.pasteZone != undefined + options.pasteZone = @options.pasteZone + else if @config.pasteZone != undefined + options.pasteZone = @config.pasteZone + + image_quality = @options.imageQuality || @config.imageQuality + + if image_quality != undefined + options.imageQuality = image_quality + options.imageForceResize = true + options.disableImageResize = false + if @$input.attr('accept') options.acceptFileTypes = new RegExp("^#{@$input.attr('accept').split(",").join("|")}$", "i") diff --git a/lib/assets/javascripts/canvas-to-blob.min.js b/lib/assets/javascripts/canvas-to-blob.min.js new file mode 100755 index 00000000..cfff76c6 --- /dev/null +++ b/lib/assets/javascripts/canvas-to-blob.min.js @@ -0,0 +1,2 @@ +!function(t){"use strict";var r=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,f=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),b=f&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),d=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,B=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,a=(f||d)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,o,n,r,a,i,l,u,c;if(!(e=t.match(B)))throw new Error("invalid data URI");for(o=e[2]?e[1]:"text/plain"+(e[3]||";charset=US-ASCII"),n=!!e[4],r=t.slice(e[0].length),a=n?atob(r):decodeURIComponent(r),i=new ArrayBuffer(a.length),l=new Uint8Array(i),u=0;u options.maxFileSize) || + (options.fileTypes && !options.fileTypes.test(file.type)) || + !loadImage( + file, + function(img) { + if (img.src) { + data.img = img; + } + dfd.resolveWith(that, [data]); + }, + options + ) + ) { + return data; + } + return dfd.promise(); + }, + + // Resizes the image given as data.canvas or data.img + // and updates data.canvas or data.img with the resized image. + // Also stores the resized image as preview property. + // Accepts the options maxWidth, maxHeight, minWidth, + // minHeight, canvas and crop: + resizeImage: function(data, options) { + if (options.disabled || !(data.canvas || data.img)) { + return data; + } + // eslint-disable-next-line no-param-reassign + options = $.extend({ canvas: true }, options); + var that = this, + // eslint-disable-next-line new-cap + dfd = $.Deferred(), + img = (options.canvas && data.canvas) || data.img, + resolve = function(newImg) { + if ( + newImg && + (newImg.width !== img.width || + newImg.height !== img.height || + options.forceResize) + ) { + data[newImg.getContext ? 'canvas' : 'img'] = newImg; + } + data.preview = newImg; + dfd.resolveWith(that, [data]); + }, + thumbnail; + if (data.exif) { + if (options.orientation === true) { + options.orientation = data.exif.get('Orientation'); + } + if (options.thumbnail) { + thumbnail = data.exif.get('Thumbnail'); + if (thumbnail) { + loadImage(thumbnail, resolve, options); + return dfd.promise(); + } + } + // Prevent orienting the same image twice: + if (data.orientation) { + delete options.orientation; + } else { + data.orientation = options.orientation; + } + } + if (img) { + resolve(loadImage.scale(img, options)); + return dfd.promise(); + } + return data; + }, + + // Saves the processed image given as data.canvas + // inplace at data.index of data.files: + saveImage: function(data, options) { + if (!data.canvas || options.disabled) { + return data; + } + var that = this, + file = data.files[data.index], + // eslint-disable-next-line new-cap + dfd = $.Deferred(); + if (data.canvas.toBlob) { + data.canvas.toBlob( + function(blob) { + if (!blob.name) { + if (file.type === blob.type) { + blob.name = file.name; + } else if (file.name) { + blob.name = file.name.replace( + /\.\w+$/, + '.' + blob.type.substr(6) + ); + } + } + // Don't restore invalid meta data: + if (file.type !== blob.type) { + delete data.imageHead; + } + // Store the created blob at the position + // of the original file in the files list: + data.files[data.index] = blob; + dfd.resolveWith(that, [data]); + }, + options.type || file.type, + options.quality + ); + } else { + return data; + } + return dfd.promise(); + }, + + loadImageMetaData: function(data, options) { + if (options.disabled) { + return data; + } + var that = this, + // eslint-disable-next-line new-cap + dfd = $.Deferred(); + loadImage.parseMetaData( + data.files[data.index], + function(result) { + $.extend(data, result); + dfd.resolveWith(that, [data]); + }, + options + ); + return dfd.promise(); + }, + + saveImageMetaData: function(data, options) { + if ( + !( + data.imageHead && + data.canvas && + data.canvas.toBlob && + !options.disabled + ) + ) { + return data; + } + var file = data.files[data.index], + blob = new Blob( + [ + data.imageHead, + // Resized images always have a head size of 20 bytes, + // including the JPEG marker and a minimal JFIF header: + this._blobSlice.call(file, 20) + ], + { type: file.type } + ); + blob.name = file.name; + data.files[data.index] = blob; + return data; + }, + + // Sets the resized version of the image as a property of the + // file object, must be called after "saveImage": + setImage: function(data, options) { + if (data.preview && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.preview; + } + return data; + }, + + deleteImageReferences: function(data, options) { + if (!options.disabled) { + delete data.img; + delete data.canvas; + delete data.preview; + delete data.imageHead; + } + return data; + } + } + }); +}); diff --git a/lib/assets/javascripts/jquery.fileupload-process.js b/lib/assets/javascripts/jquery.fileupload-process.js new file mode 100755 index 00000000..54d21691 --- /dev/null +++ b/lib/assets/javascripts/jquery.fileupload-process.js @@ -0,0 +1,175 @@ +/* + * jQuery File Upload Processing Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* global define, require */ + +(function(factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery', './jquery.fileupload'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery'), require('./jquery.fileupload')); + } else { + // Browser globals: + factory(window.jQuery); + } +})(function($) { + 'use strict'; + + var originalAdd = $.blueimp.fileupload.prototype.options.add; + + // The File Upload Processing plugin extends the fileupload widget + // with file processing functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + options: { + // The list of processing actions: + processQueue: [ + /* + { + action: 'log', + type: 'debug' + } + */ + ], + add: function(e, data) { + var $this = $(this); + data.process(function() { + return $this.fileupload('process', data); + }); + originalAdd.call(this, e, data); + } + }, + + processActions: { + /* + log: function (data, options) { + console[options.type]( + 'Processing "' + data.files[data.index].name + '"' + ); + } + */ + }, + + _processFile: function(data, originalData) { + var that = this, + // eslint-disable-next-line new-cap + dfd = $.Deferred().resolveWith(that, [data]), + chain = dfd.promise(); + this._trigger('process', null, data); + $.each(data.processQueue, function(i, settings) { + var func = function(data) { + if (originalData.errorThrown) { + // eslint-disable-next-line new-cap + return $.Deferred() + .rejectWith(that, [originalData]) + .promise(); + } + return that.processActions[settings.action].call( + that, + data, + settings + ); + }; + chain = chain.then(func, settings.always && func); + }); + chain + .done(function() { + that._trigger('processdone', null, data); + that._trigger('processalways', null, data); + }) + .fail(function() { + that._trigger('processfail', null, data); + that._trigger('processalways', null, data); + }); + return chain; + }, + + // Replaces the settings of each processQueue item that + // are strings starting with an "@", using the remaining + // substring as key for the option map, + // e.g. "@autoUpload" is replaced with options.autoUpload: + _transformProcessQueue: function(options) { + var processQueue = []; + $.each(options.processQueue, function() { + var settings = {}, + action = this.action, + prefix = this.prefix === true ? action : this.prefix; + $.each(this, function(key, value) { + if ($.type(value) === 'string' && value.charAt(0) === '@') { + settings[key] = + options[ + value.slice(1) || + (prefix + ? prefix + key.charAt(0).toUpperCase() + key.slice(1) + : key) + ]; + } else { + settings[key] = value; + } + }); + processQueue.push(settings); + }); + options.processQueue = processQueue; + }, + + // Returns the number of files currently in the processsing queue: + processing: function() { + return this._processing; + }, + + // Processes the files given as files property of the data parameter, + // returns a Promise object that allows to bind callbacks: + process: function(data) { + var that = this, + options = $.extend({}, this.options, data); + if (options.processQueue && options.processQueue.length) { + this._transformProcessQueue(options); + if (this._processing === 0) { + this._trigger('processstart'); + } + $.each(data.files, function(index) { + var opts = index ? $.extend({}, options) : options, + func = function() { + if (data.errorThrown) { + // eslint-disable-next-line new-cap + return $.Deferred() + .rejectWith(that, [data]) + .promise(); + } + return that._processFile(opts, data); + }; + opts.index = index; + that._processing += 1; + that._processingQueue = that._processingQueue + .then(func, func) + .always(function() { + that._processing -= 1; + if (that._processing === 0) { + that._trigger('processstop'); + } + }); + }); + } + return this._processingQueue; + }, + + _create: function() { + this._super(); + this._processing = 0; + // eslint-disable-next-line new-cap + this._processingQueue = $.Deferred() + .resolveWith(this) + .promise(); + } + }); +}); diff --git a/lib/assets/javascripts/load-image.all.min.js b/lib/assets/javascripts/load-image.all.min.js new file mode 100755 index 00000000..8d912910 --- /dev/null +++ b/lib/assets/javascripts/load-image.all.min.js @@ -0,0 +1,2 @@ +!function(o){"use strict";function r(t,i,a){var o,n=document.createElement("img");return n.onerror=function(e){return r.onerror(n,e,t,i,a)},n.onload=function(e){return r.onload(n,e,t,i,a)},"string"==typeof t?(r.fetchBlob(t,function(e){e&&r.isInstanceOf("Blob",e)?o=r.createObjectURL(t=e):(o=t,a&&a.crossOrigin&&(n.crossOrigin=a.crossOrigin)),n.src=o},a),n):r.isInstanceOf("Blob",t)||r.isInstanceOf("File",t)?(o=n._objectURL=r.createObjectURL(t))?(n.src=o,n):r.readFile(t,function(e){var t=e.target;t&&t.result?n.src=t.result:i&&i(e)}):void 0}var t=o.createObjectURL&&o||o.URL&&URL.revokeObjectURL&&URL||o.webkitURL&&webkitURL;function n(e,t){!e._objectURL||t&&t.noRevoke||(r.revokeObjectURL(e._objectURL),delete e._objectURL)}r.fetchBlob=function(e,t){t()},r.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},r.transform=function(e,t,i,a,o){i(e,o)},r.onerror=function(e,t,i,a,o){n(e,o),a&&a.call(e,t)},r.onload=function(e,t,i,a,o){n(e,o),a&&r.transform(e,o,a,i,{originalWidth:e.naturalWidth||e.width,originalHeight:e.naturalHeight||e.height})},r.createObjectURL=function(e){return!!t&&t.createObjectURL(e)},r.revokeObjectURL=function(e){return!!t&&t.revokeObjectURL(e)},r.readFile=function(e,t,i){if(o.FileReader){var a=new FileReader;if(a.onload=a.onerror=t,a[i=i||"readAsDataURL"])return a[i](e),a}return!1},"function"==typeof define&&define.amd?define(function(){return r}):"object"==typeof module&&module.exports?module.exports=r:o.loadImage=r}("undefined"!=typeof window&&window||this),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):"object"==typeof module&&module.exports?e(require("./load-image")):e(window.loadImage)}(function(I){"use strict";var n=I.transform;I.transform=function(e,t,i,a,o){n.call(I,I.scale(e,t,o),t,i,a,o)},I.transformCoordinates=function(){},I.getTransformedOptions=function(e,t){var i,a,o,n,r=t.aspectRatio;if(!r)return t;for(a in i={},t)Object.prototype.hasOwnProperty.call(t,a)&&(i[a]=t[a]);return i.crop=!0,r<(o=e.naturalWidth||e.width)/(n=e.naturalHeight||e.height)?(i.maxWidth=n*r,i.maxHeight=n):(i.maxWidth=o,i.maxHeight=o/r),i},I.renderImageToCanvas=function(e,t,i,a,o,n,r,s,l,c){return e.getContext("2d").drawImage(t,i,a,o,n,r,s,l,c),e},I.hasCanvasOption=function(e){return e.canvas||e.crop||!!e.aspectRatio},I.scale=function(e,t,i){t=t||{};var a,o,n,r,s,l,c,d,u,f,g,p=document.createElement("canvas"),h=e.getContext||I.hasCanvasOption(t)&&p.getContext,m=e.naturalWidth||e.width,b=e.naturalHeight||e.height,y=m,S=b;function x(){var e=Math.max((n||y)/y,(r||S)/S);1r.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(a=p.metaDataParsers.jpeg[t])for(o=0;oe.byteLength))return g.createObjectURL(new Blob([e.buffer.slice(t,t+i)]));console.log("Invalid Exif data: Invalid thumbnail data.")},g.exifTagTypes={1:{getValue:function(e,t){return e.getUint8(t)},size:1},2:{getValue:function(e,t){return String.fromCharCode(e.getUint8(t))},size:1,ascii:!0},3:{getValue:function(e,t,i){return e.getUint16(t,i)},size:2},4:{getValue:function(e,t,i){return e.getUint32(t,i)},size:4},5:{getValue:function(e,t,i){return e.getUint32(t,i)/e.getUint32(t+4,i)},size:8},9:{getValue:function(e,t,i){return e.getInt32(t,i)},size:4},10:{getValue:function(e,t,i){return e.getInt32(t,i)/e.getInt32(t+4,i)},size:8}},g.exifTagTypes[7]=g.exifTagTypes[1],g.getExifValue=function(e,t,i,a,o,n){var r,s,l,c,d,u,f=g.exifTagTypes[a];if(f){if(!((s=4<(r=f.size*o)?t+e.getUint32(i+8,n):i+8)+r>e.byteLength)){if(1===o)return f.getValue(e,s,n);for(l=[],c=0;ce.byteLength)console.log("Invalid Exif data: Invalid directory offset.");else{if(!((r=i+2+12*(n=e.getUint16(i,a)))+4>e.byteLength)){for(s=0;se.byteLength)console.log("Invalid Exif data: Invalid segment size.");else if(0===e.getUint16(t+8)){switch(e.getUint16(l)){case 18761:n=!0;break;case 19789:n=!1;break;default:return void console.log("Invalid Exif data: Invalid byte alignment marker.")}42===e.getUint16(l+2,n)?(r=e.getUint32(l+4,n),a.exif=new g.ExifMap,(r=g.parseExifTags(e,l,l+r,n,a))&&!o.disableExifThumbnail&&(s={exif:{}},r=g.parseExifTags(e,l,l+r,n,s),s.exif[513]&&(a.exif.Thumbnail=g.getExifThumbnail(e,l+s.exif[513],s.exif[514]))),a.exif[34665]&&!o.disableExifSub&&g.parseExifTags(e,l,l+a.exif[34665],n,a),a.exif[34853]&&!o.disableExifGps&&g.parseExifTags(e,l,l+a.exif[34853],n,a)):console.log("Invalid Exif data: Missing TIFF marker.")}else console.log("Invalid Exif data: Missing byte alignment offset.")}},g.metaDataParsers.jpeg[65505].push(g.parseExifData)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-exif"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-exif")):e(window.loadImage)}(function(e){"use strict";e.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},e.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Undefined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},e.ExifMap.prototype.getText=function(e){var t=this.get(e);switch(e){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":case"Orientation":return this.stringValues[e][t];case"ExifVersion":case"FlashpixVersion":if(!t)return;return String.fromCharCode(t[0],t[1],t[2],t[3]);case"ComponentsConfiguration":if(!t)return;return this.stringValues[e][t[0]]+this.stringValues[e][t[1]]+this.stringValues[e][t[2]]+this.stringValues[e][t[3]];case"GPSVersionID":if(!t)return;return t[0]+"."+t[1]+"."+t[2]+"."+t[3]}return String(t)},function(e){var t,i=e.tags,a=e.map;for(t in i)Object.prototype.hasOwnProperty.call(i,t)&&(a[i[t]]=t)}(e.ExifMap.prototype),e.ExifMap.prototype.getAll=function(){var e,t,i={};for(e in this)Object.prototype.hasOwnProperty.call(this,e)&&(t=this.tags[e])&&(i[t]=this.getText(t));return i}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(u){"use strict";u.IptcMap=function(){return this},u.IptcMap.prototype.map={ObjectName:5},u.IptcMap.prototype.get=function(e){return this[e]||this[this.map[e]]},u.parseIptcTags=function(e,t,i,a){function o(e,t,i){for(var a="",o=t;o 3.2' -# Use sqlite3 as the database for Active Record -gem 'sqlite3' -# Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' -# Use CoffeeScript for .coffee assets and views -gem 'coffee-rails' -# Use jquery as the JavaScript library -gem 'jquery-rails' -# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks -gem 'jbuilder', '~> 2.0' - -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Unicorn as the app server -# gem 'unicorn' - -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development - -group :development, :test do - - # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem 'spring' - gem 'rspec-rails' - gem 'ruby-debug-ide' - gem 'valid_attribute' - gem 'capybara' - gem 'capybara-webkit' - gem 'selenium-webdriver' - gem 'factory_girl_rails' - gem 'launchy' - gem 'database_cleaner' - gem 'rb-fsevent', '~> 0.9.1' - gem 'guard-rspec' -end - -gem 'mongoid' -gem 'cloudinary', '~> 1.1' -gem 'attachinary', :path => '../..' -gem 'simple_form' - diff --git a/spec/dummy/Gemfile.lock b/spec/dummy/Gemfile.lock deleted file mode 100644 index 4fe32805..00000000 --- a/spec/dummy/Gemfile.lock +++ /dev/null @@ -1,250 +0,0 @@ -PATH - remote: ../.. - specs: - attachinary (1.3.1) - cloudinary (~> 1.1.0) - rails (>= 3.2) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.2.22) - actionpack (= 3.2.22) - mail (~> 2.5.4) - actionpack (3.2.22) - activemodel (= 3.2.22) - activesupport (= 3.2.22) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.22) - activesupport (= 3.2.22) - builder (~> 3.0.0) - activerecord (3.2.22) - activemodel (= 3.2.22) - activesupport (= 3.2.22) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.22) - activemodel (= 3.2.22) - activesupport (= 3.2.22) - activesupport (3.2.22) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) - addressable (2.3.8) - arel (3.0.3) - aws_cf_signer (0.1.3) - builder (3.0.4) - capybara (2.4.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - capybara-webkit (1.6.0) - capybara (>= 2.3.0, < 2.5.0) - json - childprocess (0.5.6) - ffi (~> 1.0, >= 1.0.11) - cloudinary (1.1.0) - aws_cf_signer - rest-client - coderay (1.1.0) - coffee-rails (3.2.2) - coffee-script (>= 2.2.0) - railties (~> 3.2.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.9.1.1) - database_cleaner (1.4.1) - diff-lcs (1.2.5) - domain_name (0.5.24) - unf (>= 0.0.5, < 1.0.0) - erubis (2.7.0) - execjs (2.5.2) - factory_girl (4.5.0) - activesupport (>= 3.0.0) - factory_girl_rails (4.5.0) - factory_girl (~> 4.5.0) - railties (>= 3.0.0) - ffi (1.9.10) - formatador (0.2.5) - guard (2.12.9) - formatador (>= 0.2.4) - listen (>= 2.7, <= 4.0) - lumberjack (~> 1.0) - nenv (~> 0.1) - notiffany (~> 0.0) - pry (>= 0.9.12) - shellany (~> 0.0) - thor (>= 0.18.1) - guard-compat (1.2.1) - guard-rspec (4.6.3) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) - hike (1.2.3) - http-cookie (1.0.2) - domain_name (~> 0.5) - i18n (0.7.0) - jbuilder (2.3.1) - activesupport (>= 3.0.0, < 5) - multi_json (~> 1.2) - journey (1.0.4) - jquery-rails (3.1.3) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.3) - launchy (2.4.3) - addressable (~> 2.3) - listen (3.0.3) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - lumberjack (1.0.9) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - method_source (0.8.2) - mime-types (1.25.1) - mini_portile (0.6.2) - mongoid (3.1.7) - activemodel (~> 3.2) - moped (~> 1.4) - origin (~> 1.0) - tzinfo (~> 0.3.29) - moped (1.5.2) - multi_json (1.11.2) - nenv (0.2.0) - netrc (0.10.3) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - notiffany (0.0.6) - nenv (~> 0.1) - shellany (~> 0.0) - origin (1.1.0) - polyglot (0.3.5) - pry (0.10.1) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - rack (1.4.7) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.4) - rack - rack-test (0.6.3) - rack (>= 1.0) - rails (3.2.22) - actionmailer (= 3.2.22) - actionpack (= 3.2.22) - activerecord (= 3.2.22) - activeresource (= 3.2.22) - activesupport (= 3.2.22) - bundler (~> 1.0) - railties (= 3.2.22) - railties (3.2.22) - actionpack (= 3.2.22) - activesupport (= 3.2.22) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.4.2) - rb-fsevent (0.9.5) - rb-inotify (0.9.5) - ffi (>= 0.5.0) - rdoc (3.12.2) - json (~> 1.4) - rest-client (1.8.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) - rspec (3.3.0) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-core (3.3.2) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-rails (3.3.3) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - ruby-debug-ide (0.4.32) - rake (>= 0.8.1) - rubyzip (1.1.7) - selenium-webdriver (2.47.1) - childprocess (~> 0.5) - multi_json (~> 1.0) - rubyzip (~> 1.0) - websocket (~> 1.0) - shellany (0.0.1) - simple_form (2.1.2) - actionpack (~> 3.0) - activemodel (~> 3.0) - slop (3.6.0) - spring (1.3.6) - sprockets (2.2.3) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.10) - thor (0.19.1) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.44) - uglifier (2.7.1) - execjs (>= 0.3.0) - json (>= 1.8.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.1) - valid_attribute (2.0.0) - websocket (1.2.2) - xpath (2.0.0) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - attachinary! - capybara - capybara-webkit - cloudinary (~> 1.1) - coffee-rails - database_cleaner - factory_girl_rails - guard-rspec - jbuilder (~> 2.0) - jquery-rails - launchy - mongoid - rails (~> 3.2) - rb-fsevent (~> 0.9.1) - rspec-rails - ruby-debug-ide - selenium-webdriver - simple_form - spring - sqlite3 - uglifier (>= 1.3.0) - valid_attribute diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb index 003a4bcf..92ac6014 100644 --- a/spec/dummy/config/boot.rb +++ b/spec/dummy/config/boot.rb @@ -3,7 +3,12 @@ end require 'rubygems' -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +gemfile = File.expand_path('../../../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +if File.exist?(gemfile) + ENV['BUNDLE_GEMFILE'] = gemfile + require 'bundler' + Bundler.setup +end + +$:.unshift File.expand_path('../../../../lib', __FILE__) diff --git a/spec/dummy/spec/rails_helper.rb b/spec/dummy/spec/rails_helper.rb deleted file mode 100644 index d6720cee..00000000 --- a/spec/dummy/spec/rails_helper.rb +++ /dev/null @@ -1,48 +0,0 @@ -# This file is copied to spec/ when you run 'rails generate rspec:install' -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) -# Prevent database truncation if the environment is production -abort("The Rails environment is running in production mode!") if Rails.env.production? -require 'spec_helper' -require 'rspec/rails' -# Add additional requires below this line. Rails is not loaded until this point! -require '../spec_helper.rb' -# Requires supporting ruby files with custom matchers and macros, etc, in -# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are -# run as spec files by default. This means that files in spec/support that end -# in _spec.rb will both be required and run as specs, causing the specs to be -# run twice. It is recommended that you do not name files matching this glob to -# end with _spec.rb. You can configure this pattern with the --pattern -# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. -# -# The following line is provided for convenience purposes. It has the downside -# of increasing the boot-up time by auto-requiring all files in the support -# directory. Alternatively, in the individual `*_spec.rb` files, manually -# require only the support files necessary. -# -# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } - -RSpec.configure do |config| - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" - - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true - - # RSpec Rails can automatically mix in different behaviours to your tests - # based on their file location, for example enabling you to call `get` and - # `post` in specs under `spec/controllers`. - # - # You can disable this behaviour by removing the line below, and instead - # explicitly tag your specs with their type, e.g.: - # - # RSpec.describe UsersController, :type => :controller do - # # ... - # end - # - # The different available types are documented in the features, such as in - # https://relishapp.com/rspec/rspec-rails/docs - config.infer_spec_type_from_file_location! -end diff --git a/spec/dummy/spec/spec_helper.rb b/spec/dummy/spec/spec_helper.rb deleted file mode 100644 index 913e28a6..00000000 --- a/spec/dummy/spec/spec_helper.rb +++ /dev/null @@ -1,92 +0,0 @@ -# This file was generated by the `rails generate rspec:install` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause -# this file to always be loaded, without a need to explicitly require it in any -# files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need -# it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - -# The settings below are suggested to provide a good initial experience -# with RSpec, but feel free to customize to your heart's content. -=begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Allows RSpec to persist some state between runs in order to support - # the `--only-failures` and `--next-failure` CLI options. We recommend - # you configure your source control system to ignore this file. - config.example_status_persistence_file_path = "spec/examples.txt" - - # Limits the available syntax to the non-monkey patched syntax that is - # recommended. For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed -=end -end diff --git a/spec/dummy4/.bowerrc b/spec/dummy4/.bowerrc deleted file mode 100644 index 69fbc34f..00000000 --- a/spec/dummy4/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "vendor/assets/components" -} diff --git a/spec/dummy4/.gitignore b/spec/dummy4/.gitignore deleted file mode 100644 index 8f742059..00000000 --- a/spec/dummy4/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# See https://help.github.com/articles/ignoring-files for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore the default SQLite database. -/db/*.sqlite3 -/db/*.sqlite3-journal - -# Ignore all logfiles and tempfiles. -/log/* -!/log/.keep -/tmp -*/cloudinary.yml -vendor/assets/ -db/ diff --git a/spec/dummy4/Gemfile b/spec/dummy4/Gemfile deleted file mode 100644 index 778cfae5..00000000 --- a/spec/dummy4/Gemfile +++ /dev/null @@ -1,62 +0,0 @@ -source 'https://rubygems.org' - - -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.3' -# Use sqlite3 as the database for Active Record -gem 'sqlite3' -# Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' -# Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' -# Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.1.0' -# See https://github.com/rails/execjs#readme for more supported runtimes -# gem 'therubyracer', platforms: :ruby - -# Use jquery as the JavaScript library -gem 'jquery-rails' -# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks -gem 'turbolinks' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.0' -# bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc - -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Unicorn as the app server -# gem 'unicorn' - -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development - -group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug' - - # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console', '~> 2.0' - - # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem 'spring' - gem 'rspec-rails' - gem 'ruby-debug-ide' - gem 'debase' - gem 'valid_attribute' - gem 'capybara' - gem 'capybara-webkit' - gem 'selenium-webdriver' - gem 'factory_girl_rails' - gem 'launchy' - gem 'database_cleaner' - gem 'rb-fsevent', '~> 0.9.1' - gem 'guard-rspec' -end - -gem 'mongoid' -gem 'cloudinary', '~> 1.1' -gem 'attachinary', :path => '../..' -gem 'bootstrap-sass', '~> 3.3.5' -gem 'simple_form' \ No newline at end of file diff --git a/spec/dummy4/Gemfile.lock b/spec/dummy4/Gemfile.lock deleted file mode 100644 index bc0019d5..00000000 --- a/spec/dummy4/Gemfile.lock +++ /dev/null @@ -1,306 +0,0 @@ -PATH - remote: ../.. - specs: - attachinary (1.3.1) - cloudinary (~> 1.1.0) - rails (>= 3.2) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.3) - actionview (= 4.2.3) - activesupport (= 4.2.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.3) - activesupport (= 4.2.3) - globalid (>= 0.3.0) - activemodel (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) - activerecord (4.2.3) - activemodel (= 4.2.3) - activesupport (= 4.2.3) - arel (~> 6.0) - activesupport (4.2.3) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.3.8) - arel (6.0.2) - autoprefixer-rails (5.2.1.1) - execjs - json - aws_cf_signer (0.1.3) - binding_of_caller (0.7.2) - debug_inspector (>= 0.0.1) - bootstrap-sass (3.3.5.1) - autoprefixer-rails (>= 5.0.0.1) - sass (>= 3.3.0) - bson (3.2.4) - builder (3.2.2) - byebug (5.0.0) - columnize (= 0.9.0) - capybara (2.5.0) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - capybara-webkit (1.7.1) - capybara (>= 2.3.0, < 2.6.0) - json - childprocess (0.5.6) - ffi (~> 1.0, >= 1.0.11) - cloudinary (1.1.0) - aws_cf_signer - rest-client - coderay (1.1.0) - coffee-rails (4.1.0) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.9.1.1) - columnize (0.9.0) - database_cleaner (1.5.0) - debase (0.2.1) - debase-ruby_core_source - debase-ruby_core_source (0.7.10) - debug_inspector (0.0.2) - diff-lcs (1.2.5) - domain_name (0.5.24) - unf (>= 0.0.5, < 1.0.0) - erubis (2.7.0) - execjs (2.5.2) - factory_girl (4.5.0) - activesupport (>= 3.0.0) - factory_girl_rails (4.5.0) - factory_girl (~> 4.5.0) - railties (>= 3.0.0) - ffi (1.9.10) - formatador (0.2.5) - globalid (0.3.5) - activesupport (>= 4.1.0) - guard (2.13.0) - formatador (>= 0.2.4) - listen (>= 2.7, <= 4.0) - lumberjack (~> 1.0) - nenv (~> 0.1) - notiffany (~> 0.0) - pry (>= 0.9.12) - shellany (~> 0.0) - thor (>= 0.18.1) - guard-compat (1.2.1) - guard-rspec (4.6.4) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) - http-cookie (1.0.2) - domain_name (~> 0.5) - i18n (0.7.0) - jbuilder (2.3.1) - activesupport (>= 3.0.0, < 5) - multi_json (~> 1.2) - jquery-rails (4.0.4) - rails-dom-testing (~> 1.0) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) - json (1.8.3) - launchy (2.4.3) - addressable (~> 2.3) - listen (3.0.3) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - loofah (2.0.2) - nokogiri (>= 1.5.9) - lumberjack (1.0.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - method_source (0.8.2) - mime-types (2.6.1) - mini_portile (0.6.2) - minitest (5.7.0) - mongo (2.1.1) - bson (~> 3.0) - mongoid (5.0.0) - activemodel (~> 4.0) - mongo (~> 2.1) - origin (~> 2.1) - tzinfo (>= 0.3.37) - multi_json (1.11.2) - nenv (0.2.0) - netrc (0.10.3) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - notiffany (0.0.8) - nenv (~> 0.1) - shellany (~> 0.0) - origin (2.1.1) - pry (0.10.2) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - rack (1.6.4) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.3) - actionmailer (= 4.2.3) - actionpack (= 4.2.3) - actionview (= 4.2.3) - activejob (= 4.2.3) - activemodel (= 4.2.3) - activerecord (= 4.2.3) - activesupport (= 4.2.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.3) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.6) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) - loofah (~> 2.0) - railties (4.2.3) - actionpack (= 4.2.3) - activesupport (= 4.2.3) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rb-fsevent (0.9.6) - rb-inotify (0.9.5) - ffi (>= 0.5.0) - rdoc (4.2.0) - json (~> 1.4) - rest-client (1.8.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) - rspec (3.3.0) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-core (3.3.2) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-rails (3.3.3) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - ruby-debug-ide (0.6.0) - rake (>= 0.8.1) - rubyzip (1.1.7) - sass (3.4.16) - sass-rails (5.0.3) - railties (>= 4.0.0, < 5.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (~> 1.1) - sdoc (0.4.1) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) - selenium-webdriver (2.47.1) - childprocess (~> 0.5) - multi_json (~> 1.0) - rubyzip (~> 1.0) - websocket (~> 1.0) - shellany (0.0.1) - simple_form (3.2.0) - actionpack (~> 4.0) - activemodel (~> 4.0) - slop (3.6.0) - spring (1.3.6) - sprockets (3.2.0) - rack (~> 1.0) - sprockets-rails (2.3.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.10) - thor (0.19.1) - thread_safe (0.3.5) - tilt (1.4.1) - turbolinks (2.5.3) - coffee-rails - tzinfo (1.2.2) - thread_safe (~> 0.1) - uglifier (2.7.1) - execjs (>= 0.3.0) - json (>= 1.8.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.1) - valid_attribute (2.0.0) - web-console (2.2.1) - activemodel (>= 4.0) - binding_of_caller (>= 0.7.2) - railties (>= 4.0) - sprockets-rails (>= 2.0, < 4.0) - websocket (1.2.2) - xpath (2.0.0) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - attachinary! - bootstrap-sass (~> 3.3.5) - byebug - capybara - capybara-webkit - cloudinary (~> 1.1) - coffee-rails (~> 4.1.0) - database_cleaner - debase - factory_girl_rails - guard-rspec - jbuilder (~> 2.0) - jquery-rails - launchy - mongoid - rails (= 4.2.3) - rb-fsevent (~> 0.9.1) - rspec-rails - ruby-debug-ide - sass-rails (~> 5.0) - sdoc (~> 0.4.0) - selenium-webdriver - simple_form - spring - sqlite3 - turbolinks - uglifier (>= 1.3.0) - valid_attribute - web-console (~> 2.0) diff --git a/spec/dummy4/README.rdoc b/spec/dummy4/README.rdoc deleted file mode 100644 index dd4e97e2..00000000 --- a/spec/dummy4/README.rdoc +++ /dev/null @@ -1,28 +0,0 @@ -== README - -This README would normally document whatever steps are necessary to get the -application up and running. - -Things you may want to cover: - -* Ruby version - -* System dependencies - -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... - - -Please feel free to use a different markup language if you do not plan to run -rake doc:app. diff --git a/spec/dummy4/Rakefile b/spec/dummy4/Rakefile deleted file mode 100644 index ba6b733d..00000000 --- a/spec/dummy4/Rakefile +++ /dev/null @@ -1,6 +0,0 @@ -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -Rails.application.load_tasks diff --git a/spec/dummy4/app/active_record/note.rb b/spec/dummy4/app/active_record/note.rb deleted file mode 100644 index 5b834014..00000000 --- a/spec/dummy4/app/active_record/note.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Note < ActiveRecord::Base - - has_attachment :photo, accept: [:jpg, :png, :gif] - has_attachments :images, accept: [:jpg, :png, :gif], maximum: 3 - - validates :body, presence: true, length: { minimum: 4, maximum: 128 } - validates :photo, presence: true - -end diff --git a/spec/dummy4/app/assets/images/.keep b/spec/dummy4/app/assets/images/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/app/assets/javascripts/application.js b/spec/dummy4/app/assets/javascripts/application.js deleted file mode 100644 index ecd496c9..00000000 --- a/spec/dummy4/app/assets/javascripts/application.js +++ /dev/null @@ -1,31 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require jquery -//= require jquery_ujs -//= require turbolinks -//= require bootstrap-sprockets -//= require blueimp-file-upload/js/vendor/jquery.ui.widget -//= require blueimp-file-upload/js/jquery.iframe-transport -//= require blueimp-file-upload/js/jquery.fileupload -//= require cloudinary/jquery.cloudinary -//= require attachinary - -//= require_tree . - - -//jQuery(function() { - $(document).on('ready page:chagne page:load', function(e){ - $('.attachinary-input').attachinary(); - }); - -//}); diff --git a/spec/dummy4/app/assets/javascripts/notes.coffee b/spec/dummy4/app/assets/javascripts/notes.coffee deleted file mode 100644 index 24f83d18..00000000 --- a/spec/dummy4/app/assets/javascripts/notes.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/spec/dummy4/app/assets/stylesheets/application.scss b/spec/dummy4/app/assets/stylesheets/application.scss deleted file mode 100644 index 0271321c..00000000 --- a/spec/dummy4/app/assets/stylesheets/application.scss +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any styles - * defined in the other CSS/SCSS files in this directory. It is generally better to create a new - * file per style scope. - * - */ - -// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables" -@import "bootstrap-sprockets"; -@import "bootstrap"; -@import "notes"; diff --git a/spec/dummy4/app/assets/stylesheets/notes.scss b/spec/dummy4/app/assets/stylesheets/notes.scss deleted file mode 100644 index 56d31f58..00000000 --- a/spec/dummy4/app/assets/stylesheets/notes.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the notes controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/spec/dummy4/app/assets/stylesheets/scaffolds.scss b/spec/dummy4/app/assets/stylesheets/scaffolds.scss deleted file mode 100644 index ed7a765d..00000000 --- a/spec/dummy4/app/assets/stylesheets/scaffolds.scss +++ /dev/null @@ -1,73 +0,0 @@ -body { - background-color: #fff; - color: #333; - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; -} - -p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; -} - -pre { - background-color: #eee; - padding: 10px; - font-size: 11px; -} - -a { - color: #000; - - &:visited { - color: #666; - } - - &:hover { - color: #fff; - background-color: #000; - } -} - -div { - &.field, &.actions { - margin-bottom: 10px; - } -} - -#notice { - color: green; -} - -.field_with_errors { - padding: 2px; - background-color: red; - display: table; -} - -#error_explanation { - width: 450px; - border: 2px solid red; - padding: 7px; - padding-bottom: 0; - margin-bottom: 20px; - background-color: #f0f0f0; - - h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - margin-bottom: 0px; - background-color: #c00; - color: #fff; - } - - ul li { - font-size: 12px; - list-style: square; - } -} diff --git a/spec/dummy4/app/controllers/application_controller.rb b/spec/dummy4/app/controllers/application_controller.rb deleted file mode 100644 index d83690e1..00000000 --- a/spec/dummy4/app/controllers/application_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception -end diff --git a/spec/dummy4/app/controllers/concerns/.keep b/spec/dummy4/app/controllers/concerns/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/app/controllers/notes_controller.rb b/spec/dummy4/app/controllers/notes_controller.rb deleted file mode 100644 index 622ab151..00000000 --- a/spec/dummy4/app/controllers/notes_controller.rb +++ /dev/null @@ -1,74 +0,0 @@ -class NotesController < ApplicationController - before_action :set_note, only: [:show, :edit, :update, :destroy] - - # GET /notes - # GET /notes.json - def index - @notes = Note.all - end - - # GET /notes/1 - # GET /notes/1.json - def show - end - - # GET /notes/new - def new - @note = Note.new - end - - # GET /notes/1/edit - def edit - end - - # POST /notes - # POST /notes.json - def create - @note = Note.new(note_params) - - respond_to do |format| - if @note.save - format.html { redirect_to notes_url, notice: 'Note was successfully created.' } - format.json { render :show, status: :created, location: @note } - else - format.html { render :new } - format.json { render json: @note.errors, status: :unprocessable_entity } - end - end - end - - # PATCH/PUT /notes/1 - # PATCH/PUT /notes/1.json - def update - respond_to do |format| - if @note.update(note_params) - format.html { redirect_to notes_url, notice: 'Note was successfully updated.' } - format.json { render :show, status: :ok, location: @note } - else - format.html { render :edit } - format.json { render json: @note.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /notes/1 - # DELETE /notes/1.json - def destroy - @note.destroy - respond_to do |format| - format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' } - format.json { head :no_content } - end - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_note - @note = Note.find(params[:id]) - end - - # Never trust parameters from the scary internet, only allow the white list through. - def note_params - params.require(:note).permit(:body, :photo, :images => []) - end -end diff --git a/spec/dummy4/app/helpers/application_helper.rb b/spec/dummy4/app/helpers/application_helper.rb deleted file mode 100644 index de6be794..00000000 --- a/spec/dummy4/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/spec/dummy4/app/helpers/notes_helper.rb b/spec/dummy4/app/helpers/notes_helper.rb deleted file mode 100644 index 8078f730..00000000 --- a/spec/dummy4/app/helpers/notes_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module NotesHelper -end diff --git a/spec/dummy4/app/mailers/.keep b/spec/dummy4/app/mailers/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/app/models/.keep b/spec/dummy4/app/models/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/app/models/concerns/.keep b/spec/dummy4/app/models/concerns/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/app/mongoid/note.rb b/spec/dummy4/app/mongoid/note.rb deleted file mode 100644 index 6c7a7bff..00000000 --- a/spec/dummy4/app/mongoid/note.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Note - include Mongoid::Document - include Mongoid::Timestamps - field :body, type: String - - has_attachment :photo, accept: [:jpg, :png, :gif] - has_attachments :images, accept: [:jpg, :png, :gif], maximum: 3 - - validates :body, presence: true, length: { minimum: 5, maximum: 128 } - validates :photo, presence: true -end diff --git a/spec/dummy4/app/views/layouts/application.html.erb b/spec/dummy4/app/views/layouts/application.html.erb deleted file mode 100644 index b38f4c1f..00000000 --- a/spec/dummy4/app/views/layouts/application.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - - - Dummy4 - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= cloudinary_js_config %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/spec/dummy4/app/views/notes/_form.html.erb b/spec/dummy4/app/views/notes/_form.html.erb deleted file mode 100644 index df9187e4..00000000 --- a/spec/dummy4/app/views/notes/_form.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<%= form_for(@note) do |f| %> - <% if @note.errors.any? %> -
-

<%= pluralize(@note.errors.count, "error") %> prohibited this note from being saved:

- -
    - <% @note.errors.full_messages.each do |message| %> -
  • <%= message %>
  • - <% end %> -
-
- <% end %> - -
- <%= f.label :body %>
- <%= f.text_field :body %> -
-
- <%= f.submit %> -
-<% end %> diff --git a/spec/dummy4/app/views/notes/_form_builder.html.erb b/spec/dummy4/app/views/notes/_form_builder.html.erb deleted file mode 100644 index 67d12f21..00000000 --- a/spec/dummy4/app/views/notes/_form_builder.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -<%= form_for note, html: { multipart: true } do |f| %> - - <%= hidden_field_tag 'kind', params[:kind] %> - - <%= f.label 'Body' %> -
- - <%= f.text_field :body %> -
<%= note.errors[:body].first %>
-
- -
- <%= f.attachinary_file_field :photo %> -
<%= note.errors[:photo].first %>
-
- -
- -
- <%= f.attachinary_file_field :images %> -
<%= note.errors[:image].first %>
-
- -
-
- - <%= f.submit %> -<% end %> diff --git a/spec/dummy4/app/views/notes/_form_nojs.html.erb b/spec/dummy4/app/views/notes/_form_nojs.html.erb deleted file mode 100644 index 37b47fcb..00000000 --- a/spec/dummy4/app/views/notes/_form_nojs.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<%= simple_form_for note, html: { novalidate: true, multipart: true } do |f| %> - - <%= hidden_field_tag 'kind', params[:kind] %> - - <%= f.input :body, as: :string %> - -
- <%= f.input :photo, as: :file %> -
- -
- <%= f.input :images, as: :file, input_html: { multiple: true } %> -
- - <%= f.submit %> - -<% end %> diff --git a/spec/dummy4/app/views/notes/_form_raw.html.erb b/spec/dummy4/app/views/notes/_form_raw.html.erb deleted file mode 100644 index 4de66551..00000000 --- a/spec/dummy4/app/views/notes/_form_raw.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -<%= form_for note, html: { multipart: true } do |f| %> - - <%= hidden_field_tag 'kind', params[:kind] %> - - <%= f.label 'Body' %> -
- - <%= f.text_field :body %> -
<%= note.errors[:body].first %>
-
- -
- <%= attachinary_file_field_tag 'note[photo]', note, :photo %> -
<%= note.errors[:photo].first %>
-
- -
- -
- <%= attachinary_file_field_tag 'note[images][]', note, :images %> -
<%= note.errors[:image].first %>
-
- -
-
- - <%= f.submit %> -<% end %> diff --git a/spec/dummy4/app/views/notes/_form_simple_form.html.erb b/spec/dummy4/app/views/notes/_form_simple_form.html.erb deleted file mode 100644 index af39b812..00000000 --- a/spec/dummy4/app/views/notes/_form_simple_form.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<%= simple_form_for note, html: { novalidate: true, multipart: true } do |f| %> - - <%= hidden_field_tag 'kind', params[:kind] %> - - <%= f.input :body, as: :string %> - -
- <%= f.input :photo, as: :attachinary %> -
- -
- <%= f.input :images, as: :attachinary %> -
- - <%= f.submit %> - -<% end %> diff --git a/spec/dummy4/app/views/notes/_note.html.erb b/spec/dummy4/app/views/notes/_note.html.erb deleted file mode 100644 index 81d4142a..00000000 --- a/spec/dummy4/app/views/notes/_note.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -
- <% if note.photo? %> - <%= cl_image_tag note.photo.path, - size: '120x120', crop: :fill, html_width: nil, html_height: nil %>
- - <% note.images.each do |image| %> - <%= cl_image_tag image.path, size: '37x37', crop: :fill, html_width: nil, html_height: nil %> - <% end %> - <% end %>
- <%= note.body %>
- <%= link_to 'edit (raw)', edit_note_path(note, kind: 'raw') %>
- <%= link_to 'edit (builder)', edit_note_path(note, kind: 'builder') %>
- <%= link_to 'edit (simple form)', edit_note_path(note, kind: 'simple_form') %>
- <%= link_to 'delete', note_path(note), method: :delete %> -
diff --git a/spec/dummy4/app/views/notes/edit.html.erb b/spec/dummy4/app/views/notes/edit.html.erb deleted file mode 100644 index ae99480f..00000000 --- a/spec/dummy4/app/views/notes/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render "form_#{params[:kind]}", note: @note %> diff --git a/spec/dummy4/app/views/notes/index.html.erb b/spec/dummy4/app/views/notes/index.html.erb deleted file mode 100644 index 6b074379..00000000 --- a/spec/dummy4/app/views/notes/index.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -

Notes

-

<%= ATTACHINARY_ORM %>

- -
- <%= render @notes %> -
- -
-
-<%= link_to 'create (raw)', new_note_path(kind: 'raw') %>
-<%= link_to 'create (builder)', new_note_path(kind: 'builder') %>
-<%= link_to 'create (simple form)', new_note_path(kind: 'simple_form') %>
-<%= link_to 'create (no javascript)', new_note_path(kind: 'nojs') %>
diff --git a/spec/dummy4/app/views/notes/index.json.jbuilder b/spec/dummy4/app/views/notes/index.json.jbuilder deleted file mode 100644 index 135197c6..00000000 --- a/spec/dummy4/app/views/notes/index.json.jbuilder +++ /dev/null @@ -1,4 +0,0 @@ -json.array!(@notes) do |note| - json.extract! note, :id, :body - json.url note_url(note, format: :json) -end diff --git a/spec/dummy4/app/views/notes/new.html.erb b/spec/dummy4/app/views/notes/new.html.erb deleted file mode 100644 index ae99480f..00000000 --- a/spec/dummy4/app/views/notes/new.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render "form_#{params[:kind]}", note: @note %> diff --git a/spec/dummy4/app/views/notes/show.html.erb b/spec/dummy4/app/views/notes/show.html.erb deleted file mode 100644 index b63267cc..00000000 --- a/spec/dummy4/app/views/notes/show.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

<%= notice %>

- -

- Body: - <%= @note.body %> -

- -<%= link_to 'Edit', edit_note_path(@note) %> | -<%= link_to 'Back', notes_path %> diff --git a/spec/dummy4/app/views/notes/show.json.jbuilder b/spec/dummy4/app/views/notes/show.json.jbuilder deleted file mode 100644 index 85668e3d..00000000 --- a/spec/dummy4/app/views/notes/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.extract! @note, :id, :body, :created_at, :updated_at diff --git a/spec/dummy4/bower.json b/spec/dummy4/bower.json deleted file mode 100644 index 248ee3b3..00000000 --- a/spec/dummy4/bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "dummy4", - "version": "1.2.6", - "homepage": "https://github.com/assembler/attachinary", - "authors": [ - "Amir Tocker " - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "jquery": ">=1.6", - "blueimp-file-upload": ">=7.2.1" - } -} diff --git a/spec/dummy4/config.ru b/spec/dummy4/config.ru deleted file mode 100644 index bd83b254..00000000 --- a/spec/dummy4/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run Rails.application diff --git a/spec/dummy4/config/application.rb b/spec/dummy4/config/application.rb deleted file mode 100644 index 4f24558d..00000000 --- a/spec/dummy4/config/application.rb +++ /dev/null @@ -1,51 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -# Require the gems listed in Gemfile, including any gems -# you've limited to :test, :development, or :production. -Bundler.require(*Rails.groups, ATTACHINARY_ORM) -begin - require "#{ATTACHINARY_ORM}/railtie" -rescue LoadError -end - -require "attachinary" - -module Dummy4 - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) } - config.autoload_paths += [ "#{config.root}/app/#{ATTACHINARY_ORM}" ] - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Do not swallow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true - - config.assets.paths << Rails.root.join('vendor', 'assets', 'components') - if ATTACHINARY_ORM == 'mongoid' - config.generators do |g| - g.orm :mongoid - end - end - end -end diff --git a/spec/dummy4/config/boot.rb b/spec/dummy4/config/boot.rb deleted file mode 100644 index f6162e6d..00000000 --- a/spec/dummy4/config/boot.rb +++ /dev/null @@ -1,7 +0,0 @@ -unless defined?(ATTACHINARY_ORM) - ATTACHINARY_ORM = (ENV["ATTACHINARY_ORM"] || :active_record).to_sym -end - -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/spec/dummy4/config/database.yml b/spec/dummy4/config/database.yml deleted file mode 100644 index 1c1a37ca..00000000 --- a/spec/dummy4/config/database.yml +++ /dev/null @@ -1,25 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# -default: &default - adapter: sqlite3 - pool: 5 - timeout: 5000 - -development: - <<: *default - database: db/development.sqlite3 - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. -test: - <<: *default - database: db/test.sqlite3 - -production: - <<: *default - database: db/production.sqlite3 diff --git a/spec/dummy4/config/environment.rb b/spec/dummy4/config/environment.rb deleted file mode 100644 index ee8d90dc..00000000 --- a/spec/dummy4/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the Rails application. -require File.expand_path('../application', __FILE__) - -# Initialize the Rails application. -Rails.application.initialize! diff --git a/spec/dummy4/config/environments/development.rb b/spec/dummy4/config/environments/development.rb deleted file mode 100644 index b55e2144..00000000 --- a/spec/dummy4/config/environments/development.rb +++ /dev/null @@ -1,41 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Do not eager load code on boot. - config.eager_load = false - - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger. - config.active_support.deprecation = :log - - # Raise an error on page load if there are pending migrations. - config.active_record.migration_error = :page_load - - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true - - # Asset digests allow you to set far-future HTTP expiration dates on all assets, - # yet still be able to expire them through the digest params. - config.assets.digest = true - - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true - - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true -end diff --git a/spec/dummy4/config/environments/production.rb b/spec/dummy4/config/environments/production.rb deleted file mode 100644 index 5c1b32e4..00000000 --- a/spec/dummy4/config/environments/production.rb +++ /dev/null @@ -1,79 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # Code is not reloaded between requests. - config.cache_classes = true - - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. - config.eager_load = true - - # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false - config.action_controller.perform_caching = true - - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like - # NGINX, varnish or squid. - # config.action_dispatch.rack_cache = true - - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? - - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier - # config.assets.css_compressor = :sass - - # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false - - # Asset digests allow you to set far-future HTTP expiration dates on all assets, - # yet still be able to expire them through the digest params. - config.assets.digest = true - - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true - - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. - config.log_level = :debug - - # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) - - # Use a different cache store in production. - # config.cache_store = :mem_cache_store - - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = 'http://assets.example.com' - - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Do not dump schema after migrations. - config.active_record.dump_schema_after_migration = false -end diff --git a/spec/dummy4/config/environments/test.rb b/spec/dummy4/config/environments/test.rb deleted file mode 100644 index 1c19f08b..00000000 --- a/spec/dummy4/config/environments/test.rb +++ /dev/null @@ -1,42 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb. - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false - - # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' - - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment. - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Randomize the order test cases are executed. - config.active_support.test_order = :random - - # Print deprecation notices to the stderr. - config.active_support.deprecation = :stderr - - # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true -end diff --git a/spec/dummy4/config/initializers/assets.rb b/spec/dummy4/config/initializers/assets.rb deleted file mode 100644 index 01ef3e66..00000000 --- a/spec/dummy4/config/initializers/assets.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' - -# Add additional assets to the asset load path -# Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/spec/dummy4/config/initializers/attachinary.rb b/spec/dummy4/config/initializers/attachinary.rb deleted file mode 100644 index 3cbe0cf0..00000000 --- a/spec/dummy4/config/initializers/attachinary.rb +++ /dev/null @@ -1 +0,0 @@ -require "attachinary/orm/#{ATTACHINARY_ORM}" diff --git a/spec/dummy4/config/initializers/backtrace_silencers.rb b/spec/dummy4/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf..00000000 --- a/spec/dummy4/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/spec/dummy4/config/initializers/cookies_serializer.rb b/spec/dummy4/config/initializers/cookies_serializer.rb deleted file mode 100644 index 7f70458d..00000000 --- a/spec/dummy4/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,3 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/spec/dummy4/config/initializers/filter_parameter_logging.rb b/spec/dummy4/config/initializers/filter_parameter_logging.rb deleted file mode 100644 index 4a994e1e..00000000 --- a/spec/dummy4/config/initializers/filter_parameter_logging.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] diff --git a/spec/dummy4/config/initializers/inflections.rb b/spec/dummy4/config/initializers/inflections.rb deleted file mode 100644 index ac033bf9..00000000 --- a/spec/dummy4/config/initializers/inflections.rb +++ /dev/null @@ -1,16 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format. Inflections -# are locale specific, and you may define rules for as many different -# locales as you wish. All of these examples are active by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end - -# These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/spec/dummy4/config/initializers/mime_types.rb b/spec/dummy4/config/initializers/mime_types.rb deleted file mode 100644 index dc189968..00000000 --- a/spec/dummy4/config/initializers/mime_types.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf diff --git a/spec/dummy4/config/initializers/session_store.rb b/spec/dummy4/config/initializers/session_store.rb deleted file mode 100644 index 6822d5e1..00000000 --- a/spec/dummy4/config/initializers/session_store.rb +++ /dev/null @@ -1,3 +0,0 @@ -# Be sure to restart your server when you modify this file. - -Rails.application.config.session_store :cookie_store, key: '_dummy4_session' diff --git a/spec/dummy4/config/initializers/wrap_parameters.rb b/spec/dummy4/config/initializers/wrap_parameters.rb deleted file mode 100644 index 33725e95..00000000 --- a/spec/dummy4/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/spec/dummy4/config/locales/en.yml b/spec/dummy4/config/locales/en.yml deleted file mode 100644 index 06539571..00000000 --- a/spec/dummy4/config/locales/en.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. -# -# To use the locales, use `I18n.t`: -# -# I18n.t 'hello' -# -# In views, this is aliased to just `t`: -# -# <%= t('hello') %> -# -# To use a different locale, set it with `I18n.locale`: -# -# I18n.locale = :es -# -# This would use the information in config/locales/es.yml. -# -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. - -en: - hello: "Hello world" diff --git a/spec/dummy4/config/mongoid.yml b/spec/dummy4/config/mongoid.yml deleted file mode 100644 index 52c373b6..00000000 --- a/spec/dummy4/config/mongoid.yml +++ /dev/null @@ -1,135 +0,0 @@ -development: - # Configure available database clients. (required) - clients: - # Defines the default client. (required) - default: - # Defines the name of the default database that Mongoid can connect to. - # (required). - database: dummy4_development - # Provides the hosts the default client can connect to. Must be an array - # of host:port pairs. (required) - hosts: - - localhost:27017 - options: - # Change the default write concern. (default = { w: 1 }) - # write: - # w: 1 - - # Change the default read preference. Valid options for mode are: :secondary, - # :secondary_preferred, :primary, :primary_preferred, :nearest - # (default: primary) - # read: - # mode: :secondary_preferred - - # The name of the user for authentication. - # user: 'user' - - # The password of the user for authentication. - # password: 'password' - - # The user's database roles. - # roles: - # - 'dbOwner' - - # Change the default authentication mechanism. Valid options are: :scram, - # :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default - # on 2.4 and 2.6 is :plain) - # auth_mech: :scram - - # The database or source to authenticate the user against. (default: admin) - # auth_source: admin - - # Force a the driver cluster to behave in a certain manner instead of auto- - # discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct - # when connecting to hidden members of a replica set. - # connect: :direct - - # Changes the default time in seconds the server monitors refresh their status - # via ismaster commands. (default: 10) - # heartbeat_frequency: 10 - - # The time in seconds for selecting servers for a near read preference. (default: 5) - # local_threshold: 5 - - # The timeout in seconds for selecting a server for an operation. (default: 30) - # server_selection_timeout: 30 - - # The maximum number of connections in the connection pool. (default: 5) - # max_pool_size: 5 - - # The minimum number of connections in the connection pool. (default: 1) - # min_pool_size: 1 - - # The time to wait, in seconds, in the connection pool for a connection - # to be checked in before timing out. (default: 5) - # wait_queue_timeout: 5 - - # The time to wait to establish a connection before timing out, in seconds. - # (default: 5) - # connect_timeout: 5 - - # The timeout to wait to execute operations on a socket before raising an error. - # (default: 5) - # socket_timeout: 5 - - # The name of the replica set to connect to. Servers provided as seeds that do - # not belong to this replica set will be ignored. - # replica_set: name - - # Whether to connect to the servers via ssl. (default: false) - # ssl: true - - # The certificate file used to identify the connection against MongoDB. - # ssl_cert: /path/to/my.cert - - # The private keyfile used to identify the connection against MongoDB. - # Note that even if the key is stored in the same file as the certificate, - # both need to be explicitly specified. - # ssl_key: /path/to/my.key - - # A passphrase for the private key. - # ssl_key_pass_phrase: password - - # Whether or not to do peer certification validation. (default: false) - # ssl_verify: true - - # The file containing a set of concatenated certification authority certifications - # used to validate certs passed from the other end of the connection. - # ssl_ca_cert: /path/to/ca.cert - - - # Configure Mongoid specific options. (optional) - options: - # Includes the root model name in json serialization. (default: false) - # include_root_in_json: false - - # Include the _type field in serialization. (default: false) - # include_type_for_serialization: false - - # Preload all models in development, needed when models use - # inheritance. (default: false) - # preload_models: false - - # Raise an error when performing a #find and the document is not found. - # (default: true) - # raise_not_found_error: true - - # Raise an error when defining a scope with the same name as an - # existing method. (default: false) - # scope_overwrite_exception: false - - # Use Active Support's time zone in conversions. (default: true) - # use_activesupport_time_zone: true - - # Ensure all times are UTC in the app side. (default: false) - # use_utc: false -test: - clients: - default: - database: dummy4_test - hosts: - - localhost:27017 - options: -# read: -# mode: primary - max_pool_size: 1 diff --git a/spec/dummy4/config/routes.rb b/spec/dummy4/config/routes.rb deleted file mode 100644 index a52ead51..00000000 --- a/spec/dummy4/config/routes.rb +++ /dev/null @@ -1,60 +0,0 @@ -Rails.application.routes.draw do - mount Attachinary::Engine => "/attachinary" - resources :notes - root to: 'notes#index' - - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # You can have the root of your site routed with "root" - # root 'welcome#index' - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase - - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable - - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end -end diff --git a/spec/dummy4/config/secrets.yml b/spec/dummy4/config/secrets.yml deleted file mode 100644 index 1a070b31..00000000 --- a/spec/dummy4/config/secrets.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key is used for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! - -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -# You can use `rake secret` to generate a secure secret key. - -# Make sure the secrets in this file are kept private -# if you're sharing your code publicly. - -development: - secret_key_base: b9534cf1d6b32c759212373d798dde4714e4c97d262bace0935c14607666195cf1f0e5ae10307db809cbebec9cffd9ac15125d4cb265032c48cc9731385319a9 - -test: - secret_key_base: d0c21d62451e9aed42658bbaa07bbac349ea37eab8fc5903490fcdffc141d1dac7941827baefde403481920c6b4f01d040d67b30b7f208c501a80fa22fb459d5 - -# Do not keep production secrets in the repository, -# instead read values from the environment. -production: - secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/spec/dummy4/db/seeds.rb b/spec/dummy4/db/seeds.rb deleted file mode 100644 index 4edb1e85..00000000 --- a/spec/dummy4/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/spec/dummy4/lib/assets/.keep b/spec/dummy4/lib/assets/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/lib/tasks/.keep b/spec/dummy4/lib/tasks/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/log/.keep b/spec/dummy4/log/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/public/404.html b/spec/dummy4/public/404.html deleted file mode 100644 index b612547f..00000000 --- a/spec/dummy4/public/404.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - - -
-
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/dummy4/public/422.html b/spec/dummy4/public/422.html deleted file mode 100644 index a21f82b3..00000000 --- a/spec/dummy4/public/422.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - - -
-
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/dummy4/public/500.html b/spec/dummy4/public/500.html deleted file mode 100644 index 061abc58..00000000 --- a/spec/dummy4/public/500.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - - -
-
-

We're sorry, but something went wrong.

-
-

If you are the application owner check the logs for more information.

-
- - diff --git a/spec/dummy4/public/favicon.ico b/spec/dummy4/public/favicon.ico deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/public/robots.txt b/spec/dummy4/public/robots.txt deleted file mode 100644 index 3c9c7c01..00000000 --- a/spec/dummy4/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-agent: * -# Disallow: / diff --git a/spec/dummy4/spec/rails_helper.rb b/spec/dummy4/spec/rails_helper.rb deleted file mode 100644 index cfc75d18..00000000 --- a/spec/dummy4/spec/rails_helper.rb +++ /dev/null @@ -1,53 +0,0 @@ -# This file is copied to spec/ when you run 'rails generate rspec:install' -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../../config/environment', __FILE__) -# Prevent database truncation if the environment is production -abort("The Rails environment is running in production mode!") if Rails.env.production? -require 'spec_helper' -require 'rspec/rails' -# Add additional requires below this line. Rails is not loaded until this point! - -# Requires supporting ruby files with custom matchers and macros, etc, in -# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are -# run as spec files by default. This means that files in spec/support that end -# in _spec.rb will both be required and run as specs, causing the specs to be -# run twice. It is recommended that you do not name files matching this glob to -# end with _spec.rb. You can configure this pattern with the --pattern -# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. -# -# The following line is provided for convenience purposes. It has the downside -# of increasing the boot-up time by auto-requiring all files in the support -# directory. Alternatively, in the individual `*_spec.rb` files, manually -# require only the support files necessary. -# -# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } - -# Checks for pending migrations before tests are run. -# If you are not using ActiveRecord, you can remove this line. -ActiveRecord::Migration.maintain_test_schema! - -RSpec.configure do |config| - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" - - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true - - # RSpec Rails can automatically mix in different behaviours to your tests - # based on their file location, for example enabling you to call `get` and - # `post` in specs under `spec/controllers`. - # - # You can disable this behaviour by removing the line below, and instead - # explicitly tag your specs with their type, e.g.: - # - # RSpec.describe UsersController, :type => :controller do - # # ... - # end - # - # The different available types are documented in the features, such as in - # https://relishapp.com/rspec/rspec-rails/docs - config.infer_spec_type_from_file_location! -end -require '../spec_helper.rb' \ No newline at end of file diff --git a/spec/dummy4/spec/spec_helper.rb b/spec/dummy4/spec/spec_helper.rb deleted file mode 100644 index 913e28a6..00000000 --- a/spec/dummy4/spec/spec_helper.rb +++ /dev/null @@ -1,92 +0,0 @@ -# This file was generated by the `rails generate rspec:install` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause -# this file to always be loaded, without a need to explicitly require it in any -# files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need -# it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - -# The settings below are suggested to provide a good initial experience -# with RSpec, but feel free to customize to your heart's content. -=begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Allows RSpec to persist some state between runs in order to support - # the `--only-failures` and `--next-failure` CLI options. We recommend - # you configure your source control system to ignore this file. - config.example_status_persistence_file_path = "spec/examples.txt" - - # Limits the available syntax to the non-monkey patched syntax that is - # recommended. For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed -=end -end diff --git a/spec/dummy4/test/controllers/.keep b/spec/dummy4/test/controllers/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/test/controllers/notes_controller_test.rb b/spec/dummy4/test/controllers/notes_controller_test.rb deleted file mode 100644 index 76db60fc..00000000 --- a/spec/dummy4/test/controllers/notes_controller_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'test_helper' - -class NotesControllerTest < ActionController::TestCase - setup do - @note = notes(:one) - end - - test "should get index" do - get :index - assert_response :success - assert_not_nil assigns(:notes) - end - - test "should get new" do - get :new - assert_response :success - end - - test "should create note" do - assert_difference('Note.count') do - post :create, note: { body: @note.body } - end - - assert_redirected_to note_path(assigns(:note)) - end - - test "should show note" do - get :show, id: @note - assert_response :success - end - - test "should get edit" do - get :edit, id: @note - assert_response :success - end - - test "should update note" do - patch :update, id: @note, note: { body: @note.body } - assert_redirected_to note_path(assigns(:note)) - end - - test "should destroy note" do - assert_difference('Note.count', -1) do - delete :destroy, id: @note - end - - assert_redirected_to notes_path - end -end diff --git a/spec/dummy4/test/fixtures/.keep b/spec/dummy4/test/fixtures/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/test/fixtures/notes.yml b/spec/dummy4/test/fixtures/notes.yml deleted file mode 100644 index 5bbe4159..00000000 --- a/spec/dummy4/test/fixtures/notes.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - body: MyString - -two: - body: MyString diff --git a/spec/dummy4/test/helpers/.keep b/spec/dummy4/test/helpers/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/test/integration/.keep b/spec/dummy4/test/integration/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/test/mailers/.keep b/spec/dummy4/test/mailers/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/test/models/.keep b/spec/dummy4/test/models/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/test/models/note_test.rb b/spec/dummy4/test/models/note_test.rb deleted file mode 100644 index 7bbab537..00000000 --- a/spec/dummy4/test/models/note_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class NoteTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/spec/dummy4/test/test_helper.rb b/spec/dummy4/test/test_helper.rb deleted file mode 100644 index 92e39b2d..00000000 --- a/spec/dummy4/test/test_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' - -class ActiveSupport::TestCase - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all - - # Add more helper methods to be used by all tests here... -end diff --git a/spec/dummy4/vendor/assets/javascripts/.keep b/spec/dummy4/vendor/assets/javascripts/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/dummy4/vendor/assets/stylesheets/.keep b/spec/dummy4/vendor/assets/stylesheets/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/spec/features/notes_spec.rb b/spec/features/notes_spec.rb index 3574832c..740f4fe4 100644 --- a/spec/features/notes_spec.rb +++ b/spec/features/notes_spec.rb @@ -1,7 +1,7 @@ -require 'rails_helper' +require 'spec_helper' describe 'Notes' do - Capybara.default_wait_time = 15 + describe 'Creating new note' do @@ -10,40 +10,39 @@ visit path end - it 'display an alert if invalid file format is uploaded', :js => true do + it 'checks file type' do within 'div.photo' do - accept_alert 'Invalid file format' do - attach_file 'note[photo]', "#{SPEC_ROOT}/support/A.txt" + handle_alert do |message| + attach_file 'note[photo]', File.expand_path("../../support/A.txt", __FILE__) + Timeout::timeout(5) do + begin + sleep 0.250 + end while alert_message.blank? + alert_message.downcase.should == 'invalid file format' + end end end end - it 'disables input when first photo is uploaded', :js => true do + it 'disables input when first photo is uploaded' do within 'div.photo' do - attach_file "note[photo]", "#{SPEC_ROOT}/support/A.gif" + attach_file "note[photo]", File.expand_path('../../support/A.gif', __FILE__) page.should have_css 'input[disabled]' end end - it 'allows multiple images to be uploaded', :js => true do + it 'allows multiple images to be uploaded' do within 'div.images' do - attach_file "note[images][]", "#{SPEC_ROOT}/support/A.gif" - value = find(:xpath, './/input[@name="note[images][]" and @type="hidden" and contains(@value, \'"A"\')]', :visible => false).value - images = ActiveSupport::JSON.decode( value) - images.length.should be 1 - images.map{|i| i["original_filename"]}.should eq ["A"] - - attach_file "note[images][]", "#{SPEC_ROOT}/support/B.gif" - value = find(:xpath, './/input[@name="note[images][]" and @type="hidden" and contains(@value, \'"B"\')]', :visible => false).value - images = ActiveSupport::JSON.decode( value) - images.length.should be 2 - images.map{|i| i["original_filename"]}.sort.should eq ["A", "B"] + attach_file "note[images][]", File.expand_path('../../support/A.gif', __FILE__) + page.should have_css 'input:not([disabled])' + attach_file "note[images][]", File.expand_path('../../support/B.gif', __FILE__) + page.should have_css 'input:not([disabled])' end end - it 'preserves uploaded photo across postbacks', :js => true do + it 'preserves uploaded photo accross postbacks' do within 'div.photo' do - attach_file "note[photo]", "#{SPEC_ROOT}/support/A.gif" + attach_file "note[photo]", File.expand_path('../../support/A.gif', __FILE__) page.should have_css 'img' end @@ -55,17 +54,17 @@ end end - it 'validates presence of photo', :js => true do + it 'validates presence of photo' do click_button 'Create Note' within 'div.photo' do page.should have_content "can't be blank" end end - it 'saves the record', :js => true do + it 'saves the record' do fill_in 'note[body]', with: 'My Note' within 'div.photo' do - attach_file "note[photo]", "#{SPEC_ROOT}/support/A.gif" + attach_file "note[photo]", File.expand_path('../../support/A.gif', __FILE__) end click_button 'Create Note' diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index adf83350..8322c5fa 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -69,11 +69,11 @@ it 'accepts IO objects' do image = StringIO.new("") file = build(:file) - expected_id = file.public_id + Cloudinary::Uploader.should_receive(:upload).with(image, resource_type: 'auto').and_return(file.attributes) subject.photo = image - subject.photo.public_id.should == expected_id + subject.photo.public_id.should == file.public_id end end @@ -94,9 +94,9 @@ describe '#photo?' do it 'checks whether photo is present' do - subject.photo?.should be_truthy + subject.photo?.should be_true subject.photo = nil - subject.photo?.should be_falsey + subject.photo?.should be_false end end @@ -111,7 +111,7 @@ describe 'image attachments' do describe '#images' do it 'manages images' do - subject.images?.should be_falsey + subject.images?.should be_false image1 = build(:file) subject.images << image1 @@ -135,24 +135,21 @@ it 'accepts IO objects' do images = [1,2].map { StringIO.new("") } files = build_list(:file, images.length) - files_ids = files.map(&:public_id) files.each.with_index do |file, index| Cloudinary::Uploader.should_receive(:upload).with(images[index], resource_type: 'auto').and_return(file.attributes) end subject.images = images - subject.images.map(&:public_id).should =~ files_ids + subject.images.map(&:public_id).should =~ files.map(&:public_id) end end describe '#image_urls=(urls)' do let(:urls) { %w[ 1 2 3 ] } let(:files) { build_list(:file, urls.length) } - let(:files_ids) { files.map(&:public_id)} before do - files_ids files.each.with_index do |file, index| Cloudinary::Uploader.should_receive(:upload).with(urls[index], resource_type: 'auto').and_return(file.attributes) end @@ -160,7 +157,7 @@ it 'upload photos via urls' do subject.image_urls = urls - subject.images.map(&:public_id).should =~ files_ids + subject.images.map(&:public_id).should =~ files.map(&:public_id) end end diff --git a/spec/orm/active_record.rb b/spec/orm/active_record.rb index 5e94eb86..fe7c5905 100644 --- a/spec/orm/active_record.rb +++ b/spec/orm/active_record.rb @@ -1,4 +1,4 @@ ActiveRecord::Migration.verbose = false ActiveRecord::Base.logger = Logger.new(nil) -ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate/") +ActiveRecord::Migrator.migrate(File.expand_path("../../dummy/db/migrate/", __FILE__)) diff --git a/spec/orm/mongoid.rb b/spec/orm/mongoid.rb index ff4fdefb..8b582af3 100644 --- a/spec/orm/mongoid.rb +++ b/spec/orm/mongoid.rb @@ -1 +1,2 @@ Mongoid.logger = Logger.new(nil) +Moped.logger = Logger.new(nil) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f559819e..47fb4d16 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,40 +1,35 @@ # Configure Rails Envinronment ENV["RAILS_ENV"] = "test" -ATTACHINARY_ORM ||= (ENV["ATTACHINARY_ORM"] || :active_record).to_sym +ATTACHINARY_ORM = (ENV["ATTACHINARY_ORM"] || :active_record).to_sym -# $:.unshift File.dirname(__FILE__) -# require 'rspec/rails' -# require "dummy/config/environment.rb" -SPEC_ROOT = "#{::Rails.root}/.." -require "#{SPEC_ROOT}/orm/#{ATTACHINARY_ORM}" +$:.unshift File.dirname(__FILE__) +require "dummy/config/environment.rb" +require "orm/#{ATTACHINARY_ORM}" + +require 'rspec/rails' require 'valid_attribute' require 'capybara/rspec' require 'factory_girl' -require "#{SPEC_ROOT}/factories" +require 'factories' require 'database_cleaner' require "capybara/webkit" Capybara.javascript_driver = :webkit -Capybara::Webkit.configure do |config| - config.allow_url("api.cloudinary.com") - config.allow_url("res.cloudinary.com") -end -# ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../') +ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../') # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. -# Uncomment next line to load all support files, if you have more than one -# Uncomment next line to load all support files, if you have more than one -# Dir[File.join(ENGINE_RAILS_ROOT, "../../spec/support/**/*.rb")].each {|f| require f } -require "#{SPEC_ROOT}/support/request_helpers" +Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f } + + RSpec.configure do |config| - config.color = true + config.color_enabled = true config.treat_symbols_as_metadata_keys_with_true_values = true config.filter_run focus: true config.run_all_when_everything_filtered = true @@ -44,15 +39,15 @@ config.include RequestHelpers, type: :feature config.before(:suite) do - DatabaseCleaner.strategy = :truncation + DatabaseCleaner[ATTACHINARY_ORM].strategy = :truncation end - config.before(:each) do |example| - DatabaseCleaner.start + config.before(:each) do + DatabaseCleaner[ATTACHINARY_ORM].start end config.after(:each) do - DatabaseCleaner.clean + DatabaseCleaner[ATTACHINARY_ORM].clean end config.after(:suite) do