Created
April 24, 2011 17:02
-
-
Save alissonsales/939699 to your computer and use it in GitHub Desktop.
Test suite benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ruby 1.9.2-p180 | |
--------------- | |
$ ruby -v && time rspec spec | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0] | |
Finished in 27.54 seconds | |
105 examples, 0 failures, 2 pending | |
real 0m39.401s | |
user 0m36.953s | |
sys 0m1.850s | |
REE-1.8.7-2011.03 | |
----------------- | |
$ ruby -v && time rspec spec | |
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.6.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03 | |
Finished in 4.71 seconds | |
105 examples, 0 failures, 2 pending | |
real 0m9.914s | |
user 0m8.161s | |
sys 0m1.263s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ruby 1.9.2-p180 | |
--------------- | |
$ ruby -v && rspec spec/models/user_spec.rb -p | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0] | |
.................................... | |
Top 10 slowest examples: | |
User validations username should contain only numbers, letters, '.', '_', '-' | |
1.07 seconds ./spec/models/user_spec.rb:33 | |
User validations should validate ip_restrisction, allowing empty and retricting wrong IPs | |
0.72267 seconds ./spec/models/user_spec.rb:112 | |
User should authenticate with customer_id, username and password | |
0.7179 seconds ./spec/models/user_spec.rb:130 | |
User should be able to store login attemp when requested | |
0.66269 seconds ./spec/models/user_spec.rb:148 | |
User renew_password should not update the password if the confirmation is wrong | |
0.60947 seconds ./spec/models/user_spec.rb:216 | |
User renew_password should change the password | |
0.57294 seconds ./spec/models/user_spec.rb:206 | |
User expires the password when blocking a user | |
0.55871 seconds ./spec/models/user_spec.rb:135 | |
User should protect username from mass assignment | |
0.50761 seconds ./spec/models/user_spec.rb:141 | |
User validations should validate uniqueness_of username in the scope of a customer | |
0.50723 seconds ./spec/models/user_spec.rb:15 | |
User should block a user when requested | |
0.50453 seconds ./spec/models/user_spec.rb:158 | |
Finished in 12.11 seconds | |
36 examples, 0 failures | |
REE-1.8.7-2011.03 | |
----------------- | |
$ ruby -v && rspec spec/models/user_spec.rb -p | |
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.6.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03 | |
.................................... | |
Top 10 slowest examples: | |
User should authenticate with customer_id, username and password | |
0.30695 seconds ./spec/models/user_spec.rb:130 | |
User validations should validate ip_restrisction, allowing empty and retricting wrong IPs | |
0.24945 seconds ./spec/models/user_spec.rb:112 | |
User should be able to store login attemp when requested | |
0.22666 seconds ./spec/models/user_spec.rb:148 | |
User renew_password should not update the password if the current password is wrong | |
0.19842 seconds ./spec/models/user_spec.rb:211 | |
User validations username should contain only numbers, letters, '.', '_', '-' | |
0.12774 seconds ./spec/models/user_spec.rb:33 | |
User validations should validate uniqueness_of username in the scope of a customer | |
0.06599 seconds ./spec/models/user_spec.rb:15 | |
User expires the password when blocking a user | |
0.06546 seconds ./spec/models/user_spec.rb:135 | |
User should protect username from mass assignment | |
0.06327 seconds ./spec/models/user_spec.rb:141 | |
User should block a user when requested | |
0.06288 seconds ./spec/models/user_spec.rb:158 | |
User renew_password should change the password | |
0.06228 seconds ./spec/models/user_spec.rb:206 | |
Finished in 2.17 seconds | |
36 examples, 0 failures | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.0.5' | |
gem 'pg' | |
gem 'inherited_resources', '~> 1.2.1' | |
gem 'haml' | |
gem 'formtastic', '~> 1.2.3' | |
gem 'capistrano' | |
gem 'clearance' | |
gem 'rack', '~> 1.2.1' | |
gem 'ipaddress', '~> 0.7.5' | |
gem "cancan" | |
gem "meta_where" | |
group :development, :test do | |
gem 'ruby_parser' | |
gem 'hpricot' | |
gem 'inherited_resources_views' | |
gem 'thin' | |
gem 'rspec-rails', '~> 2.4' | |
gem 'capybara' | |
gem 'ruby-debug19' | |
end | |
group :test do | |
gem 'factory_girl_rails' | |
gem 'shoulda-matchers' | |
gem 'faker' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'clearance/shoulda_macros' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | |
RSpec.configure do |config| | |
# == Mock Framework | |
# | |
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: | |
# | |
# config.mock_with :mocha | |
# config.mock_with :flexmock | |
# config.mock_with :rr | |
config.mock_with :rspec | |
# 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 | |
# Enabling shoulda Clearance macros | |
config.include(Clearance::Shoulda::Helpers) | |
config.use_transactional_examples = true | |
end | |
def set_current_customer | |
@customer = Factory(:customer) | |
@request.host = "#{@customer.subdomain}.example.com" | |
end | |
def login | |
@user = Factory.build(:valid_user, :customer => @customer) | |
sign_in_as(@user) | |
@ability = Ability.new(@controller.send(:current_user)) | |
@controller.stub(:current_ability => @ability) | |
end | |
def user_can(action, klass, condition = nil) | |
@ability.can action, klass, condition | |
end | |
def user_cannot(action, klass, condition = nil) | |
@ability.cannot action, klass, condition | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment