File: fusion_spec.rb

package info (click to toggle)
ruby-fission 0.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 624 kB
  • sloc: ruby: 4,664; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

describe Fission::Fusion do
  describe 'self.running?' do
    before do
      @cmd = "ps -ef | grep -v grep | "
      @cmd << "grep -c '#{Fission.config['gui_bin']}' 2>&1"
      @executor = double('executor')
    end

    it 'should return a successful response and true if the fusion app is running' do
      @executor.should_receive(:execute).and_return({'output' => "1\n"})
      Fission::Action::ShellExecutor.should_receive(:new).
                                     with(@cmd).
                                     and_return(@executor)
      Fission::Fusion.running?.should == true
    end

    it 'should return a successful response and false if the fusion app is not running' do
      @executor.should_receive(:execute).and_return({'output' => "0\n"})
      Fission::Action::ShellExecutor.should_receive(:new).
                                     with(@cmd).
                                     and_return(@executor)
      Fission::Fusion.running?.should == false
    end
  end
end