fossil 0.3.16 → 0.3.17
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fossil.gemspec +1 -1
- data/lib/models/vendor_document.rb +3 -3
- data/spec/models/trip_spec.rb +3 -5
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.17
|
data/fossil.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class VendorDocument < Sequel::Model(:'vendor documents')
|
2
2
|
# helper accessors for creating vendor document
|
3
3
|
# filename_prefix helps set up the path to the document
|
4
|
-
attr_accessor :doc_type_value, :
|
4
|
+
attr_accessor :doc_type_value, :file_name_prefix, :doc_type, :file_name
|
5
5
|
|
6
6
|
###### helper aliases for crewres to submit new vendor documents #########
|
7
7
|
column_alias :trip_number, :number, :type => :integer
|
@@ -14,7 +14,7 @@ class VendorDocument < Sequel::Model(:'vendor documents')
|
|
14
14
|
code_association :type, :document_type, :aircraft_document
|
15
15
|
|
16
16
|
def validate
|
17
|
-
validates_presence [:
|
17
|
+
validates_presence [:document_type, :image_name, :number, :doc_date, :document_type]
|
18
18
|
end
|
19
19
|
|
20
20
|
def after_initialize
|
@@ -54,7 +54,7 @@ class VendorDocument < Sequel::Model(:'vendor documents')
|
|
54
54
|
self.paid_date= 0
|
55
55
|
self.paid= 0
|
56
56
|
self.billed_date= 0
|
57
|
-
self.image_name= File.join(
|
57
|
+
self.image_name= File.join(file_name_prefix, file_name) if file_name
|
58
58
|
self.document_type= doc_type_value if Code.valid_value_for_group?(doc_type_value, :aircraft_document)
|
59
59
|
end
|
60
60
|
|
data/spec/models/trip_spec.rb
CHANGED
@@ -8,15 +8,13 @@ describe "Trip" do
|
|
8
8
|
|
9
9
|
it "creates a vendor document attachment" do
|
10
10
|
trip = Trip.new(:kid_date=>1,:kid_time=>2,:kid_user=>3,:kid_mult=>4,:kid_comm=>5)
|
11
|
-
|
12
|
-
|
13
|
-
mock(arr).find {OpenStruct.new(:value=>"fake_doc_type")}
|
14
|
-
doc = VendorDocument.new(:doc_filename_prefix=>"TRIP", :doc_filename=>"whatever", :doc_type_value=> 254, :trip_number=>111)
|
11
|
+
mock(Code).valid_value_for_group?(254, :aircraft_document) {true}
|
12
|
+
doc = VendorDocument.new(:file_name_prefix=>"TRIP", :file_name=>"whatever", :doc_type_value=> 254, :trip_number=>111)
|
15
13
|
doc.save()
|
16
14
|
trip.add_attachment(doc)
|
17
15
|
doc.kid_user.should == "ADMN"
|
18
16
|
doc.image_name.should == "TRIP/whatever"
|
19
|
-
doc.document_type.should ==
|
17
|
+
doc.document_type.should == 254
|
20
18
|
end
|
21
19
|
|
22
20
|
end
|