File: stop_all_commands.feature

package info (click to toggle)
ruby-aruba 0.14.8-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,216 kB
  • sloc: ruby: 7,951; sh: 21; makefile: 12
file content (53 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Feature: Stop all commands

  To stop all running commands use the `#stop_all_commands`-method.

  Background:
    Given I use a fixture named "cli-app"

  Scenario: Multiple commands are running
    Given an executable named "bin/cli" with:
    """bash
    #!/bin/bash
    sleep 3
    """
    And a file named "spec/run_spec.rb" with:
    """ruby
    require 'spec_helper'

    RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5 do
      before(:each) { run_command('cli') }
      before(:each) { run_command('cli') }

      before(:each) { stop_all_commands }

      it { expect(all_commands).to all be_stopped }
    end
    """
    When I run `rspec`
    Then the specs should all pass

  Scenario: Stop all commands for which the block returns true
    Given an executable named "bin/cli" with:
    """bash
    #!/bin/bash
    sleep 1
    """
    And a file named "spec/run_spec.rb" with:
    """ruby
    require 'spec_helper'

    RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2 do
      before(:each) { @cmd1 = run_command('cli') }
      before(:each) { @cmd2 = run_command('cli') }
      before(:each) { @cmd3 = run_command('sleep 1') }

      before(:each) { stop_all_commands { |c| c.commandline == 'cli' } }

      it { expect(@cmd1).to be_stopped }
      it { expect(@cmd2).to be_stopped }
      it { expect(@cmd3).not_to be_stopped }
    end
    """
    When I run `rspec`
    Then the specs should all pass