summaryrefslogtreecommitdiff
path: root/spec/change_spec.rb
blob: b5ad0cb5c937ca2c83a7a6385444edd852812171 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
# frozen_string_literal: true

require 'spec_helper'

describe Diff::LCS::Change do
  describe 'an add' do
    subject { described_class.new('+', 0, 'element') }
    it { should_not be_deleting   }
    it { should     be_adding     }
    it { should_not be_unchanged  }
    it { should_not be_changed    }
    it { should_not be_finished_a }
    it { should_not be_finished_b }
  end

  describe 'a delete' do
    subject { described_class.new('-', 0, 'element') }
    it { should     be_deleting   }
    it { should_not be_adding     }
    it { should_not be_unchanged  }
    it { should_not be_changed    }
    it { should_not be_finished_a }
    it { should_not be_finished_b }
  end

  describe 'an unchanged' do
    subject { described_class.new('=', 0, 'element') }
    it { should_not be_deleting   }
    it { should_not be_adding     }
    it { should     be_unchanged  }
    it { should_not be_changed    }
    it { should_not be_finished_a }
    it { should_not be_finished_b }
  end

  describe 'a changed' do
    subject { described_class.new('!', 0, 'element') }
    it { should_not be_deleting   }
    it { should_not be_adding     }
    it { should_not be_unchanged  }
    it { should     be_changed    }
    it { should_not be_finished_a }
    it { should_not be_finished_b }
  end

  describe 'a finished_a' do
    subject { described_class.new('>', 0, 'element') }
    it { should_not be_deleting   }
    it { should_not be_adding     }
    it { should_not be_unchanged  }
    it { should_not be_changed    }
    it { should     be_finished_a }
    it { should_not be_finished_b }
  end

  describe 'a finished_b' do
    subject { described_class.new('<', 0, 'element') }
    it { should_not be_deleting   }
    it { should_not be_adding     }
    it { should_not be_unchanged  }
    it { should_not be_changed    }
    it { should_not be_finished_a }
    it { should     be_finished_b }
  end
end