Sha256: 1eeb31ebb9f64071348c4636c5bc98bbab10b181bfebf60be0d5d7a99ab4499a

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'rspec/expectations'

RSpec::Matchers.define :be_a_pause_command do
  match do |actual|
    actual[0] == 'P'
  end

  failure_message do |actual|
    "expected that #{actual} would be a mpg321 pause command ('P'/'PAUSE')"
  end
end

RSpec::Matchers.define :be_a_stop_command do
  match do |actual|
    actual[0] == 'S'
  end

  failure_message do |actual|
    "expected that #{actual} would be a mpg321 stop command ('S'/'STOP')"
  end
end

RSpec::Matchers.define :be_a_quit_command do
  match do |actual|
    actual[0] == 'Q'
  end

  failure_message do |actual|
    "expected that #{actual} would be a mpg321 quit command ('Q'/'QUIT')"
  end
end

RSpec::Matchers.define :set_volume_to do |vol|
  match do |actual|
    actual == "G #{vol}"
  end

  failure_message do |actual|
    "expected that #{actual} would be a mpg321 gain command ('G'/'LOAD') with '#{vol}'"
  end
end

RSpec::Matchers.define :be_a_load_command_for do |file|
  match do |actual|
    actual == "L #{file}"
  end

  failure_message do |actual|
    "expected that #{actual} would be a mpg321 load command ('L'/'LOAD') for file '#{file}'"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mpg321-1.0.0 spec/support/matcher.rb