├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── CHANGELOG.md ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── bin ├── console └── setup ├── gemfiles ├── 4.2.gemfile ├── 5.0.gemfile ├── 5.1.gemfile ├── 5.2.gemfile ├── 6.0.gemfile ├── 6.1.gemfile ├── 7.0.gemfile └── 7.1.gemfile ├── lib ├── query_count.rb └── query_count │ ├── controller_runtime.rb │ ├── counter.rb │ ├── railtie.rb │ └── version.rb ├── query_count.gemspec └── spec ├── query_count_spec.rb ├── spec_helper.rb └── support └── dummy_rails_app ├── Rakefile ├── app ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── pages_controller.rb ├── helpers │ └── application_helper.rb ├── models │ ├── application_record.rb │ └── user.rb └── views │ ├── layouts │ └── application.html.erb │ └── pages │ └── main.html.erb ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ └── test.rb └── routes.rb └── db └── migrate └── 01_create_users.rb /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [push, pull_request] 3 | jobs: 4 | tests: 5 | runs-on: ubuntu-latest 6 | strategy: 7 | fail-fast: false 8 | matrix: 9 | include: 10 | # rails 4.2, ruby 2.0, 2.1, 2.3, 2.4, 2.5, 2.6 11 | # ruby 2.2 is excluded due to https://github.com/ruby/setup-ruby/issues/496 12 | - rails: '4.2' 13 | ruby: '2.0' 14 | - rails: '4.2' 15 | ruby: '2.1' 16 | - rails: '4.2' 17 | ruby: '2.3' 18 | - rails: '4.2' 19 | ruby: '2.4' 20 | - rails: '4.2' 21 | ruby: '2.5' 22 | - rails: '4.2' 23 | ruby: '2.6' 24 | # rails 5.0, ruby 2.3, 2.4, 2.5, 2.6, 2.7 25 | - rails: '5.0' 26 | ruby: '2.3' 27 | - rails: '5.0' 28 | ruby: '2.4' 29 | - rails: '5.0' 30 | ruby: '2.5' 31 | - rails: '5.0' 32 | ruby: '2.6' 33 | - rails: '5.0' 34 | ruby: '2.7' 35 | # rails 5.1, ruby 2.3, 2.4, 2.5, 2.6, 2.7 36 | - rails: '5.1' 37 | ruby: '2.3' 38 | - rails: '5.1' 39 | ruby: '2.4' 40 | - rails: '5.1' 41 | ruby: '2.5' 42 | - rails: '5.1' 43 | ruby: '2.6' 44 | - rails: '5.1' 45 | ruby: '2.7' 46 | # rails 5.2, ruby 2.3, 2.4, 2.5, 2.6, 2.7 47 | - rails: '5.2' 48 | ruby: '2.3' 49 | - rails: '5.2' 50 | ruby: '2.4' 51 | - rails: '5.2' 52 | ruby: '2.5' 53 | - rails: '5.2' 54 | ruby: '2.6' 55 | - rails: '5.2' 56 | ruby: '2.7' 57 | # rails 6.0, ruby 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 58 | - rails: '6.0' 59 | ruby: '2.5' 60 | - rails: '6.0' 61 | ruby: '2.6' 62 | - rails: '6.0' 63 | ruby: '2.7' 64 | - rails: '6.0' 65 | ruby: '3.0' 66 | - rails: '6.0' 67 | ruby: '3.1' 68 | - rails: '6.0' 69 | ruby: '3.2' 70 | - rails: '6.0' 71 | ruby: '3.3' 72 | - rails: '6.0' 73 | ruby: '3.4' 74 | # rails 6.1, ruby 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 75 | - rails: '6.1' 76 | ruby: '2.5' 77 | - rails: '6.1' 78 | ruby: '2.6' 79 | - rails: '6.1' 80 | ruby: '2.7' 81 | - rails: '6.1' 82 | ruby: '3.0' 83 | - rails: '6.1' 84 | ruby: '3.1' 85 | - rails: '6.1' 86 | ruby: '3.2' 87 | - rails: '6.1' 88 | ruby: '3.3' 89 | - rails: '6.1' 90 | ruby: '3.4' 91 | # rails 7.0; ruby 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 92 | - rails: '7.0' 93 | ruby: '2.7' 94 | - rails: '7.0' 95 | ruby: '3.0' 96 | - rails: '7.0' 97 | ruby: '3.1' 98 | - rails: '7.0' 99 | ruby: '3.2' 100 | - rails: '7.0' 101 | ruby: '3.3' 102 | - rails: '7.0' 103 | ruby: '3.4' 104 | # rails 7.1; ruby 2.7, 3.0, 3.1, 3.2, 3.3, 3.4 105 | - rails: '7.1' 106 | ruby: '2.7' 107 | - rails: '7.1' 108 | ruby: '3.0' 109 | - rails: '7.1' 110 | ruby: '3.1' 111 | - rails: '7.1' 112 | ruby: '3.2' 113 | - rails: '7.1' 114 | ruby: '3.3' 115 | - rails: '7.1' 116 | ruby: '3.4' 117 | name: Rails ${{ matrix.rails }} on Ruby ${{ matrix.ruby }} 118 | steps: 119 | - name: Checkout 120 | uses: actions/checkout@v4 121 | - name: Set up Ruby 122 | env: 123 | RAILS_VERSION: ${{ matrix.rails }} 124 | uses: ruby/setup-ruby@v1 125 | with: 126 | ruby-version: ${{ matrix.ruby }} 127 | bundler-cache: true 128 | - name: Run tests 129 | env: 130 | RAILS_VERSION: ${{ matrix.rails }} 131 | run: bundle exec rake 132 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /_yardoc/ 4 | /coverage/ 5 | /doc/ 6 | /Gemfile.lock 7 | /pkg/ 8 | /spec/reports/ 9 | /spec/support/dummy_rails_app/log/ 10 | /spec/support/dummy_rails_app/tmp/ 11 | /spec/support/dummy_rails_app/db/*.db 12 | /tmp/ 13 | .rspec_status 14 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | --require spec_helper 4 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | NewCops: enable 3 | SuggestExtensions: false 4 | TargetRubyVersion: 3.1 5 | 6 | Gemspec/RequiredRubyVersion: 7 | Enabled: false 8 | 9 | Layout/IndentationConsistency: 10 | EnforcedStyle: indented_internal_methods 11 | 12 | Layout/LineLength: 13 | Max: 100 14 | 15 | Metrics/BlockLength: 16 | IgnoredMethods: [RSpec.describe, context] 17 | 18 | Style/Documentation: 19 | Enabled: false 20 | 21 | Style/FrozenStringLiteralComment: 22 | EnforcedStyle: never 23 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [1.1.1](https://github.com/rubysamurai/query_count/compare/v1.1.0...v1.1.1) (2022-02-13) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * Prevent `NoMethodError` when the database connection is not established ([#1](https://github.com/rubysamurai/query_count/pull/1)) ([ff8a47b](https://github.com/rubysamurai/query_count/commit/ff8a47b8fd223e24588c2eb08e0ded3bc7df4b28)) (@tubaxenor) 7 | 8 | 9 | 10 | # [1.1.0](https://github.com/rubysamurai/query_count/compare/v1.0.0...v1.1.0) (2022-01-26) 11 | 12 | 13 | ### Features 14 | 15 | * Support Rails 4.2+ and Ruby 2.0+ 16 | 17 | # 1.0.0 (2020-05-23) 18 | 19 | Initial release. 20 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | if ENV['CI'] 6 | rails_version = ENV['RAILS_VERSION'] || '7.1' 7 | eval_gemfile File.expand_path("../gemfiles/#{rails_version}.gemfile", __FILE__) 8 | end 9 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Dmitriy Tarasov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Query Count 2 | 3 | [](https://badge.fury.io/rb/query_count) 4 | [](https://github.com/rubysamurai/query_count/actions?query=workflow%3ACI) 5 | 6 | > **Rails 7.2 introduced built-in query counting functionality, making this gem redundant for Rails 7.2 and newer.** 7 | 8 | A zero-configuration gem to count the number of SQL queries performed by the ActiveRecord. 9 | Supports **Rails 4.2+** and **Ruby 2.0+** (the complete testing matrix is [here](.github/workflows/ci.yml)). 10 | 11 | ## Installation 12 | 13 | Add this line to your application's Gemfile: 14 | 15 | ```ruby 16 | gem 'query_count' 17 | ``` 18 | 19 | Run `bundle install`. 20 | 21 | ## Usage 22 | 23 | The gem will automatically include the number of SQL queries to the default Rails log. 24 | 25 | ``` 26 | ActiveRecord: 34.0ms | SQL Queries: 8 (1 cached) 27 | ``` 28 | 29 | This log example shows that the total number of queries was 8, and 1 was cached, which means the request hit the database 7 times. 30 | 31 | `QueryCount::Counter` provides public methods `counter`, `counter_cache`, `reset_counter`, `reset_counter_cache`. 32 | 33 | RSpec 3 example: 34 | 35 | ```ruby 36 | it 'performs exactly 5 queries' do 37 | QueryCount::Counter.reset_counter 38 | 5.times { User.last } 39 | expect(QueryCount::Counter.counter).to eq 5 40 | end 41 | ``` 42 | 43 | ## License 44 | 45 | `query_count` © Dmitriy Tarasov. Released under the [MIT](LICENSE.txt) license. 46 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_tasks' 2 | require 'rspec/core/rake_task' 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | 6 | task default: :spec 7 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'bundler/setup' 4 | require 'query_count' 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require 'pry' 11 | # Pry.start 12 | 13 | require 'irb' 14 | IRB.start(__FILE__) 15 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /gemfiles/4.2.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 4.2.0' 2 | gem 'railties', '~> 4.2.0' 3 | gem 'sqlite3', '~> 1.3.0' 4 | -------------------------------------------------------------------------------- /gemfiles/5.0.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 5.0.0' 2 | gem 'loofah', '< 2.21.0' 3 | gem 'railties', '~> 5.0.0' 4 | gem 'sqlite3', '~> 1.3.0' 5 | -------------------------------------------------------------------------------- /gemfiles/5.1.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 5.1.0' 2 | gem 'loofah', '< 2.21.0' 3 | gem 'railties', '~> 5.1.0' 4 | gem 'sqlite3', '~> 1.3.0' 5 | -------------------------------------------------------------------------------- /gemfiles/5.2.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 5.2.0' 2 | gem 'loofah', '< 2.21.0' 3 | gem 'railties', '~> 5.2.0' 4 | gem 'sqlite3', '~> 1.3.0' 5 | -------------------------------------------------------------------------------- /gemfiles/6.0.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 6.0.0' 2 | gem 'base64' 3 | gem 'bigdecimal' 4 | gem 'concurrent-ruby', '1.3.4' 5 | gem 'mutex_m' 6 | gem 'railties', '~> 6.0.0' 7 | gem 'sqlite3', '~> 1.4.0' 8 | -------------------------------------------------------------------------------- /gemfiles/6.1.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 6.1.0' 2 | gem 'base64' 3 | gem 'bigdecimal' 4 | gem 'concurrent-ruby', '1.3.4' 5 | gem 'mutex_m' 6 | gem 'railties', '~> 6.1.0' 7 | gem 'sqlite3', '~> 1.5.0' 8 | -------------------------------------------------------------------------------- /gemfiles/7.0.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 7.0.0' 2 | gem 'base64' 3 | gem 'bigdecimal' 4 | gem 'concurrent-ruby', '1.3.4' 5 | gem 'mutex_m' 6 | gem 'railties', '~> 7.0.0' 7 | gem 'sqlite3', '~> 1.6.0' 8 | -------------------------------------------------------------------------------- /gemfiles/7.1.gemfile: -------------------------------------------------------------------------------- 1 | gem 'activerecord', '~> 7.1.0' 2 | gem 'railties', '~> 7.1.0' 3 | -------------------------------------------------------------------------------- /lib/query_count.rb: -------------------------------------------------------------------------------- 1 | require 'query_count/counter' 2 | require 'query_count/controller_runtime' 3 | require 'query_count/railtie' 4 | require 'query_count/version' 5 | -------------------------------------------------------------------------------- /lib/query_count/controller_runtime.rb: -------------------------------------------------------------------------------- 1 | # https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/controller_runtime.rb 2 | module QueryCount 3 | module ControllerRuntime 4 | extend ActiveSupport::Concern 5 | 6 | module ClassMethods 7 | def log_process_action(payload) 8 | messages = super 9 | count = payload[:query_count] || 0 10 | count_cache = payload[:query_count_cache] || 0 11 | 12 | messages.push( 13 | "SQL Queries: #{count + count_cache}"\ 14 | " (#{count_cache} cached)" 15 | ) 16 | 17 | messages 18 | end 19 | end 20 | 21 | private 22 | 23 | def process_action(action, *args) 24 | Counter.reset_counter 25 | Counter.reset_counter_cache 26 | super 27 | end 28 | 29 | def append_info_to_payload(payload) 30 | super 31 | return unless ActiveRecord::Base.connected? 32 | 33 | payload[:query_count] = Counter.reset_counter 34 | payload[:query_count_cache] = Counter.reset_counter_cache 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/query_count/counter.rb: -------------------------------------------------------------------------------- 1 | # https://api.rubyonrails.org/classes/ActiveRecord/LogSubscriber.html 2 | require 'active_support' 3 | 4 | module QueryCount 5 | class Counter < ActiveSupport::LogSubscriber 6 | IGNORE_PAYLOAD_NAMES = %w[SCHEMA EXPLAIN].freeze 7 | 8 | def self.counter=(value) 9 | Thread.current['query_count'] = value 10 | end 11 | 12 | def self.counter 13 | Thread.current['query_count'] ||= 0 14 | end 15 | 16 | def self.counter_cache=(value) 17 | Thread.current['query_count_cache'] = value 18 | end 19 | 20 | def self.counter_cache 21 | Thread.current['query_count_cache'] ||= 0 22 | end 23 | 24 | def self.reset_counter 25 | rc = counter 26 | self.counter = 0 27 | 28 | rc 29 | end 30 | 31 | def self.reset_counter_cache 32 | rcc = counter_cache 33 | self.counter_cache = 0 34 | 35 | rcc 36 | end 37 | 38 | def sql(event) 39 | payload = event.payload 40 | 41 | return if IGNORE_PAYLOAD_NAMES.include?(payload[:name]) 42 | 43 | if payload[:cached] 44 | self.class.counter_cache += 1 45 | else 46 | self.class.counter += 1 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/query_count/railtie.rb: -------------------------------------------------------------------------------- 1 | # https://api.rubyonrails.org/classes/Rails/Railtie.html 2 | require 'rails/railtie' 3 | 4 | module QueryCount 5 | class Railtie < Rails::Railtie 6 | initializer 'query_count.initialize' do 7 | QueryCount::Counter.attach_to :active_record 8 | ActiveSupport.on_load(:action_controller) do 9 | include QueryCount::ControllerRuntime 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/query_count/version.rb: -------------------------------------------------------------------------------- 1 | module QueryCount 2 | VERSION = '1.1.1'.freeze 3 | end 4 | -------------------------------------------------------------------------------- /query_count.gemspec: -------------------------------------------------------------------------------- 1 | require_relative 'lib/query_count/version' 2 | 3 | Gem::Specification.new do |spec| 4 | spec.name = 'query_count' 5 | spec.version = QueryCount::VERSION 6 | spec.authors = ['Dmitriy Tarasov'] 7 | spec.email = ['info@rubysamurai.com'] 8 | 9 | spec.summary = 'SQL queries counter for Rails apps' 10 | spec.description = spec.summary 11 | spec.homepage = 'https://github.com/rubysamurai/query_count' 12 | spec.license = 'MIT' 13 | spec.required_ruby_version = Gem::Requirement.new('>= 2.0.0') 14 | 15 | spec.metadata['homepage_uri'] = spec.homepage 16 | spec.metadata['source_code_uri'] = spec.homepage 17 | spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues" 18 | spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md" 19 | spec.metadata['rubygems_mfa_required'] = 'true' 20 | 21 | spec.files = Dir.chdir(File.expand_path(__dir__)) do 22 | `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 23 | end 24 | spec.bindir = 'exe' 25 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 26 | spec.require_paths = ['lib'] 27 | 28 | spec.add_runtime_dependency 'activerecord', '>= 4.2' 29 | spec.add_runtime_dependency 'railties', '>= 4.2' 30 | 31 | spec.add_development_dependency 'rspec', '>= 3.9' 32 | spec.add_development_dependency 'sqlite3', '>= 1.3' 33 | end 34 | -------------------------------------------------------------------------------- /spec/query_count_spec.rb: -------------------------------------------------------------------------------- 1 | RSpec.describe QueryCount do 2 | context 'QueryCount::Counter.counter' do 3 | before do 4 | User.create!(email: 'demo@example.com') 5 | QueryCount::Counter.reset_counter 6 | end 7 | 8 | it 'counts number of sql queries' do 9 | (1..100).each do |n| 10 | QueryCount::Counter.reset_counter 11 | n.times { User.last } 12 | expect(QueryCount::Counter.counter).to eq n 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | 3 | require File.expand_path('support/dummy_rails_app/config/environment.rb', __dir__) 4 | 5 | require 'bundler/setup' 6 | require 'query_count' 7 | 8 | RSpec.configure do |config| 9 | # Enable flags like --only-failures and --next-failure 10 | config.example_status_persistence_file_path = '.rspec_status' 11 | 12 | # Disable RSpec exposing methods globally on `Module` and `main` 13 | config.disable_monkey_patching! 14 | 15 | config.expect_with :rspec do |c| 16 | c.syntax = :expect 17 | end 18 | 19 | config.before(:suite) do 20 | ActiveRecord::Schema.verbose = false 21 | migration_path = 'spec/support/dummy_rails_app/db/migrate' 22 | if ActiveRecord::VERSION::STRING.to_f >= 6.0 23 | ActiveRecord::MigrationContext.new(migration_path, ActiveRecord::SchemaMigration).migrate 24 | elsif ActiveRecord::VERSION::STRING.to_f >= 5.2 25 | ActiveRecord::MigrationContext.new(migration_path).migrate 26 | else 27 | ActiveRecord::Migrator.migrate(migration_path) 28 | end 29 | end 30 | 31 | config.after(:suite) do 32 | FileUtils.rm('spec/support/dummy_rails_app/db/query_test.db') 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('config/application', __dir__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubysamurai/query_count/4f2015e5c9e6255bfdeb48dfc1ad1170c3f6c5f6/spec/support/dummy_rails_app/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | def main; end 3 | end 4 | -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /spec/support/dummy_rails_app/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |