Sha256: 0f8569422465c834cf48dceb61e21f30b7ea039fbf634088fa6826e910cabb50

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 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

3 entries across 3 versions & 1 rubygems

Version Path
git_wrapper-1.0.2 spec/support/matchers/git_status_matchers.rb
git_wrapper-1.0.1 spec/support/matchers/git_status_matchers.rb
git_wrapper-1.0.0 spec/support/matchers/git_status_matchers.rb