blob: 024bfac0770992d1906ba75da835190b47b93443 (
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
|
require 'spec_helper'
describe "sdflkjskdjf" do
subject { create(:line) }
def set_large_object_id( line)
line.update_attributes :objectid => "AA:Line:123456789012345"
end
describe "validation objectid unique constraint" do
let(:referential){subject.referential}
let(:objectid_a){ "A:Line:1234" }
let(:objectid_b){ "B:Line:1234" }
let!(:second_line){ create( :line, :objectid => objectid_a, :registration_number => "123456") }
context "when referential works with HUB" do
before( :each) do
referential.update_attributes :data_format => "hub"
subject.update_attributes :objectid => objectid_a
end
it "should have objectid with a third part shorter than 14 char" do
subject.update_attributes :objectid => objectid_b
subject.should_not be_valid
end
end
context "when referential doesn't works with HUB" do
before( :each) do
referential.update_attributes :data_format => "hub"
end
#it "should have objectid with a third part shorter than 14 char" do
# subject.update_attributes :objectid => objectid_b, :registration_number => '324'
# subject.should be_valid
#end
end
end
describe "validation objectid size" do
let(:referential){subject.referential}
context "when referential works with HUB" do
before( :each) do
referential.update_attributes :data_format => "hub"
end
it "should have objectid with a third part shorter than 14 char" do
set_large_object_id( subject)
subject.should_not be_valid
end
end
context "when referential doesn't works with HUB" do
before( :each) do
referential.update_attributes :data_format => "hub"
end
#it "should have objectid with a third part shorter than 14 char" do
# set_large_object_id( subject)
# subject.should be_valid
#end
end
end
end
|