acts_as_span 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock DELETED
@@ -1,47 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- acts_as_span (0.0.5)
5
- activerecord (>= 3)
6
- activesupport
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- activemodel (3.0.10)
12
- activesupport (= 3.0.10)
13
- builder (~> 2.1.2)
14
- i18n (~> 0.5.0)
15
- activerecord (3.0.10)
16
- activemodel (= 3.0.10)
17
- activesupport (= 3.0.10)
18
- arel (~> 2.0.10)
19
- tzinfo (~> 0.3.23)
20
- activesupport (3.0.10)
21
- acts_as_fu (0.0.7.2)
22
- activerecord
23
- sqlite3-ruby
24
- arel (2.0.10)
25
- builder (2.1.2)
26
- diff-lcs (1.1.2)
27
- i18n (0.5.0)
28
- rspec (2.6.0)
29
- rspec-core (~> 2.6.0)
30
- rspec-expectations (~> 2.6.0)
31
- rspec-mocks (~> 2.6.0)
32
- rspec-core (2.6.4)
33
- rspec-expectations (2.6.0)
34
- diff-lcs (~> 1.1.2)
35
- rspec-mocks (2.6.0)
36
- sqlite3 (1.3.4)
37
- sqlite3-ruby (1.3.3)
38
- sqlite3 (>= 1.3.3)
39
- tzinfo (0.3.29)
40
-
41
- PLATFORMS
42
- ruby
43
-
44
- DEPENDENCIES
45
- acts_as_fu
46
- acts_as_span!
47
- rspec
@@ -1,17 +0,0 @@
1
- require 'active_support'
2
-
3
- module ActsAsSpan
4
- class SpanInstance
5
- module Overlap
6
- extend ActiveSupport::Concern
7
-
8
- module InstanceMethods
9
- #http://stackoverflow.com/questions/699448/ruby-how-do-you-check-whether-a-range-contains-a-subset-of-another-range
10
- #start_date <= record_end_date && record_start_date <= end_date
11
- def overlap?(other_span)
12
- (start_date.nil? || other_span.end_date.nil? || start_date <= other_span.end_date) && (end_date.nil? || other_span.start_date.nil? || other_span.start_date <= end_date)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,21 +0,0 @@
1
- require 'active_support'
2
-
3
- module ActsAsSpan
4
- class SpanKlass
5
- module Overlap
6
- extend ActiveSupport::Concern
7
-
8
- module InstanceMethods
9
- def overlap(test_span)
10
- overlap_scope = klass.where( ["(#{table_name}.#{start_date_field} IS NULL OR :end_date IS NULL OR #{table_name}.#{start_date_field} <= :end_date) AND (#{table_name}.#{end_date_field} IS NULL OR :start_date IS NULL OR :start_date <= #{table_name}.#{end_date_field})", { :start_date => test_span.start_date, :end_date => test_span.end_date } ] )
11
-
12
- if !test_span.new_record? && test_span.span_klass == klass
13
- overlap_scope.where( ["#{table_name}.id != :id", { :id => test_span.id } ] )
14
- end
15
-
16
- overlap_scope
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "acts_as_span" do
4
- before(:each) do
5
- build_model :negative_model do
6
- end
7
- end
8
-
9
- context "NegativeModel (Class)" do
10
- it "should respond_to acts_as_span" do
11
- NegativeModel.should respond_to(:acts_as_span)
12
- end
13
-
14
- it "should return false for acts_as_span?" do
15
- NegativeModel.acts_as_span?.should be_false
16
- end
17
-
18
- it "should have no acts_as_span_definitions" do
19
- NegativeModel.acts_as_span_definitions.should be_empty
20
- end
21
- end
22
-
23
- context "NegativeModel (Instance)" do
24
- let(:negative_model) { NegativeModel.new }
25
-
26
- it "should return false for acts_as_span?" do
27
- negative_model.acts_as_span?.should be_false
28
- end
29
- end
30
- end
data/spec/spec.opts DELETED
@@ -1 +0,0 @@
1
- --color