kookaburra 0.17.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +28 -0
- data/VERSION +1 -1
- data/kookaburra.gemspec +3 -2
- data/lib/kookaburra/utils/active_record_shared_connection.rb +14 -0
- metadata +5 -4
data/README.markdown
CHANGED
@@ -39,11 +39,35 @@ to tell Kookaburra which classes contain the specific Domain Driver
|
|
39
39
|
implementations for your application as well as which driver to use for running
|
40
40
|
the tests (currently only tested with [Capybara] [Capybara]).
|
41
41
|
|
42
|
+
### ActiveRecord and Database Transactions ###
|
43
|
+
|
44
|
+
Kookaburra currently uses Rack::Test as the underlying implementation for its
|
45
|
+
APIDriver classes. This poses a problem when you want to run your UI tests via a
|
46
|
+
driver other than Rack::Test such as Selenium, because the APIDriver sets up
|
47
|
+
your test data using a different database connection than the process that runs
|
48
|
+
the server against which Selenium executes, and they do not have access to the
|
49
|
+
same transaction.
|
50
|
+
|
51
|
+
One way to handle this problem is to force ActiveRecord to use the same
|
52
|
+
connection in both the main thread and the thread that is spun up by Capybara to
|
53
|
+
run the application for Selenium testing. You can do so by requiring
|
54
|
+
`kookaburra/utils/active_record_shared_connection` within your Kookaburra setup.
|
55
|
+
|
56
|
+
In the near future, we plan to change Kookaburra to execute *both* its APIDriver
|
57
|
+
and UIDriver against an actual server and ditch Rack::Test. Not only will this
|
58
|
+
help avoid this specific problem, but it will move towards the goal of being
|
59
|
+
able to (optionally) run these tests on a completely different machine than the
|
60
|
+
running application.
|
61
|
+
|
42
62
|
### RSpec ###
|
43
63
|
|
44
64
|
For [RSpec] [RSpec] integration tests, just add the following to
|
45
65
|
`spec/support/kookaburra_setup.rb`:
|
46
66
|
|
67
|
+
# only if using ActiveRecord and a browser driver other than Rack::Test for
|
68
|
+
# UI testing
|
69
|
+
require 'kookaburra/utils/active_record_shared_connection'
|
70
|
+
|
47
71
|
require 'kookaburra/test_helpers'
|
48
72
|
require 'my_app/kookaburra/api_driver'
|
49
73
|
require 'my_app/kookaburra/given_driver'
|
@@ -67,6 +91,10 @@ For [RSpec] [RSpec] integration tests, just add the following to
|
|
67
91
|
|
68
92
|
For [Cucumber] [Cucumber], add the following to `features/support/kookaburra_setup.rb`:
|
69
93
|
|
94
|
+
# only if using ActiveRecord and a browser driver other than Rack::Test for
|
95
|
+
# UI testing
|
96
|
+
require 'kookaburra/utils/active_record_shared_connection'
|
97
|
+
|
70
98
|
require 'kookaburra/test_helpers'
|
71
99
|
require 'my_app/kookaburra/api_driver'
|
72
100
|
require 'my_app/kookaburra/given_driver'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.17.
|
1
|
+
0.17.1
|
data/kookaburra.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "kookaburra"
|
8
|
-
s.version = "0.17.
|
8
|
+
s.version = "0.17.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["John Wilger", "Sam Livingston-Gray", "Ravi Gadad"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-17"
|
13
13
|
s.description = "Cucumber + Capybara = Kookaburra? It made sense at the time."
|
14
14
|
s.email = "johnwilger@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
"lib/kookaburra/test_helpers.rb",
|
40
40
|
"lib/kookaburra/ui_driver.rb",
|
41
41
|
"lib/kookaburra/ui_driver/ui_component.rb",
|
42
|
+
"lib/kookaburra/utils/active_record_shared_connection.rb",
|
42
43
|
"spec/kookaburra/json_api_driver_spec.rb",
|
43
44
|
"spec/kookaburra/rack_driver_spec.rb",
|
44
45
|
"spec/kookaburra/test_data_spec.rb",
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
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
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kookaburra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 89
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 17
|
9
|
-
-
|
10
|
-
version: 0.17.
|
9
|
+
- 1
|
10
|
+
version: 0.17.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Wilger
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-03-
|
20
|
+
date: 2012-03-17 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- lib/kookaburra/test_helpers.rb
|
208
208
|
- lib/kookaburra/ui_driver.rb
|
209
209
|
- lib/kookaburra/ui_driver/ui_component.rb
|
210
|
+
- lib/kookaburra/utils/active_record_shared_connection.rb
|
210
211
|
- spec/kookaburra/json_api_driver_spec.rb
|
211
212
|
- spec/kookaburra/rack_driver_spec.rb
|
212
213
|
- spec/kookaburra/test_data_spec.rb
|