Sha256: f08ead7c8348d1ae1aeb31aa4ad82987051d63adb0cfe7dfcdc9a6717926ecc7

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

RSpec::Matchers.define :eq_git_status do |expected|
  match do |actual|
    (expected[:file_name].nil? || actual.file_name == expected[:file_name]) &&
      (expected[:original_file_name].nil? || actual.original_file_name == expected[:original_file_name]) &&
      (expected[:status].nil? || actual.status == expected[:status]) &&
      (expected[:staged_for_commit].nil? || actual.staged_for_commit == expected[:staged_for_commit])
  end
end

RSpec::Matchers.define :be_git_untracked do |expected_file_name|
  match do |actual|
    actual.file_name == expected_file_name &&
      actual.status == :untracked &&
      !actual.staged_for_commit
  end
end

RSpec::Matchers.define :be_git_new_file do |expected_file_name|
  match do |actual|
    actual.file_name == expected_file_name &&
      actual.status == :new_file &&
      actual.staged_for_commit
  end
end

RSpec::Matchers.define :be_git_deleted do |expected_file_name|
  match do |actual|
    actual.file_name == expected_file_name &&
      actual.status == :deleted &&
      actual.staged_for_commit
  end
end

RSpec::Matchers.define :be_git_merge_conflict do |expected_file_name|
  match do |actual|
    actual.file_name == expected_file_name &&
      actual.status == :merge_conflict &&
      !actual.staged_for_commit
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_wrapper-1.0.3 spec/support/matchers/git_status_matchers.rb