blob: 05f55c2f07c377f08251f4dfdd7fdbfc899ec64d (
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
 | require 'spec_helper'
describe Chouette::Footnote, type: :model do
  subject { create(:footnote) }
  it { should validate_presence_of :line }
  describe 'data_source_ref' do
    it 'should set default if omitted' do
      expect(subject.data_source_ref).to eq "DATASOURCEREF_EDITION_BOIV"
    end
    it 'should not set default if not omitted' do
      source = "RANDOM_DATASOURCE"
      object = build(:footnote, data_source_ref: source)
      object.save
      expect(object.data_source_ref).to eq source
    end
  end
  describe 'checksum' do
    it_behaves_like 'checksum support'
    context '#checksum_attributes' do
      it 'should return code and label' do
        expected = [subject.code, subject.label]
        expect(subject.checksum_attributes).to include(*expected)
      end
      it 'should not return other atrributes' do
        expect(subject.checksum_attributes).to_not include(subject.updated_at)
      end
    end
  end
end
 |