fossil 0.4.26 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require 'ostruct'
2
3
 
3
4
  describe VendorDocument do
4
5
 
@@ -12,7 +12,7 @@ describe "fos_dates" do
12
12
  end
13
13
 
14
14
  it "Time class to_fos_days converts time to to days since epoch" do
15
- DateTime.new(1900,1,10,0,0,0).to_time.to_fos_days.should == 10
15
+ DateTime.new(1900,1,10,0,0,0).to_datetime.to_fos_days.should == 10
16
16
  end
17
17
 
18
18
  it "converts fos date number to a Ruby Date" do
@@ -28,17 +28,21 @@ describe "fos_dates" do
28
28
  end
29
29
 
30
30
  it "converts a Ruby Time to hundredths" do
31
- Time.from_fos_time(100).in_hundredths.should == "1.66"
31
+ Time.from_fos_time(100).in_hundredths.should == 1.66
32
32
  end
33
33
 
34
34
  it "Date view defaults to y-m-d" do
35
35
  Date.parse('Sept 9, 2009').to_s.should == "2009-09-09"
36
36
  end
37
37
 
38
- it "Time view defaults to M:H" do
38
+ it "Time view defaults to H:M" do
39
39
  Time.parse('Sept 9, 2009 07:10').to_s.should == "07:10"
40
40
  end
41
41
 
42
+ it "DateTime from fos date time" do
43
+ DateTime.from_fos_date_time(40209,100).should == DateTime.new(2010,2,1,1,40,0)
44
+ end
45
+
42
46
  it "DateTime has long_view method that makes long formatted string" do
43
47
  tl = TripLeg.new(:dept_date_gmt=>40209, :etd_gmt=>100)
44
48
  tl.planned_departure_date_time_gmt__long_view.should == "February 01, 2010 01:40"
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
  require File.dirname(__FILE__) + '/spec_helper_tables' unless metaclass.class_variable_defined? :@@set_up_demo_tables
3
-
3
+
4
4
  describe "Sequel::Model extentions" do
5
5
 
6
6
  it "find_children method finds find Sequel::Models" do
@@ -8,8 +8,9 @@ describe "Sequel::Model extentions" do
8
8
  end
9
9
 
10
10
  it "makes fos_id" do
11
+ set_fos_db([TripLeg])
11
12
  tl = TripLeg.new(:kid_user => 'ME ',:kid_mult => 1,:kid_comm => 2,:kid_date => 3,:kid_time => 4)
12
- tl.fos_id.should == "ME.1.2.3.4"
13
+ tl.fos_id.should == "ME-1-2-3-4"
13
14
  end
14
15
 
15
16
  describe "fill_hash method" do
@@ -51,6 +52,7 @@ describe "Sequel::Model extentions" do
51
52
  end
52
53
 
53
54
  it "can update and save" do
55
+ set_demo_db([TestTable])
54
56
  add_test_table_data({:date_col => 123, :time_col=>60})
55
57
  record = TestTable.first
56
58
  record[:'goofy name col'] = 124
@@ -60,6 +62,10 @@ describe "Sequel::Model extentions" do
60
62
 
61
63
  describe "select_fields method" do
62
64
 
65
+ before :each do
66
+ set_demo_db([Code,Dude,MyFriend,Horse])
67
+ end
68
+
63
69
  it "works on model" do
64
70
  dude = Dude.select_fields(:self => ['kid - date']).first
65
71
  dude[:'kid - date'].should == 1
@@ -77,7 +83,8 @@ describe "Sequel::Model extentions" do
77
83
 
78
84
  it "can select more than one table with columns of the same name" do
79
85
  # dude = Dude.eager_graph(:horses).select(*(Dude.pk_for_select + Horse.pk_for_select(:table=>:horses,:alias=>true) + [:'dudes__name', :'horses__name___horses_name'])).all.first
80
- dude = Dude.eager_graph(:horses).select_fields(:self => [:name], :horses => [:name]).all.first
86
+ dude = Dude.eager_graph(:horses).
87
+ select_fields(:self => [:name], :horses => [:name]).all.first
81
88
  dude.name.should == "dano"
82
89
  dude.horses.first.name.should == 'pinto'
83
90
  end
@@ -85,13 +92,18 @@ describe "Sequel::Model extentions" do
85
92
  it "selects column alias from correct table" do
86
93
  Dude.column_alias :doo, :'kid - date'
87
94
  Horse.column_alias :hoo, :'kid - time'
88
- dude = Dude.eager_graph(:horses).select_fields(:self => [:doo], :horses => [:hoo]).all.first
95
+ dude = Dude.eager_graph(:horses).
96
+ select_fields(:self => [:doo], :horses => [:hoo]).all.first
89
97
  dude.doo.should == 1
90
98
  dude.horses.first.hoo.should == 1
91
99
  end
92
100
 
93
101
  it "selects particular columns from joined tables" do
94
- dude = Dude.eager_graph(:ranch_code, :my_friend, :horses).select_fields(:self => [:name], :ranch_code => [:code], :my_friend => [:name], :horses => [:name]).all.first
102
+ dude = Dude.eager_graph(:ranch_code, :my_friend, :horses).
103
+ select_fields(:self => [:name],
104
+ :ranch_code => [:code],
105
+ :my_friend => [:name],
106
+ :horses => [:name]).all.first
95
107
  dude.ranch_code_code.should == "men"
96
108
  dude.name.should == "dano"
97
109
  dude.horses.first.name.should == 'pinto'
@@ -108,6 +120,7 @@ describe "Sequel::Model extentions" do
108
120
  end
109
121
 
110
122
  before do
123
+ set_demo_db([TestTable])
111
124
  add_test_table_data({:date_col => 123, :time_col=>60, :price=>1215, :paid=>1})
112
125
  TestTable.column_view :date_col, :date
113
126
  TestTable.column_view :time_col, :time
@@ -158,6 +171,7 @@ describe "Sequel::Model extentions" do
158
171
  describe "column_alias" do
159
172
 
160
173
  before :each do
174
+ set_demo_db([TestTable])
161
175
  add_test_table_data({:id=>1, :'goofy name col' => 123})
162
176
  end
163
177
 
@@ -220,6 +234,7 @@ describe "Sequel::Model extentions" do
220
234
  describe "column_type" do
221
235
 
222
236
  before :each do
237
+ set_demo_db([TestTable])
223
238
  add_test_table_data({:date_col => 123, :time_col=>60})
224
239
  end
225
240
 
@@ -238,7 +253,7 @@ describe "Sequel::Model extentions" do
238
253
  TestTable.column_type :time_col, :time
239
254
 
240
255
  TestTable.first[:time_col].should be_a_kind_of(DateTime)
241
- TestTable.first[:time_col].should == Date.from_fos_days(0).to_time.utc + 60.minutes
256
+ TestTable.first[:time_col].should == DateTime.new(1899,12,31,1,0,0)
242
257
  end
243
258
 
244
259
  it "should find rows" do
@@ -250,6 +265,7 @@ describe "Sequel::Model extentions" do
250
265
  describe "column_def" do
251
266
 
252
267
  before do
268
+ set_demo_db([TestTable])
253
269
  TestTable.column_def_datetime :datetime_col, :date_col, :time_col
254
270
  end
255
271
 
@@ -316,6 +332,10 @@ describe "Sequel::Model extentions" do
316
332
 
317
333
  describe "n_to_o" do
318
334
 
335
+ before :each do
336
+ set_demo_db([Horse,Dude])
337
+ end
338
+
319
339
  it "retrieves the association" do
320
340
  Horse.first.dude.name.should == 'dano'
321
341
  end
@@ -350,7 +370,6 @@ describe "Sequel::Model extentions" do
350
370
  @trip_leg.passenger_list.should == "Mendelson, Victor (lead pax) : Mendelson, Laurans : Irwin, Thomas"
351
371
  end
352
372
  end
353
-
354
373
  end
355
374
 
356
375
  end
@@ -4,6 +4,9 @@ require File.dirname(__FILE__) + '/../spec_helper_tables' unless metaclass.class
4
4
  describe "Sequel::Serializer" do
5
5
 
6
6
  describe "to_fos_json method" do
7
+ before :each do
8
+ set_demo_db([TestTable,Dude,Horse])
9
+ end
7
10
 
8
11
  it "adds :only=>[] to the options hash" do
9
12
  data = Trip.new
@@ -1,15 +1,15 @@
1
- require 'lib/fossil'
2
- gem "rspec", '1.3.0'
3
- require 'spec'
1
+ require_relative '../lib/fossil'
2
+ #gem "rspec", '1.3.0'
3
+ require 'rspec'
4
4
  require 'rr'
5
- require 'pp'
5
+ require 'logger'
6
6
 
7
7
  p RUBY_VERSION
8
8
 
9
9
  unless defined?(DB_DEMO)
10
- DB_DEMO = Sequel.odbc('demodata')#, :loggers=>[Logger.new($stdout)])
10
+ DB_DEMO = Sequel.odbc('demodata') #, :loggers=>[Logger.new($stdout)])
11
11
  DB_DEMO.extend(Sequel::Pervasive::DatabaseMethods)
12
-
12
+
13
13
  DB_FOS = Sequel.odbc('fos', :loggers=>[Logger.new($stdout)])
14
14
  DB_FOS.extend(Sequel::Pervasive::DatabaseMethods)
15
15
  end
@@ -19,12 +19,20 @@ require File.dirname(__FILE__) + "/helper_classes"
19
19
  ##### custom matchers #####
20
20
  require File.dirname(__FILE__) + "/be_model_with_values_matcher"
21
21
 
22
- Spec::Runner.configure do |config|
22
+ RSpec.configure do |config|
23
+ config.mock_with :rr
24
+
23
25
  config.include(HelperMethods)
24
26
  config.mock_with :rr
25
27
  config.include(BeModelWithValuesMatcher)
26
28
  end
27
29
 
30
+ RSpec::Matchers.define :equal_xml do |expected|
31
+ match do |actual|
32
+ actual.gsub(/\s/, '').should == expected.gsub(/\s/, '')
33
+ end
34
+ end
35
+
28
36
  module Sequel::Pervasive::DatabaseMethods
29
37
 
30
38
  # turn autocommit offffffffff
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
- - 26
9
- version: 0.4.26
7
+ - 5
8
+ - 0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Patrick Lardin, Daniel Sudol
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-27 00:00:00 -07:00
17
+ date: 2010-10-04 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: sequel
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - "="
26
27
  - !ruby/object:Gem::Version
@@ -31,24 +32,11 @@ dependencies:
31
32
  version: 3.13.0
32
33
  type: :runtime
33
34
  version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: activesupport
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 2
43
- - 3
44
- - 5
45
- version: 2.3.5
46
- type: :runtime
47
- version_requirements: *id002
48
35
  - !ruby/object:Gem::Dependency
49
36
  name: rspec
50
37
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
52
40
  requirements:
53
41
  - - ">="
54
42
  - !ruby/object:Gem::Version
@@ -56,7 +44,7 @@ dependencies:
56
44
  - 0
57
45
  version: "0"
58
46
  type: :development
59
- version_requirements: *id003
47
+ version_requirements: *id002
60
48
  description: Access FOS/betrieve db with this Sequel based orm wrapper
61
49
  email: plardin@xojet.com
62
50
  executables: []
@@ -69,6 +57,8 @@ files:
69
57
  - Rakefile
70
58
  - VERSION
71
59
  - fossil.gemspec
60
+ - lib/date_extentions.rb
61
+ - lib/delegate_method.rb
72
62
  - lib/fos_schema/FOS_SCHEMA_3.8.22.r3.csv
73
63
  - lib/fos_schema/FOS_SCHEMA_3.8.27.r1.csv
74
64
  - lib/fos_schema/FOS_SCHEMA_3.9.0.csv
@@ -199,7 +189,6 @@ files:
199
189
  - spec/sequel/serializer/json_serializer_spec.rb
200
190
  - spec/sequel/serializer/xml_serializer_spec.rb
201
191
  - spec/sequel/spec_helper_tables.rb
202
- - spec/spec.opts
203
192
  - spec/spec_helper.rb
204
193
  has_rdoc: true
205
194
  homepage: ""
@@ -211,6 +200,7 @@ rdoc_options:
211
200
  require_paths:
212
201
  - lib
213
202
  required_ruby_version: !ruby/object:Gem::Requirement
203
+ none: false
214
204
  requirements:
215
205
  - - ">="
216
206
  - !ruby/object:Gem::Version
@@ -218,6 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
208
  - 0
219
209
  version: "0"
220
210
  required_rubygems_version: !ruby/object:Gem::Requirement
211
+ none: false
221
212
  requirements:
222
213
  - - ">="
223
214
  - !ruby/object:Gem::Version
@@ -227,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
218
  requirements: []
228
219
 
229
220
  rubyforge_project:
230
- rubygems_version: 1.3.6
221
+ rubygems_version: 1.3.7
231
222
  signing_key:
232
223
  specification_version: 3
233
224
  summary: Sequel orm wrapper to FOS
@@ -1,4 +0,0 @@
1
- --colour
2
- --format progress
3
- --loadby mtime
4
- --reverse