hermes 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- Copyright 2010 PlataformaTec http://blog.plataformatec.com.br/
1
+ Copyright 2011 PlataformaTec http://blog.plataformatec.com.br/
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -6,6 +6,10 @@ A few testing facilities built on top of Capybara and ActiveSupport::TestCase
6
6
 
7
7
  * Improve this README mentioning each module and how to configure it to work with Rspec and/or Rails.
8
8
 
9
+ == Perf
10
+
11
+ Require perf optimization for your test suite with "hermes/perf"
12
+
9
13
  == Bugs and Features
10
14
 
11
15
  If you discover any bugs or add any features, please let us know using GitHub's tracker.
@@ -0,0 +1,2 @@
1
+ require "hermes/perf/scrub"
2
+ require "hermes/perf/shared_connection"
@@ -0,0 +1,14 @@
1
+ # Scrub instance variables as in
2
+ # http://37signals.com/svn/posts/2742-the-road-to-faster-tests
3
+
4
+ ActiveSupport::TestCase.class_eval do
5
+ teardown :scrub_instance_variables
6
+
7
+ @@reserved_ivars = %w(@loaded_fixtures @test_passed @fixture_cache @method_name @_assertion_wrapped @_result)
8
+
9
+ def scrub_instance_variables
10
+ (instance_variables - @@reserved_ivars).each do |ivar|
11
+ instance_variable_set(ivar, nil)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # This is a hack that forces AR to share its connection between different
2
+ # threads. Useful for Capybara when you are not using rack-test.
3
+ class ActiveRecord::Base
4
+ mattr_accessor :shared_connection
5
+ @@shared_connection = nil
6
+
7
+ def self.connection
8
+ @@shared_connection || retrieve_connection
9
+ end
10
+ end
11
+
12
+ # Forces all threads to share the same connection. This works on
13
+ # Capybara because it starts the web server in a thread.
14
+ ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@@ -1,3 +1,3 @@
1
1
  module Hermes
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hermes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Jos\xC3\xA9 Valim"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-03-14 00:00:00 +01:00
19
+ date: 2011-04-28 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -35,6 +35,9 @@ files:
35
35
  - lib/hermes/builders.rb
36
36
  - lib/hermes/context.rb
37
37
  - lib/hermes/integration_case.rb
38
+ - lib/hermes/perf/scrub.rb
39
+ - lib/hermes/perf/shared_connection.rb
40
+ - lib/hermes/perf.rb
38
41
  - lib/hermes/rails.rb
39
42
  - lib/hermes/scopes.rb
40
43
  - lib/hermes/version.rb