Permalink
Browse files

Add Rails 5.0.0 test fixture

  • Loading branch information...
1 parent 130d422 commit f702769797a34b35c6c331a227f08ea4757338cb @domcleal domcleal committed Jul 15, 2016
Showing with 1,369 additions and 2 deletions.
  1. +2 −2 Rakefile
  2. +21 −0 fixtures/rails5/.gitignore
  3. +52 −0 fixtures/rails5/Gemfile
  4. +24 −0 fixtures/rails5/README.md
  5. +13 −0 fixtures/rails5/Rakefile
  6. +3 −0 fixtures/rails5/app/assets/config/manifest.js
  7. 0 fixtures/rails5/app/assets/images/.keep
  8. +16 −0 fixtures/rails5/app/assets/javascripts/application.js
  9. +13 −0 fixtures/rails5/app/assets/javascripts/cable.js
  10. 0 fixtures/rails5/app/assets/javascripts/channels/.keep
  11. +15 −0 fixtures/rails5/app/assets/stylesheets/application.css
  12. +4 −0 fixtures/rails5/app/channels/application_cable/channel.rb
  13. +4 −0 fixtures/rails5/app/channels/application_cable/connection.rb
  14. +3 −0 fixtures/rails5/app/controllers/application_controller.rb
  15. 0 fixtures/rails5/app/controllers/concerns/.keep
  16. +17 −0 fixtures/rails5/app/controllers/posts_controller.rb
  17. +11 −0 fixtures/rails5/app/controllers/users_controller.rb
  18. +5 −0 fixtures/rails5/app/helpers/application_helper.rb
  19. +2 −0 fixtures/rails5/app/jobs/application_job.rb
  20. +4 −0 fixtures/rails5/app/mailers/application_mailer.rb
  21. +1 −0 fixtures/rails5/app/models
  22. +1 −0 fixtures/rails5/app/views
  23. +3 −0 fixtures/rails5/bin/bundle
  24. +9 −0 fixtures/rails5/bin/rails
  25. +9 −0 fixtures/rails5/bin/rake
  26. +34 −0 fixtures/rails5/bin/setup
  27. +15 −0 fixtures/rails5/bin/spring
  28. +29 −0 fixtures/rails5/bin/update
  29. +5 −0 fixtures/rails5/config.ru
  30. +15 −0 fixtures/rails5/config/application.rb
  31. +3 −0 fixtures/rails5/config/boot.rb
  32. +9 −0 fixtures/rails5/config/cable.yml
  33. +25 −0 fixtures/rails5/config/database.yml
  34. +5 −0 fixtures/rails5/config/environment.rb
  35. +54 −0 fixtures/rails5/config/environments/development.rb
  36. +86 −0 fixtures/rails5/config/environments/production.rb
  37. +42 −0 fixtures/rails5/config/environments/test.rb
  38. +6 −0 fixtures/rails5/config/initializers/application_controller_renderer.rb
  39. +11 −0 fixtures/rails5/config/initializers/assets.rb
  40. +7 −0 fixtures/rails5/config/initializers/backtrace_silencers.rb
  41. +5 −0 fixtures/rails5/config/initializers/cookies_serializer.rb
  42. +4 −0 fixtures/rails5/config/initializers/filter_parameter_logging.rb
  43. +16 −0 fixtures/rails5/config/initializers/inflections.rb
  44. +4 −0 fixtures/rails5/config/initializers/mime_types.rb
  45. +24 −0 fixtures/rails5/config/initializers/new_framework_defaults.rb
  46. +3 −0 fixtures/rails5/config/initializers/session_store.rb
  47. +14 −0 fixtures/rails5/config/initializers/wrap_parameters.rb
  48. +23 −0 fixtures/rails5/config/locales/en.yml
  49. +47 −0 fixtures/rails5/config/puma.rb
  50. +8 −0 fixtures/rails5/config/routes.rb
  51. +22 −0 fixtures/rails5/config/secrets.yml
  52. +6 −0 fixtures/rails5/config/spring.rb
  53. +1 −0 fixtures/rails5/db/migrate
  54. +41 −0 fixtures/rails5/db/schema.rb
  55. +7 −0 fixtures/rails5/db/seeds.rb
  56. 0 fixtures/rails5/lib/assets/.keep
  57. 0 fixtures/rails5/lib/tasks/.keep
  58. 0 fixtures/rails5/log/.keep
  59. +67 −0 fixtures/rails5/public/404.html
  60. +67 −0 fixtures/rails5/public/422.html
  61. +66 −0 fixtures/rails5/public/500.html
  62. 0 fixtures/rails5/public/apple-touch-icon-precomposed.png
  63. 0 fixtures/rails5/public/apple-touch-icon.png
  64. 0 fixtures/rails5/public/favicon.ico
  65. +5 −0 fixtures/rails5/public/robots.txt
  66. 0 fixtures/rails5/test/controllers/.keep
  67. +248 −0 fixtures/rails5/test/controllers/posts_controller_test.rb
  68. +87 −0 fixtures/rails5/test/controllers/users_controller_test.rb
  69. 0 fixtures/rails5/test/fixtures/.keep
  70. 0 fixtures/rails5/test/fixtures/files/.keep
  71. 0 fixtures/rails5/test/helpers/.keep
  72. 0 fixtures/rails5/test/integration/.keep
  73. 0 fixtures/rails5/test/mailers/.keep
  74. 0 fixtures/rails5/test/models/.keep
  75. +26 −0 fixtures/rails5/test/test_helper.rb
  76. 0 fixtures/rails5/tmp/.keep
  77. 0 fixtures/rails5/vendor/assets/javascripts/.keep
  78. 0 fixtures/rails5/vendor/assets/stylesheets/.keep
View
@@ -17,7 +17,7 @@ end
# rake test:setup
# rake test:full
-fixture_list = "{padrino_test,sinatra_test,rails2,rails3,rails3_2,rails4}"
+fixture_list = "{padrino_test,sinatra_test,rails2,rails3,rails3_2,rails4,rails5}"
desc "Clean up the fixtures being tested by cleaning and installing dependencies"
task "test:clean" do
@@ -51,4 +51,4 @@ end
task "test:full" => [:test, "test:fixtures"]
desc "Run tests for rabl"
-task :default => :test
+task :default => :test
@@ -0,0 +1,21 @@
+# 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/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore Byebug command history file.
+.byebug_history
@@ -0,0 +1,52 @@
+source 'https://rubygems.org'
+
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '~> 5.0.0'
+# Use sqlite3 as the database for Active Record
+gem 'sqlite3'
+# Use Puma as the app server
+gem 'puma', '~> 3.0'
+# 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.2'
+# 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 navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
+gem 'turbolinks', '~> 5'
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem 'jbuilder', '~> 2.5'
+# Use Redis adapter to run Action Cable in production
+# gem 'redis', '~> 3.0'
+# Use ActiveModel has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# 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', platform: :mri
+end
+
+group :development do
+ # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
+ gem 'web-console'
+ gem 'listen', '~> 3.0.5'
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem 'spring'
+ gem 'spring-watcher-listen', '~> 2.0.0'
+end
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+
+gem 'rabl', :path => File.expand_path(File.dirname(__FILE__) + "/../../")
+gem 'riot', :group => "test"
+gem 'responders', '~> 2.0'
@@ -0,0 +1,24 @@
+# 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
+
+* ...
@@ -0,0 +1,13 @@
+# 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_relative 'config/application'
+require 'rake/testtask'
+
+Rails.application.load_tasks
+
+Rake::TestTask.new("test:rabl") do |test|
+ test.pattern = "test/controllers/**/*_test.rb"
+ test.verbose = true
+ test.warning = false
+end
@@ -0,0 +1,3 @@
+//= link_tree ../images
+//= link_directory ../javascripts .js
+//= link_directory ../stylesheets .css
@@ -0,0 +1,16 @@
+// 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. JavaScript code in this file should be added after the last require_* statement.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require jquery_ujs
+//= require turbolinks
+//= require_tree .
@@ -0,0 +1,13 @@
+// Action Cable provides the framework to deal with WebSockets in Rails.
+// You can generate new channels where WebSocket features live using the rails generate channel command.
+//
+//= require action_cable
+//= require_self
+//= require_tree ./channels
+
+(function() {
+ this.App || (this.App = {});
+
+ App.cable = ActionCable.createConsumer();
+
+}).call(this);
@@ -0,0 +1,15 @@
+/*
+ * 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 other CSS/SCSS
+ * files in this directory. Styles in this file should be added after the last require_* statement.
+ * It is generally better to create a new file per style scope.
+ *
+ *= require_tree .
+ *= require_self
+ */
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery with: :exception
+end
@@ -0,0 +1,17 @@
+class PostsController < ApplicationController
+
+ respond_to :json, :xml, :html, :rabl_test_v1
+
+ def index
+ @posts = Post.order('id ASC').load
+ end
+
+ def show
+ @post = Post.find(params[:id])
+ end
+
+ def renderer
+ post = Post.find(params[:id])
+ render json: Rabl.render(post, 'posts/renderer', view_path: 'app/views', format: :json, scope: view_context)
+ end
+end
@@ -0,0 +1,11 @@
+class UsersController < ApplicationController
+ respond_to :json
+
+ def index
+ @users = User.order('username ASC').load
+ end
+
+ def show
+ @user = User.find(params[:id])
+ end
+end
@@ -0,0 +1,5 @@
+module ApplicationHelper
+ def helper_foo
+ "BAR!"
+ end
+end
@@ -0,0 +1,2 @@
+class ApplicationJob < ActiveJob::Base
+end
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: 'from@example.com'
+ layout 'mailer'
+end
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+APP_PATH = File.expand_path('../config/application', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+begin
+ load File.expand_path('../spring', __FILE__)
+rescue LoadError => e
+ raise unless e.message.include?('spring')
+end
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+
+# This file loads spring without using Bundler, in order to be fast.
+# It gets overwritten when you run the `spring binstub` command.
+
+unless defined?(Spring)
+ require 'rubygems'
+ require 'bundler'
+
+ if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
+ Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
+ gem 'spring', match[1]
+ require 'spring/binstub'
+ end
+end
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
@@ -0,0 +1,5 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative 'config/environment'
+
+run Rails.application
@@ -0,0 +1,15 @@
+require_relative 'boot'
+
+require 'rails/all'
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module Rails5
+ 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.
+ end
+end
@@ -0,0 +1,3 @@
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+
+require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,9 @@
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: redis://localhost:6379/1
Oops, something went wrong.

0 comments on commit f702769

Please sign in to comment.