fossil 0.5.26 → 0.5.27

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.26
1
+ 0.5.27
data/fossil.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fossil}
8
- s.version = "0.5.26"
8
+ s.version = "0.5.27"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Patrick Lardin, Daniel Sudol"]
12
- s.date = %q{2011-01-26}
12
+ s.date = %q{2011-02-08}
13
13
  s.description = %q{Access FOS/betrieve db with this Sequel based orm wrapper}
14
14
  s.email = %q{plardin@xojet.com}
15
15
  s.extra_rdoc_files = [
@@ -136,13 +136,12 @@ Gem::Specification.new do |s|
136
136
  "lib/sequel/serializer/serializer.rb",
137
137
  "lib/sequel/serializer/xml_serializer.rb",
138
138
  "lib/sequel/sqlite_pervasive_adapter.rb",
139
- "lib/support/date_extentions.rb",
139
+ "lib/support/core_extensions.rb",
140
140
  "lib/support/delegate_method.rb",
141
- "lib/support/hash_extentions.rb",
142
141
  "lib/support/number_helper.rb",
143
142
  "spec/be_model_with_values_matcher.rb",
144
143
  "spec/be_model_with_values_matcher_spec.rb",
145
- "spec/hash_extentions_spec.rb",
144
+ "spec/core_extensions_spec.rb",
146
145
  "spec/helper_classes.rb",
147
146
  "spec/helper_methods.rb",
148
147
  "spec/models/airport_fbo_spec.rb",
@@ -167,7 +166,7 @@ Gem::Specification.new do |s|
167
166
  s.rubygems_version = %q{1.3.7}
168
167
  s.summary = %q{Sequel orm wrapper to FOS}
169
168
  s.test_files = [
170
- "spec/hash_extentions_spec.rb",
169
+ "spec/core_extensions_spec.rb",
171
170
  "spec/spec_helper.rb",
172
171
  "spec/helper_methods.rb",
173
172
  "spec/be_model_with_values_matcher_spec.rb",
@@ -671,12 +671,18 @@ class TripLeg < Sequel::Model(:'trip legs')
671
671
 
672
672
  column_view :arrival_date_gmt, :date, :actual_arrival_date_gmt
673
673
  column_view :arriv_time_act_gmt, :time, :actual_arrival_time_gmt
674
- column_def_datetime :actual_arrival_date_time_gmt, :'arrival date gmt', :'arriv time act gmt'
674
+ # Fixed to check if actual fields are populated, on older records these fields are not populated so we can't use them.
675
+ # Jade Tucker 2/08/2011
676
+ def actual_arrival_date_time_gmt
677
+ date = (arr_date_act_gmt > 0 ? arr_date_act_gmt : arrival_date_gmt)
678
+ DateTime.from_fos_date_time(date, arriv_time_act_gmt)
679
+ end
675
680
 
676
681
  def actual_land_date_time_gmt
677
682
  time = land_time_act_gmt
678
683
  time -= 60*24 if land_time_act_gmt > arriv_time_act_gmt
679
- DateTime.from_fos_date_time(arrival_date_gmt, time)
684
+ date = (arr_date_act_gmt > 0 ? arr_date_act_gmt : arrival_date_gmt)
685
+ DateTime.from_fos_date_time(date, time)
680
686
  end
681
687
 
682
688
  column_view :dept_date_act_local, :date, :actual_departure_date_local
@@ -709,14 +715,14 @@ class TripLeg < Sequel::Model(:'trip legs')
709
715
  column_view :depart_time_act_home, :time, :actual_departure_time_base
710
716
  column_def_datetime :actual_departure_date_time_base_old, :'dept date act home', :'depart time act home'
711
717
  def actual_departure_date_time_base
712
- (actual_departure_date_time_gmt.to_time + (home_tz_gmt_offset/10).hours).to_datetime
718
+ (actual_departure_date_time_gmt.to_time.utc + (home_tz_gmt_offset/10).hours).to_datetime
713
719
  end
714
720
 
715
721
  column_view :arr_date_act_home, :date, :actual_arrival_date_base
716
722
  column_view :arrival_time_act_hom, :time, :actual_arrival_time_base
717
723
  column_def_datetime :actual_arrival_date_time_base_old, :'arr date act home', :'arrival time act hom'
718
724
  def actual_arrival_date_time_base
719
- (actual_arrival_date_time_gmt.to_time + (home_tz_gmt_offset/10).hours).to_datetime
725
+ (actual_arrival_date_time_gmt.to_time.utc + (home_tz_gmt_offset/10).hours).to_datetime
720
726
  end
721
727
 
722
728
  column_view :ete, :time
@@ -729,7 +735,6 @@ class TripLeg < Sequel::Model(:'trip legs')
729
735
  column_view :delay_2_time, :time, :delay_2_duration
730
736
  column_view :ron, :boolean
731
737
 
732
-
733
738
  # get pic or sic or purser for this trip leg. type should be :pic or :sic or :pur
734
739
  def pilot_code(type)
735
740
  crew_leg = pilot_crew(type)
@@ -1,5 +1,7 @@
1
+ require 'date'
2
+
1
3
  class Date
2
- FOS_JD_OFFSET_DAYS = Date.parse('1899-12-31').jd
4
+ FOS_JD_OFFSET_DAYS = Date.parse('1899-12-31').jd unless defined?(FOS_JD_OFFSET_DAYS)
3
5
 
4
6
  def self.from_fos_days(days)
5
7
  self.jd(FOS_JD_OFFSET_DAYS + days)
@@ -122,4 +124,9 @@ class DateTime
122
124
  def long_view
123
125
  self.strftime('%B %d, %Y %H:%M')
124
126
  end
127
+
128
+ # Converts self to a Ruby Date object; time portion is discarded
129
+ def to_date
130
+ ::Date.new(year, month, day)
131
+ end unless method_defined?(:to_date)
125
132
  end
@@ -1,4 +1,42 @@
1
1
  require 'json'
2
+
3
+ class Integer
4
+ def as_cost
5
+ self/100.0
6
+ end
7
+
8
+ def in_hundredths
9
+ self.to_f.in_hundredths
10
+ end
11
+ end
12
+
13
+ class Float
14
+ def as_cost
15
+ self/100.0
16
+ end
17
+
18
+ def in_hundredths
19
+ return 0 if self == 0
20
+ val = "#{self/60.0}.#{((100.0*(self.modulo(60.0)))/60.0).to_s.rjust(2, '0')}"
21
+ BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN)
22
+ BigDecimal.new(val, 2).round(2).to_f
23
+ end
24
+ end
25
+
26
+ class Range
27
+ def split_by_step(step)
28
+ current_min = min
29
+ arr = []
30
+ while (current_min + step) <= max
31
+ current_max = current_min + step
32
+ arr << (current_min..current_max)
33
+ current_min = (current_max + 1)
34
+ end
35
+ arr << (current_min..max) unless current_min > max
36
+ arr
37
+ end
38
+ end
39
+
2
40
  class Hash
3
41
  XML_TYPE_NAMES =
4
42
  {
@@ -69,4 +107,30 @@ class Hash
69
107
  end
70
108
  self
71
109
  end
110
+
111
+ def diff(other)
112
+ self.keys.inject({}) do |memo, key|
113
+ unless self[key] == other[key]
114
+ memo[key] = other[key]
115
+ end
116
+ memo
117
+ end
118
+ end
119
+ end
120
+
121
+ class Numeric
122
+ def minutes
123
+ self * 60
124
+ end
125
+ alias :minute :minutes
126
+
127
+ def hours
128
+ self * 3600
129
+ end
130
+ alias :hour :hours
131
+
132
+ def days
133
+ self * 24.hours
134
+ end
135
+ alias :day :days
72
136
  end
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe Hash do
4
+ it "limit_to_keys should limit keys in hash" do
5
+ h = {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
6
+ h.limit_to_keys([:bro1,:bro2]).should == {:bro1=>'me',:bro2=>'rob'}
7
+ h.should == {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
8
+ end
9
+
10
+ it "limit_to_keys! should destructively limit keys in hash" do
11
+ h = {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
12
+ h.limit_to_keys!([:bro1,:bro2]).should == {:bro1=>'me',:bro2=>'rob'}
13
+ h.should == {:bro1=>'me',:bro2=>'rob'}
14
+ end
15
+
16
+ it "soft deletes" do
17
+ h = {:dan=>1,:eric=>2}
18
+ h.soft_delete(:dan).should == {:eric=>2}
19
+ end
20
+ end
21
+
22
+ describe Integer do
23
+ it "should return the number divided by 100 as a float" do
24
+ i = 1000043
25
+ i.as_cost.should == 10000.43
26
+ end
27
+
28
+ it "should return the number in hundredths" do
29
+ i = 10343
30
+ i.in_hundredths.should == 172.38
31
+ end
32
+ end
33
+
34
+ describe Float do
35
+ it "should return the number divided by 100" do
36
+ i = 1000043.0
37
+ i.as_cost.should == 10000.430
38
+ end
39
+
40
+ it "should return the number in hundredths" do
41
+ i = 10343.56
42
+ i.in_hundredths.should == 172.39
43
+ end
44
+ end
45
+
46
+ describe Range do
47
+ it "method split_by_step creates ranges out of original range by step" do
48
+ range = 0..30
49
+ range.split_by_step(10).should == [0..10,11..21,22..30]
50
+ range = 1..101
51
+ range.split_by_step(25).should == [1..26,27..52,53..78,79..101]
52
+ range = 0..20
53
+ range.split_by_step(20).should == [0..20]
54
+ range = 1..2
55
+ range.split_by_step(3).should == [1..2]
56
+ range = 1..1
57
+ range.split_by_step(10).should == [1..1]
58
+ end
59
+ end
@@ -78,32 +78,58 @@ describe TripLeg do
78
78
  tl.actual_takeoff_date_time_gmt.should == DateTime.new(1900, 1, 1, 0, 40, 0)
79
79
  end
80
80
 
81
- it "actual landing date_time dates are before arr_date_act_gmt if on time time is greater than landing time" do
82
- arr_date_act_gmt = Date.new(1900, 1, 2)
83
- tl = TripLeg.new(:arrival_date_gmt=>arr_date_act_gmt.to_fos_days, :land_time_act_gmt=>1420, :arriv_time_act_gmt=>20)
84
- tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 1, 23, 40, 0)
81
+
82
+ describe 'actual_land_date_time_gmt' do
83
+ it "actual_landing_date_time dates are before arr_date_act_gmt if on time time is greater than landing time" do
84
+ tl = TripLeg.new(:arr_date_act_gmt=> Date.new(1900, 1, 2).to_fos_days,
85
+ :land_time_act_gmt=> 1420,
86
+ :arriv_time_act_gmt=> 20)
87
+ tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 1, 23, 40, 0)
88
+ end
89
+
90
+ it "actual landing date_time dates are the same as arr_date_act_gmt if on time time is NOT greater than landing time" do
91
+ tl = TripLeg.new(:arr_date_act_gmt=> Date.new(1900, 1, 2).to_fos_days,
92
+ :land_time_act_gmt=> 20,
93
+ :arriv_time_act_gmt=> 40)
94
+ tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 20, 0)
95
+ end
85
96
  end
86
97
 
87
- it "actual landing date_time dates are the same as arr_date_act_gmt if on time time is not greater than landing time" do
88
- arr_date_act_gmt = Date.new(1900, 1, 2)
89
- tl = TripLeg.new(:arrival_date_gmt=>arr_date_act_gmt.to_fos_days, :land_time_act_gmt=>20, :arriv_time_act_gmt=>40)
90
- tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 20, 0)
98
+ describe 'actual_arrival_date_time_gmt' do
99
+ it "has the old 'arrival date - gmt' field set" do
100
+ tl = TripLeg.new(:arr_date_act_gmt=> 0, # old field not set
101
+ :arrival_date_gmt=> 2, # should use this field instead
102
+ :arriv_time_act_gmt=> 10)
103
+ tl.actual_arrival_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 10, 0)
104
+ end
105
+
106
+ it "has the new 'arr date act gmt' field set" do
107
+ tl = TripLeg.new(:arr_date_act_gmt=> 2, # old field is set, so use this one
108
+ :arrival_date_gmt=> 0, # new field not set
109
+ :arriv_time_act_gmt=> 10)
110
+ tl.actual_arrival_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 10, 0)
111
+ end
91
112
  end
92
113
 
93
- it "actual arrival date_time base are correctly calculating the tz offset" do
94
- arr_date_act_gmt = Date.new(1900, 1, 2)
95
- arriv_time_act_gmt = 1420
114
+ it "actual_arrival_date_time_base are correctly calculating the tz offset" do
115
+ # this makes an actual_arrival_date_time_gmt date of: 1900-01-02 23:40:00
116
+ arr_date_act_gmt, arriv_time_act_gmt = Date.new(1900, 1, 2).to_fos_days , 1420
96
117
  home_tz_gmt_offset = -70
97
- tl = TripLeg.new(:arrival_date_gmt => arr_date_act_gmt.to_fos_days, :arriv_time_act_gmt => arriv_time_act_gmt,
118
+ # home_tz_gmt_offset should make actual_arrival_date_time_base of: 1900-01-02 16:40:00
119
+ tl = TripLeg.new(:arr_date_act_gmt => arr_date_act_gmt,
120
+ :arriv_time_act_gmt => arriv_time_act_gmt,
98
121
  :home_tz_gmt_offset => home_tz_gmt_offset)
99
122
  tl.actual_arrival_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
100
123
  end
101
124
 
102
- it "actual departure date_time base are correctly calculating the tz offset" do
103
- dept_date_act_gmt = Date.new(1900, 1, 2)
104
- dept_time_act_gmt = 1420
125
+
126
+ it "actual_departure_date_time_base are correctly calculating the tz offset" do
127
+ # this makes an actual_arrival_date_time_gmt date of: 1900-01-02 23:40:00
128
+ dept_date_act_gmt, dept_time_act_gmt = Date.new(1900, 1, 2).to_fos_days , 1420
105
129
  home_tz_gmt_offset = -70
106
- tl = TripLeg.new(:dept_date_act_gmt => dept_date_act_gmt.to_fos_days, :dept_time_act_gmt => dept_time_act_gmt,
130
+ # home_tz_gmt_offset should make actual_arrival_date_time_base of: 1900-01-02 16:40:00
131
+ tl = TripLeg.new(:dept_date_act_gmt => dept_date_act_gmt,
132
+ :dept_time_act_gmt => dept_time_act_gmt,
107
133
  :home_tz_gmt_offset=>home_tz_gmt_offset)
108
134
  tl.actual_departure_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
109
135
  end
@@ -190,7 +216,7 @@ describe TripLeg do
190
216
  end
191
217
  end
192
218
 
193
- #
219
+
194
220
  ## NEED TO REMOVE, TESTS SHOULD BE IN FlightLogExpense spec
195
221
  # describe "fuel passdown data columns" do
196
222
  #
@@ -2,37 +2,37 @@ require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe Sequel do
4
4
 
5
- # describe "has method 'fos' that" do
6
- # before :each do
7
- # @db = Sequel.fos('fos')
8
- # end
9
- #
10
- # it "instantiates a fos/pervasive db from an odbc name" do
11
- # @db.should_not be nil
12
- # end
13
- #
14
- # it "actually works to see a fos table" do
15
- # TripLeg.db=@db
16
- # TripLeg.first.should_not be nil
17
- # end
18
- # end
19
-
20
- describe "has method 'fos_dbr' that" do
5
+ describe "has method 'fos' that" do
21
6
  before :each do
22
- hash = {:host=>"localhost", :user=>'root', :password=>'', :database=>'test'}
23
- @db = Sequel.fos_dbr(hash)
7
+ @db = Sequel.fos('fos')
24
8
  end
25
9
 
26
- it "instantiates dbr/mysql db from hash of params name" do
10
+ it "instantiates a fos/pervasive db from an odbc name" do
27
11
  @db.should_not be nil
28
12
  end
29
13
 
30
- it "actually loaded the dbr files" do
31
- [Trip,Quote].each{|model| model.db=@db}
32
- Trip.eager_graph(:quote).sql.should =~ /(`quote`.`id` = `trips`.`quote_id`)/
14
+ it "actually works to see a fos table" do
15
+ TripLeg.db=@db
16
+ TripLeg.first.should_not be nil
33
17
  end
34
18
  end
35
19
 
20
+ # describe "has method 'fos_dbr' that" do
21
+ # before :each do
22
+ # hash = {:host=>"localhost", :user=>'root', :password=>'', :database=>'test'}
23
+ # @db = Sequel.fos_dbr(hash)
24
+ # end
25
+ #
26
+ # it "instantiates dbr/mysql db from hash of params name" do
27
+ # @db.should_not be nil
28
+ # end
29
+ #
30
+ # it "actually loaded the dbr files" do
31
+ # [Trip,Quote].each{|model| model.db=@db}
32
+ # Trip.eager_graph(:quote).sql.should =~ /(`quote`.`id` = `trips`.`quote_id`)/
33
+ # end
34
+ # end
35
+
36
36
  # it "set_db method finds sets db on all Sequel models" do
37
37
  # db = Sequel.fos('fos')
38
38
  # Sequel.set_db db
data/spec/silly_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'fossil'
1
+ require_relative '../lib/fossil'
2
2
  require 'logger'
3
3
  require 'pp'
4
4
 
@@ -7,13 +7,26 @@ require 'pp'
7
7
 
8
8
  DB = Sequel.fos('fosprod', :loggers=>[Logger.new($stdout)])
9
9
  #DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
10
- #CrewDuty.db = DB
10
+ TripLeg.db = DB
11
+ #p TripLeg.filter(:eta_gmt=>0).count
12
+ #p TripLeg.filter(:arriv_time_act_gmt=>0).count
13
+ t = TripLeg.first(:trip_number=>83106,:leg_number=>1)
14
+ #p t.actual_departure_date_time_gmt.to_time
15
+ #p t.actual_departure_date_time_gmt.to_time.utc
16
+ #pp t.fill_hash(
17
+ # [:actual_departure_date_time_gmt,
18
+ # :actual_arrival_date_time_gmt,
19
+ # :actual_departure_date_time_base,
20
+ # :actual_arrival_date_time_base
21
+ # ]
22
+ #)
11
23
 
12
24
  #date = Date.today - 1
25
+ #p date
13
26
  #pp CrewDuty.find_crew_duty_in_time_range(date, date).collect{|v| [v.duty_start_time.to_s, v.duty_end_time.to_s, v.amended, v.amended_date, v.verified_date] }
14
-
15
- [CrewDuty].each{|m| m.db=DB}
16
- p CrewDuty.count
27
+ #[CrewDuty].each{|m| m.db=DB}
28
+ #c = CrewDuty.filter(:kid_user=>'DEMO').first
29
+ #c.update(:risk=>2)
17
30
  #[Personnel,ACQualification,Code].each{|m| m.db=DB}
18
31
  #p ACQualification.first
19
32
  #p Personnel.first(:employee_id=>'COXD').ac_qualifications.find{|ac| ac.aircraft_type_id='C750'}
@@ -38,7 +51,12 @@ p CrewDuty.count
38
51
  #p AirportFbo.filter(:icao=>'KSFO').count
39
52
  #DB.execute('Update "trip legs" set "lunch comment" = \'hi\' where "trip number" = 83100 and "leg number" = 3')
40
53
  #DB.execute('Update "trip legs" set "pax count" = 4 where "trip number" = 62 and "leg number" = 1 ')
41
- #tl = TripLeg.filter(:trip_number=>62,:leg_number=>1).first#eager_graph(:arrival_fbo).all.first
54
+ #tl = TripLeg.filter(:trip_number=>69012,:leg_number=>1).first#eager_graph(:arrival_fbo).all.first
55
+ #p tl.actual_arrival_date_time_gmt
56
+ #date = TripLeg.filter(:arr_date_act_gmt=>0).filter{:verify_date >0}.order(:kid_date).last.kid_date # :arrival_date_gmt
57
+ #p Date.from_fos_days(date).to_s
58
+ #p TripLeg.filter(:arr_date_act_gmt=>0).count # :arrival_date_gmt
59
+ #p TripLeg.count # :arrival_date_gmt
42
60
  #p tl.fos_id
43
61
  #p tl.pax_count
44
62
  #tl2 = TripLeg.filter(tl.pk_hash.soft_delete(:'kid - user')).filter(:kid_user.like("%#{tl.kid_user}%")).first
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 26
9
- version: 0.5.26
8
+ - 27
9
+ version: 0.5.27
10
10
  platform: ruby
11
11
  authors:
12
12
  - Patrick Lardin, Daniel Sudol
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-26 00:00:00 -08:00
17
+ date: 2011-02-08 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -187,13 +187,12 @@ files:
187
187
  - lib/sequel/serializer/serializer.rb
188
188
  - lib/sequel/serializer/xml_serializer.rb
189
189
  - lib/sequel/sqlite_pervasive_adapter.rb
190
- - lib/support/date_extentions.rb
190
+ - lib/support/core_extensions.rb
191
191
  - lib/support/delegate_method.rb
192
- - lib/support/hash_extentions.rb
193
192
  - lib/support/number_helper.rb
194
193
  - spec/be_model_with_values_matcher.rb
195
194
  - spec/be_model_with_values_matcher_spec.rb
196
- - spec/hash_extentions_spec.rb
195
+ - spec/core_extensions_spec.rb
197
196
  - spec/helper_classes.rb
198
197
  - spec/helper_methods.rb
199
198
  - spec/models/airport_fbo_spec.rb
@@ -245,7 +244,7 @@ signing_key:
245
244
  specification_version: 3
246
245
  summary: Sequel orm wrapper to FOS
247
246
  test_files:
248
- - spec/hash_extentions_spec.rb
247
+ - spec/core_extensions_spec.rb
249
248
  - spec/spec_helper.rb
250
249
  - spec/helper_methods.rb
251
250
  - spec/be_model_with_values_matcher_spec.rb
@@ -1,26 +0,0 @@
1
- require 'date'
2
-
3
- class DateTime
4
- # Converts self to a Ruby Date object; time portion is discarded
5
- def to_date
6
- ::Date.new(year, month, day)
7
- end unless method_defined?(:to_date)
8
- end
9
-
10
-
11
- class Numeric
12
- def minutes
13
- self * 60
14
- end
15
- alias :minute :minutes
16
-
17
- def hours
18
- self * 3600
19
- end
20
- alias :hour :hours
21
-
22
- def days
23
- self * 24.hours
24
- end
25
- alias :day :days
26
- end
@@ -1,20 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
-
3
- describe "hash extentions" do
4
- it "limit_to_keys should limit keys in hash" do
5
- h = {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
6
- h.limit_to_keys([:bro1,:bro2]).should == {:bro1=>'me',:bro2=>'rob'}
7
- h.should == {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
8
- end
9
-
10
- it "limit_to_keys! should destructively limit keys in hash" do
11
- h = {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
12
- h.limit_to_keys!([:bro1,:bro2]).should == {:bro1=>'me',:bro2=>'rob'}
13
- h.should == {:bro1=>'me',:bro2=>'rob'}
14
- end
15
-
16
- it "soft deletes" do
17
- h = {:dan=>1,:eric=>2}
18
- h.soft_delete(:dan).should == {:eric=>2}
19
- end
20
- end