Commit 11090027 by soramugi Committed by Tute Costa

Make specs run faster

  $ rspec spec/paperclip/integration_spec.rb --profile 1
  Testing against version 4.1.7
  ..................................

  Finished in 15.19 seconds (files took 0.60155 seconds to load)
  34 examples, 0 failures

  Top 1 slowest examples (9.54 seconds, 62.8% of total time):
    Paperclip Many models at once does not exceed the open file limit
      9.54 seconds ./spec/paperclip/integration_spec.rb:18

to

  $ rspec spec/paperclip/integration_spec.rb --profile 1
  Testing against version 4.1.7
  ..................................

  Finished in 10.95 seconds (files took 0.59585 seconds to load)
  34 examples, 0 failures

  Top 1 slowest examples (5.33 seconds, 48.7% of total time):
    Paperclip Many models at once does not exceed the open file limit
      5.33 seconds ./spec/paperclip/integration_spec.rb:18

Updates gemfiles to Ruby 2 hash syntax.

[closes #1700]
parent 3226ab4a
...@@ -8,6 +8,7 @@ gem 'pry' ...@@ -8,6 +8,7 @@ gem 'pry'
# Hinting at development dependencies # Hinting at development dependencies
# Prevents bundler from taking a long-time to resolve # Prevents bundler from taking a long-time to resolve
group :development, :test do group :development, :test do
gem 'activerecord-import'
gem 'mime-types', '~> 1.16' gem 'mime-types', '~> 1.16'
gem 'builder' gem 'builder'
gem 'rubocop', require: false gem 'rubocop', require: false
......
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 3.2.0" gem "rails", "~> 3.2.0"
gem "aws-sdk", "~> 1.5" gem "aws-sdk", "~> 1.5"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 3.2.0" gem "rails", "~> 3.2.0"
gem "aws-sdk", "~> 2.0.0" gem "aws-sdk", "~> 2.0.0"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 3.2.0" gem "rails", "~> 3.2.0"
gem "aws-sdk", "~> 2.1.0" gem "aws-sdk", "~> 2.1.0"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 4.1.0" gem "rails", "~> 4.1.0"
gem "aws-sdk", "~> 1.5" gem "aws-sdk", "~> 1.5"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 4.1.0" gem "rails", "~> 4.1.0"
gem "aws-sdk", "~> 2.0.0" gem "aws-sdk", "~> 2.0.0"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 4.1.0" gem "rails", "~> 4.1.0"
gem "aws-sdk", "~> 2.1.0" gem "aws-sdk", "~> 2.1.0"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 4.2.0" gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 1.5" gem "aws-sdk", "~> 1.5"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 4.2.0" gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.0.0" gem "aws-sdk", "~> 2.0.0"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "sqlite3", "~> 1.3.8", :platforms => :ruby gem "sqlite3", "~> 1.3.8", platforms: :ruby
gem "pry" gem "pry"
gem "rails", "~> 4.2.0" gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.1.0" gem "aws-sdk", "~> 2.1.0"
group :development, :test do group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16" gem "mime-types", "~> 1.16"
gem "builder" gem "builder"
gem "rubocop", :require => false gem "rubocop", :require => false
end end
gemspec :path => "../" gemspec path: "../"
...@@ -7,9 +7,10 @@ describe 'Paperclip' do ...@@ -7,9 +7,10 @@ describe 'Paperclip' do
before do before do
rebuild_model rebuild_model
@file = File.new(fixture_file("5k.png"), 'rb') @file = File.new(fixture_file("5k.png"), 'rb')
300.times do |i| # Deals with `Too many open files` error
Dummy.create! avatar: @file Dummy.import 100.times.map { Dummy.new avatar: @file }
end Dummy.import 100.times.map { Dummy.new avatar: @file }
Dummy.import 100.times.map { Dummy.new avatar: @file }
end end
after { @file.close } after { @file.close }
......
...@@ -8,6 +8,7 @@ require 'mocha/api' ...@@ -8,6 +8,7 @@ require 'mocha/api'
require 'bourne' require 'bourne'
require 'ostruct' require 'ostruct'
require 'pathname' require 'pathname'
require 'activerecord-import'
ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..'))) ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..')))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment