freyr 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Freyr::ServiceInfo do
4
+ subject {Freyr::ServiceInfo.new(:foo)}
5
+ it "should set basic functions" do
6
+ subject.restart_sig "START"
7
+ subject.restart_sig.should == "START"
8
+ end
9
+
10
+ describe "logging" do
11
+
12
+ it "should function like anything else" do
13
+ subject.log "START"
14
+ subject.log.should == "/START"
15
+ subject.dont_write_log.should_not == true
16
+ end
17
+
18
+ it "should return a default otherwise" do
19
+ subject.log.should == Freyr::ServiceInfo::USER_LOGS+'/foo.log'
20
+ subject.dont_write_log.should_not == true
21
+ end
22
+
23
+ it "should return root default" do
24
+ subject.use_sudo
25
+ subject.log.should == Freyr::ServiceInfo::ROOT_LOGS+'/foo.log'
26
+ subject.dont_write_log.should_not == true
27
+ end
28
+
29
+ it "should go for read log" do
30
+ subject.read_log "foo"
31
+ subject.log.should == '/foo'
32
+ subject.dont_write_log.should == true
33
+ end
34
+
35
+ end
36
+
37
+
38
+ describe "pid_files" do
39
+
40
+ it "should function like anything else" do
41
+ subject.pid_file "START"
42
+ subject.pid_file.should == "START"
43
+ end
44
+
45
+ it "should return a default otherwise" do
46
+ subject.pid_file.should == Freyr::ServiceInfo::USER_PIDS+'/foo.pid'
47
+ end
48
+
49
+ it "should return root default" do
50
+ subject.use_sudo
51
+ subject.pid_file.should == Freyr::ServiceInfo::ROOT_PIDS+'/foo.pid'
52
+ end
53
+
54
+ end
55
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Freyr::Service do
4
+ before :all do
5
+ Freyr::OUT.reopen('/dev/null')
6
+ end
7
+ subject do
8
+ si = Freyr::ServiceInfo.new(:foo) do
9
+ start 'sleep 10'
10
+ proc_match /sleep 10/
11
+ ping 'http://google.com'
12
+ end
13
+
14
+ Freyr::Service.new(si)
15
+ end
16
+
17
+ describe 'starting' do
18
+ it "should start" do
19
+ subject.start!
20
+
21
+ subject.pid_file.pid_from_procname.should_not be_nil
22
+ end
23
+ end
24
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'freyr'
4
- require 'spec'
5
- require 'spec/autorun'
4
+ require 'rspec'
6
5
 
7
- Spec::Runner.configure do |config|
8
-
6
+ RSpec.configure do |c|
7
+ c.mock_with :rspec
9
8
  end
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 2
10
- version: 0.4.2
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tal Atlas
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-31 00:00:00 Z
18
+ date: 2011-09-27 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
@@ -91,13 +91,18 @@ files:
91
91
  - lib/freyr/cli/management.rb
92
92
  - lib/freyr/cli/monitor.rb
93
93
  - lib/freyr/command.rb
94
+ - lib/freyr/helpers.rb
95
+ - lib/freyr/pid_file.rb
94
96
  - lib/freyr/pinger.rb
95
97
  - lib/freyr/process_info.rb
98
+ - lib/freyr/rvm.rb
96
99
  - lib/freyr/service.rb
97
100
  - lib/freyr/service_group.rb
98
101
  - lib/freyr/service_info.rb
99
102
  - lib/freyr/version.rb
100
103
  - spec/freyr_spec.rb
104
+ - spec/service_info_spec.rb
105
+ - spec/service_spec.rb
101
106
  - spec/spec.opts
102
107
  - spec/spec_helper.rb
103
108
  homepage: http://github.com/Talby/freyr
@@ -135,5 +140,7 @@ specification_version: 3
135
140
  summary: Service manager and runner
136
141
  test_files:
137
142
  - spec/freyr_spec.rb
143
+ - spec/service_info_spec.rb
144
+ - spec/service_spec.rb
138
145
  - spec/spec.opts
139
146
  - spec/spec_helper.rb