copycopter_client 1.0.0.beta5 → 1.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
@@ -135,7 +135,15 @@ module CopycopterClient
135
135
  end
136
136
 
137
137
  def spawner?
138
- $0.include?("ApplicationSpawner") || $0 =~ /unicorn.*master/
138
+ passenger_spawner? || unicorn_spawner?
139
+ end
140
+
141
+ def passenger_spawner?
142
+ $0.include?("ApplicationSpawner")
143
+ end
144
+
145
+ def unicorn_spawner?
146
+ $0.include?("unicorn") && !caller.any? { |line| line.include?("worker_loop") }
139
147
  end
140
148
 
141
149
  def register_job_hooks
@@ -1,6 +1,6 @@
1
1
  module CopycopterClient
2
2
  # Client version
3
- VERSION = "1.0.0.beta5"
3
+ VERSION = "1.0.0.beta6"
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = "2.0"
@@ -15,9 +15,13 @@ describe CopycopterClient::Sync do
15
15
 
16
16
  before do
17
17
  @syncs = []
18
+ @original_process_name = $0
18
19
  end
19
20
 
20
- after { @syncs.each { |sync| sync.stop } }
21
+ after do
22
+ $0 = @original_process_name
23
+ @syncs.each { |sync| sync.stop }
24
+ end
21
25
 
22
26
  it "syncs when the process terminates" do
23
27
  api_key = "12345"
data/spec/spec_helper.rb CHANGED
@@ -20,7 +20,7 @@ ShamRack.mount(FakeCopycopterApp.new, "copycopter.com")
20
20
 
21
21
  Spec::Runner.configure do |config|
22
22
  config.include ClientSpecHelpers
23
- config.include WebMock
23
+ config.include WebMock::API
24
24
  config.mock_with :mocha
25
25
  config.before do
26
26
  FakeCopycopterApp.reset
@@ -1,4 +1,12 @@
1
- share_as :DefinesConstants do
1
+ module DefinesConstants
2
+ def self.included(example_group)
3
+ super
4
+ example_group.class_eval do
5
+ before { @defined_constants = [] }
6
+ after { undefine_constants }
7
+ end
8
+ end
9
+
2
10
  def define_class(class_name, base = Object, &block)
3
11
  class_name = class_name.to_s.camelize
4
12
  klass = Class.new(base)
@@ -25,9 +33,7 @@ share_as :DefinesConstants do
25
33
  yield(parent, name)
26
34
  end
27
35
 
28
- before { @defined_constants = [] }
29
-
30
- after do
36
+ def undefine_constants
31
37
  @defined_constants.reverse.each do |path|
32
38
  parse_constant(path) do |parent, name|
33
39
  parent.send(:remove_const, name)
@@ -1,10 +1,9 @@
1
1
  class FakeUnicornServer
2
2
  def become_master
3
- $0 = "unicorn master"
3
+ $0 = "unicorn"
4
4
  end
5
5
 
6
6
  def spawn
7
- $0 = "PassengerFork"
8
7
  worker_loop(nil)
9
8
  end
10
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copycopter_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 299253593
4
+ hash: 299253590
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - beta5
11
- version: 1.0.0.beta5
10
+ - beta6
11
+ version: 1.0.0.beta6
12
12
  platform: ruby
13
13
  authors:
14
14
  - thoughtbot