Permalink
Browse files

Add initial integration specs

  • Loading branch information...
1 parent 9189836 commit c7ca2c3a87f2c732e5e439ac5f5a7500a2af09bf @joshuaclayton joshuaclayton committed Aug 6, 2012
Showing with 647 additions and 19 deletions.
  1. +5 −4 .gitignore
  2. +1 −0 .rspec
  3. +10 −2 Gemfile
  4. +65 −0 Gemfile.lock
  5. +3 −13 Rakefile
  6. +7 −0 spec/dummy/Rakefile
  7. +17 −0 spec/dummy/app/assets/javascripts/application.js
  8. +14 −0 spec/dummy/app/assets/javascripts/upload.coffee
  9. +13 −0 spec/dummy/app/assets/stylesheets/application.css
  10. +3 −0 spec/dummy/app/controllers/application_controller.rb
  11. +9 −0 spec/dummy/app/controllers/assets_controller.rb
  12. +2 −0 spec/dummy/app/helpers/application_helper.rb
  13. 0 spec/dummy/app/mailers/.gitkeep
  14. 0 spec/dummy/app/models/.gitkeep
  15. +4 −0 spec/dummy/app/models/asset.rb
  16. +14 −0 spec/dummy/app/views/layouts/application.html.erb
  17. +2 −0 spec/dummy/app/views/pages/home.html.erb
  18. +4 −0 spec/dummy/config.ru
  19. +67 −0 spec/dummy/config/application.rb
  20. +10 −0 spec/dummy/config/boot.rb
  21. +25 −0 spec/dummy/config/database.yml
  22. +5 −0 spec/dummy/config/environment.rb
  23. +31 −0 spec/dummy/config/environments/development.rb
  24. +64 −0 spec/dummy/config/environments/production.rb
  25. +35 −0 spec/dummy/config/environments/test.rb
  26. +7 −0 spec/dummy/config/initializers/backtrace_silencers.rb
  27. +15 −0 spec/dummy/config/initializers/inflections.rb
  28. +5 −0 spec/dummy/config/initializers/mime_types.rb
  29. +7 −0 spec/dummy/config/initializers/secret_token.rb
  30. +8 −0 spec/dummy/config/initializers/session_store.rb
  31. +10 −0 spec/dummy/config/initializers/wrap_parameters.rb
  32. +5 −0 spec/dummy/config/locales/en.yml
  33. +5 −0 spec/dummy/config/routes.rb
  34. +9 −0 spec/dummy/db/migrate/20120805021826_create_assets.rb
  35. +25 −0 spec/dummy/db/schema.rb
  36. 0 spec/dummy/lib/assets/.gitkeep
  37. +32 −0 spec/dummy/lib/assets/javascripts/underscore.js
  38. 0 spec/dummy/log/.gitkeep
  39. +26 −0 spec/dummy/public/404.html
  40. +26 −0 spec/dummy/public/422.html
  41. +25 −0 spec/dummy/public/500.html
  42. 0 spec/dummy/public/favicon.ico
  43. BIN spec/dummy/public/ralph.png
  44. +6 −0 spec/dummy/script/rails
  45. +11 −0 spec/integration/upload_spec.rb
  46. +15 −0 spec/spec_helper.rb
View
@@ -1,8 +1,9 @@
.bundle/
log/*.log
pkg/
-test/dummy/db/*.sqlite3
-test/dummy/log/*.log
-test/dummy/tmp/
-test/dummy/.sass-cache
+spec/dummy/db/*.sqlite3
+spec/dummy/log/*.log
+spec/dummy/tmp/
+spec/dummy/.sass-cache
+spec/dummy/public/system
jack_up*.gem
View
1 .rspec
@@ -0,0 +1 @@
+--color
View
12 Gemfile
@@ -5,8 +5,16 @@ source "http://rubygems.org"
# development dependencies will be added by default to the :development group.
gemspec
-# jquery-rails is used by the dummy application
-gem "jquery-rails"
+# The following gems are used by the dummy application
+gem 'database_cleaner'
+gem 'jquery-rails'
+gem 'rack-raw-upload'
+gem 'rspec-rails'
+gem 'capybara'
+gem 'high_voltage'
+gem 'coffee-rails'
+gem 'sqlite3'
+gem 'paperclip', '>= 3.1.4'
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
View
@@ -34,26 +34,61 @@ GEM
activesupport (3.2.7)
i18n (~> 0.6)
multi_json (~> 1.0)
+ addressable (2.3.2)
arel (3.0.2)
builder (3.0.0)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.4)
+ ffi (~> 1.0, >= 1.0.6)
+ cocaine (0.2.1)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.3.3)
+ database_cleaner (0.8.0)
+ diff-lcs (1.1.3)
erubis (2.7.0)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ ffi (1.1.3)
+ high_voltage (1.1.1)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.4)
+ libwebsocket (0.1.5)
+ addressable
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.6)
+ nokogiri (1.5.5)
+ paperclip (3.1.4)
+ activemodel (>= 3.0.0)
+ activerecord (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ cocaine (>= 0.0.2)
+ mime-types
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
+ rack-raw-upload (1.1.0)
+ json
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
@@ -76,20 +111,50 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
+ rspec (2.11.0)
+ rspec-core (~> 2.11.0)
+ rspec-expectations (~> 2.11.0)
+ rspec-mocks (~> 2.11.0)
+ rspec-core (2.11.1)
+ rspec-expectations (2.11.2)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.11.1)
+ rspec-rails (2.11.0)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.11.0)
+ rubyzip (0.9.9)
+ selenium-webdriver (2.25.0)
+ childprocess (>= 0.2.5)
+ libwebsocket (~> 0.1.3)
+ multi_json (~> 1.0)
+ rubyzip
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
+ capybara
+ coffee-rails
+ database_cleaner
+ high_voltage
jack_up!
jquery-rails
+ paperclip (>= 3.1.4)
+ rack-raw-upload
+ rspec-rails
+ sqlite3
View
@@ -20,21 +20,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end
-APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
+APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
-
-
Bundler::GemHelper.install_tasks
-require 'rake/testtask'
-
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.libs << 'test'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = false
-end
-
+RSpec::Core::RakeTask.new(:spec)
-task :default => :test
+task :default => :spec
View
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# 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__)
+
+Dummy::Application.load_tasks
@@ -0,0 +1,17 @@
+// 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 vendor/assets/javascripts of plugins, if any, 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
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require underscore
+//= require jack_up
+//= require_tree .
@@ -0,0 +1,14 @@
+$ ->
+ processor = new JackUp.Processor(path: '/assets')
+
+ processor.on 'upload:imageRenderReady', (e, options) ->
+ options.image.attr("data-id", options.file.__guid__).css(border: '5px solid red')
+ $('.attachments').append(options.image)
+
+ processor.on "upload:sentToServer", (e, options) ->
+ $("img[data-id='#{options.file.__guid__}']").css(borderColor: 'yellow')
+
+ processor.on "upload:success", (e, options) ->
+ $("img[data-id='#{options.file.__guid__}']").css(borderColor: "green")
+
+ $("[name='upload']").jackUpAjax(processor)
@@ -0,0 +1,13 @@
+/*
+ * 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 vendor/assets/stylesheets of plugins, if any, 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 top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require_tree .
+ */
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,9 @@
+class AssetsController < ApplicationController
+ respond_to :json
+
+ def create
+ @asset = Asset.new(file: params[:file])
+ @asset.save
+ respond_with @asset
+ end
+end
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
No changes.
No changes.
@@ -0,0 +1,4 @@
+class Asset < ActiveRecord::Base
+ has_attached_file :file
+ attr_accessible :file
+end
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Dummy</title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
@@ -0,0 +1,2 @@
+<div class='attachments'></div>
+<input type='file' name='upload' />
View
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Dummy::Application
@@ -0,0 +1,67 @@
+require File.expand_path('../boot', __FILE__)
+
+# Pick the frameworks you want:
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "active_resource/railtie"
+require "sprockets/railtie"
+# require "rails/test_unit/railtie"
+
+Bundler.require
+require "jack_up"
+
+module Dummy
+ 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)
+
+ # 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
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ # Enable escaping HTML in JSON.
+ config.active_support.escape_html_entities_in_json = true
+
+ # Use SQL instead of Active Record's schema dumper when creating the database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Enforce whitelist mode for mass assignment.
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
+ # parameters by using an attr_accessible or attr_protected declaration.
+ # config.active_record.whitelist_attributes = true
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
+
+ config.middleware.use 'Rack::RawUpload', paths: ['/assets']
+ end
+end
+
View
@@ -0,0 +1,10 @@
+require 'rubygems'
+gemfile = File.expand_path('../../../../Gemfile', __FILE__)
+
+if File.exist?(gemfile)
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+end
+
+$:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# 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:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Dummy::Application.initialize!
Oops, something went wrong.

0 comments on commit c7ca2c3

Please sign in to comment.