diff options
| author | Xinhui | 2018-01-09 14:46:40 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-02-08 11:26:52 +0100 | 
| commit | f3769c9d9fa0d4bf3c620a9c95e0c7533da9801c (patch) | |
| tree | f658745653e4706bc79efb9086d15d4f79bceb3e /spec/support | |
| parent | 31b7b91b46d2e8f740d2cfd493836219f5a4f42d (diff) | |
| download | chouette-core-f3769c9d9fa0d4bf3c620a9c95e0c7533da9801c.tar.bz2 | |
Refactoring spec checksum support5416_checksum_attribute--rb201802071702
Refs #5416
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/checksum_support.rb | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/spec/support/checksum_support.rb b/spec/support/checksum_support.rb index 9a4475e23..3d88d1d57 100644 --- a/spec/support/checksum_support.rb +++ b/spec/support/checksum_support.rb @@ -29,6 +29,33 @@ shared_examples 'checksum support' do          expect(subject.current_checksum_source).to eq(source)        end      end + +    context 'array value' do +      let(:attributes) { [['v1', 'v2', 'v3'], 'code_value'] } + +      it 'should convert to list' do +        source = "v1,v2,v3#{seperator}code_value" +        expect(subject.current_checksum_source).to eq(source) +      end +    end + +    context 'array of array value' do +      let(:attributes) { [[['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']], 'code_value'] } + +      it 'should convert to list' do +        source = "(a1,a2,a3),(b1,b2,b3)#{seperator}code_value" +        expect(subject.current_checksum_source).to eq(source) +      end +    end + +    context 'array of array value, with empty array' do +      let(:attributes) { [[['a1', 'a2', 'a3'], []], 'code_value'] } + +      it 'should convert to list' do +        source = "(a1,a2,a3),-#{seperator}code_value" +        expect(subject.current_checksum_source).to eq(source) +      end +    end    end    it 'should save checksum on create' do | 
