services_test_server 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78dd7bdc684b60554afddb89652f4b8d6c9035e8
4
- data.tar.gz: 00dfb3609b25931e7e986b5b9535249e43a83a94
3
+ metadata.gz: c2d4dbdd3a8a67a8c5707b8ccac7fb262c1dcef0
4
+ data.tar.gz: d682ff57059f74ddbb2f3c71acad2eca9931c4d9
5
5
  SHA512:
6
- metadata.gz: 13de9d6b9bb9c2db77aaf2ed1db2ee674cef8a83a5616d92bb7ce6282110ab7b934cf5088f37eb7f24a4131fd18267fb6a1466a42616fe8c5ceebc8cbb883c2a
7
- data.tar.gz: 58ccd8607dce442738072b1a81fe30d2b0f68e0d9ada4cf73e1a47d5dfb70f62b4252ef8412d6eb9da4903dfc168a409900b61669623192d2fe350cd693d8b3a
6
+ metadata.gz: 9d027694d0943713b400237ef8a00bd84798a22b0f4b2bbb9f118704933932228491ff58c88f31f5d17332b42a8ec0955f87accd50372e659c14498a01faf624
7
+ data.tar.gz: edf7b5e94f41d069ad9dd8754dfa3c0e5c0869a63043a0eacb063661d1d7e7220349f3109dbe1356c0e5895919db53196e52f69dbe84c5e3dad29f28a0e9f667
@@ -13,15 +13,6 @@ module ServicesTestServer
13
13
  end
14
14
  end
15
15
 
16
- def self.start
17
- only_one_connection
18
-
19
- port = ServicesTestServer.control_port
20
-
21
- DRb.start_service("druby://localhost:#{port}", new)
22
- ServicesTestServer.logger.info "DbController service started on druby://localhost:#{port}"
23
- end
24
-
25
16
  def initialize
26
17
  @mutex = Mutex.new
27
18
  end
@@ -1,3 +1,3 @@
1
1
  module ServicesTestServer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -21,6 +21,18 @@ module ServicesTestServer
21
21
  def self.logger=(logger)
22
22
  @logger = logger
23
23
  end
24
+
25
+ def self.url
26
+ "druby://localhost:#{control_port}"
27
+ end
28
+
29
+ def self.start
30
+ DbController.only_one_connection
31
+
32
+ DRb.start_service(url, DbController.new)
33
+ logger.info "DbController service started on #{url}"
34
+ end
35
+
24
36
  end
25
37
 
26
38
  require 'services_test_server/version'
@@ -0,0 +1,20 @@
1
+ require 'test_helper'
2
+ require 'active_record_helper'
3
+
4
+ class ServicesTestServerTest < Minitest::Test
5
+ def test_start
6
+ ServicesTestServer.start
7
+ client = DRbObject.new nil, ServicesTestServer.url
8
+
9
+ user = User.create!(name: 'Bob')
10
+
11
+ client.begin_transaction
12
+
13
+ user.update_attributes!(name: 'Alice')
14
+ assert_equal 'Alice', user.name
15
+
16
+ client.rollback_transaction
17
+
18
+ assert_equal 'Bob', user.reload.name
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: services_test_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Plummer
@@ -113,6 +113,7 @@ files:
113
113
  - test/active_record_helper.rb
114
114
  - test/configuration_test.rb
115
115
  - test/db_controller_test.rb
116
+ - test/services_test_server_test.rb
116
117
  - test/test_helper.rb
117
118
  homepage: https://github.com/dplummer/services_test_server
118
119
  licenses:
@@ -143,4 +144,5 @@ test_files:
143
144
  - test/active_record_helper.rb
144
145
  - test/configuration_test.rb
145
146
  - test/db_controller_test.rb
147
+ - test/services_test_server_test.rb
146
148
  - test/test_helper.rb