acts_as_interval 0.0.3 → 0.0.4

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/LICENCE.md +21 -0
  3. data/README.md +42 -0
  4. data/Rakefile +5 -21
  5. data/lib/acts_as_interval/version.rb +1 -1
  6. data/{test → spec}/dummy/README.rdoc +0 -0
  7. data/{test → spec}/dummy/Rakefile +0 -0
  8. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
  9. data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
  10. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  11. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  12. data/{test → spec}/dummy/app/models/interval.rb +0 -0
  13. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
  14. data/{test → spec}/dummy/bin/bundle +0 -0
  15. data/{test → spec}/dummy/bin/rails +0 -0
  16. data/{test → spec}/dummy/bin/rake +0 -0
  17. data/{test → spec}/dummy/config.ru +0 -0
  18. data/{test → spec}/dummy/config/application.rb +0 -0
  19. data/{test → spec}/dummy/config/boot.rb +0 -0
  20. data/{test → spec}/dummy/config/database.yml +6 -5
  21. data/{test → spec}/dummy/config/environment.rb +0 -0
  22. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  23. data/{test → spec}/dummy/config/environments/production.rb +0 -0
  24. data/{test → spec}/dummy/config/environments/test.rb +0 -0
  25. data/{test → spec}/dummy/config/initializers/assets.rb +0 -0
  26. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  27. data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +0 -0
  28. data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  29. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  30. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  31. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  32. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  33. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  34. data/{test → spec}/dummy/config/routes.rb +0 -0
  35. data/{test → spec}/dummy/config/secrets.yml +0 -0
  36. data/{test → spec}/dummy/db/migrate/20150227133736_create_intervals.rb +0 -0
  37. data/{test → spec}/dummy/db/schema.rb +0 -0
  38. data/spec/dummy/log/development.log +28 -0
  39. data/spec/dummy/log/test.log +1190 -0
  40. data/{test → spec}/dummy/public/404.html +0 -0
  41. data/{test → spec}/dummy/public/422.html +0 -0
  42. data/{test → spec}/dummy/public/500.html +0 -0
  43. data/{test → spec}/dummy/public/favicon.ico +0 -0
  44. data/spec/dummy/spec/intervals_spec.rb +22 -0
  45. data/{test → spec}/dummy/test/fixtures/intervals.yml +0 -0
  46. data/{test → spec}/dummy/test/models/interval_test.rb +0 -0
  47. data/spec/factories/intervals.rb +17 -0
  48. data/spec/spec_helper.rb +13 -0
  49. data/spec/support/factory_girl.rb +7 -0
  50. metadata +139 -87
  51. data/test/acts_as_interval_test.rb +0 -32
  52. data/test/test_helper.rb +0 -15
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,22 @@
1
+ require 'spec_helper.rb'
2
+ describe Interval, type: :model do
3
+ let!(:interval) { create :interval, starts_at: Date.today, ends_at: 1.week.from_now }
4
+ let!(:past_intervals) { create_list :interval, 3, :past }
5
+ let!(:future_intervals) { create_list :interval, 3, :future }
6
+ let!(:overlapping_intervals) { create_list :interval, 3, :future, starts_at: 3.days.from_now }
7
+ describe '#past_intervals' do
8
+ it 'returns past intervals only' do
9
+ expect(interval.past_intervals).to eq past_intervals
10
+ end
11
+ end
12
+ describe '#future_intervals' do
13
+ it 'returns future intervals only' do
14
+ expect(interval.future_intervals).to eq future_intervals
15
+ end
16
+ end
17
+ describe '#overlapping_intervals' do
18
+ it 'returns overlapping intervals only' do
19
+ expect(interval.overlapping_intervals).to eq overlapping_intervals
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ FactoryGirl.define do
2
+ factory :interval do
3
+ starts_at { Faker::Date.backward(30) }
4
+ ends_at { Faker::Date.forward(30) }
5
+
6
+ trait :future do
7
+ starts_at { Faker::Date.between(2.months.from_now, 4.months.from_now) }
8
+ ends_at { Faker::Date.between(4.months.from_now, 6.months.from_now) }
9
+ end
10
+
11
+ trait :past do
12
+ starts_at { Faker::Date.between(4.months.ago, 6.months.ago) }
13
+ ends_at { Faker::Date.between(2.months.ago, 4.months.ago) }
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
3
+ require 'rspec/rails'
4
+ require 'factory_girl_rails'
5
+ require 'faker'
6
+
7
+ RSpec.configure do |config|
8
+ config.mock_with :rspec
9
+ config.use_transactional_fixtures = true
10
+ config.infer_base_class_for_anonymous_controllers = false
11
+ config.order = "random"
12
+ config.include FactoryGirl::Syntax::Methods
13
+ end
@@ -0,0 +1,7 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryGirl::Syntax::Methods
3
+
4
+ config.before(:suite) do
5
+ FactoryGirl.lint
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_interval
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohammad AbuShady
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -25,19 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sqlite3
28
+ name: mysql2
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '0.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '1.3'
54
+ version: '3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: factory_girl_rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: faker
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1'
41
83
  description: Description of ActsAsInterval.
42
84
  email:
43
85
  - mohammad@abushady.com
@@ -45,51 +87,57 @@ executables: []
45
87
  extensions: []
46
88
  extra_rdoc_files: []
47
89
  files:
90
+ - LICENCE.md
91
+ - README.md
48
92
  - Rakefile
49
93
  - lib/acts_as_interval.rb
50
94
  - lib/acts_as_interval/acts_as_interval.rb
51
95
  - lib/acts_as_interval/version.rb
52
96
  - lib/tasks/acts_as_interval_tasks.rake
53
- - test/acts_as_interval_test.rb
54
- - test/dummy/README.rdoc
55
- - test/dummy/Rakefile
56
- - test/dummy/app/assets/javascripts/application.js
57
- - test/dummy/app/assets/stylesheets/application.css
58
- - test/dummy/app/controllers/application_controller.rb
59
- - test/dummy/app/helpers/application_helper.rb
60
- - test/dummy/app/models/interval.rb
61
- - test/dummy/app/views/layouts/application.html.erb
62
- - test/dummy/bin/bundle
63
- - test/dummy/bin/rails
64
- - test/dummy/bin/rake
65
- - test/dummy/config.ru
66
- - test/dummy/config/application.rb
67
- - test/dummy/config/boot.rb
68
- - test/dummy/config/database.yml
69
- - test/dummy/config/environment.rb
70
- - test/dummy/config/environments/development.rb
71
- - test/dummy/config/environments/production.rb
72
- - test/dummy/config/environments/test.rb
73
- - test/dummy/config/initializers/assets.rb
74
- - test/dummy/config/initializers/backtrace_silencers.rb
75
- - test/dummy/config/initializers/cookies_serializer.rb
76
- - test/dummy/config/initializers/filter_parameter_logging.rb
77
- - test/dummy/config/initializers/inflections.rb
78
- - test/dummy/config/initializers/mime_types.rb
79
- - test/dummy/config/initializers/session_store.rb
80
- - test/dummy/config/initializers/wrap_parameters.rb
81
- - test/dummy/config/locales/en.yml
82
- - test/dummy/config/routes.rb
83
- - test/dummy/config/secrets.yml
84
- - test/dummy/db/migrate/20150227133736_create_intervals.rb
85
- - test/dummy/db/schema.rb
86
- - test/dummy/public/404.html
87
- - test/dummy/public/422.html
88
- - test/dummy/public/500.html
89
- - test/dummy/public/favicon.ico
90
- - test/dummy/test/fixtures/intervals.yml
91
- - test/dummy/test/models/interval_test.rb
92
- - test/test_helper.rb
97
+ - spec/dummy/README.rdoc
98
+ - spec/dummy/Rakefile
99
+ - spec/dummy/app/assets/javascripts/application.js
100
+ - spec/dummy/app/assets/stylesheets/application.css
101
+ - spec/dummy/app/controllers/application_controller.rb
102
+ - spec/dummy/app/helpers/application_helper.rb
103
+ - spec/dummy/app/models/interval.rb
104
+ - spec/dummy/app/views/layouts/application.html.erb
105
+ - spec/dummy/bin/bundle
106
+ - spec/dummy/bin/rails
107
+ - spec/dummy/bin/rake
108
+ - spec/dummy/config.ru
109
+ - spec/dummy/config/application.rb
110
+ - spec/dummy/config/boot.rb
111
+ - spec/dummy/config/database.yml
112
+ - spec/dummy/config/environment.rb
113
+ - spec/dummy/config/environments/development.rb
114
+ - spec/dummy/config/environments/production.rb
115
+ - spec/dummy/config/environments/test.rb
116
+ - spec/dummy/config/initializers/assets.rb
117
+ - spec/dummy/config/initializers/backtrace_silencers.rb
118
+ - spec/dummy/config/initializers/cookies_serializer.rb
119
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
120
+ - spec/dummy/config/initializers/inflections.rb
121
+ - spec/dummy/config/initializers/mime_types.rb
122
+ - spec/dummy/config/initializers/session_store.rb
123
+ - spec/dummy/config/initializers/wrap_parameters.rb
124
+ - spec/dummy/config/locales/en.yml
125
+ - spec/dummy/config/routes.rb
126
+ - spec/dummy/config/secrets.yml
127
+ - spec/dummy/db/migrate/20150227133736_create_intervals.rb
128
+ - spec/dummy/db/schema.rb
129
+ - spec/dummy/log/development.log
130
+ - spec/dummy/log/test.log
131
+ - spec/dummy/public/404.html
132
+ - spec/dummy/public/422.html
133
+ - spec/dummy/public/500.html
134
+ - spec/dummy/public/favicon.ico
135
+ - spec/dummy/spec/intervals_spec.rb
136
+ - spec/dummy/test/fixtures/intervals.yml
137
+ - spec/dummy/test/models/interval_test.rb
138
+ - spec/factories/intervals.rb
139
+ - spec/spec_helper.rb
140
+ - spec/support/factory_girl.rb
93
141
  homepage: https://github.com/coalwater/acts_as_interval
94
142
  licenses:
95
143
  - MIT
@@ -100,9 +148,9 @@ require_paths:
100
148
  - lib
101
149
  required_ruby_version: !ruby/object:Gem::Requirement
102
150
  requirements:
103
- - - ">="
151
+ - - "~>"
104
152
  - !ruby/object:Gem::Version
105
- version: '0'
153
+ version: '2'
106
154
  required_rubygems_version: !ruby/object:Gem::Requirement
107
155
  requirements:
108
156
  - - ">="
@@ -115,43 +163,47 @@ signing_key:
115
163
  specification_version: 4
116
164
  summary: Summary of ActsAsInterval.
117
165
  test_files:
118
- - test/test_helper.rb
119
- - test/acts_as_interval_test.rb
120
- - test/dummy/Rakefile
121
- - test/dummy/bin/rake
122
- - test/dummy/bin/rails
123
- - test/dummy/bin/bundle
124
- - test/dummy/db/migrate/20150227133736_create_intervals.rb
125
- - test/dummy/db/schema.rb
126
- - test/dummy/config/environments/production.rb
127
- - test/dummy/config/environments/test.rb
128
- - test/dummy/config/environments/development.rb
129
- - test/dummy/config/locales/en.yml
130
- - test/dummy/config/boot.rb
131
- - test/dummy/config/routes.rb
132
- - test/dummy/config/environment.rb
133
- - test/dummy/config/database.yml
134
- - test/dummy/config/application.rb
135
- - test/dummy/config/secrets.yml
136
- - test/dummy/config/initializers/wrap_parameters.rb
137
- - test/dummy/config/initializers/session_store.rb
138
- - test/dummy/config/initializers/mime_types.rb
139
- - test/dummy/config/initializers/cookies_serializer.rb
140
- - test/dummy/config/initializers/inflections.rb
141
- - test/dummy/config/initializers/filter_parameter_logging.rb
142
- - test/dummy/config/initializers/assets.rb
143
- - test/dummy/config/initializers/backtrace_silencers.rb
144
- - test/dummy/app/views/layouts/application.html.erb
145
- - test/dummy/app/assets/javascripts/application.js
146
- - test/dummy/app/assets/stylesheets/application.css
147
- - test/dummy/app/models/interval.rb
148
- - test/dummy/app/controllers/application_controller.rb
149
- - test/dummy/app/helpers/application_helper.rb
150
- - test/dummy/public/422.html
151
- - test/dummy/public/404.html
152
- - test/dummy/public/favicon.ico
153
- - test/dummy/public/500.html
154
- - test/dummy/config.ru
155
- - test/dummy/test/fixtures/intervals.yml
156
- - test/dummy/test/models/interval_test.rb
157
- - test/dummy/README.rdoc
166
+ - spec/spec_helper.rb
167
+ - spec/support/factory_girl.rb
168
+ - spec/factories/intervals.rb
169
+ - spec/dummy/Rakefile
170
+ - spec/dummy/bin/rake
171
+ - spec/dummy/bin/rails
172
+ - spec/dummy/bin/bundle
173
+ - spec/dummy/db/migrate/20150227133736_create_intervals.rb
174
+ - spec/dummy/db/schema.rb
175
+ - spec/dummy/spec/intervals_spec.rb
176
+ - spec/dummy/config/environments/production.rb
177
+ - spec/dummy/config/environments/test.rb
178
+ - spec/dummy/config/environments/development.rb
179
+ - spec/dummy/config/locales/en.yml
180
+ - spec/dummy/config/boot.rb
181
+ - spec/dummy/config/routes.rb
182
+ - spec/dummy/config/environment.rb
183
+ - spec/dummy/config/database.yml
184
+ - spec/dummy/config/application.rb
185
+ - spec/dummy/config/secrets.yml
186
+ - spec/dummy/config/initializers/wrap_parameters.rb
187
+ - spec/dummy/config/initializers/session_store.rb
188
+ - spec/dummy/config/initializers/mime_types.rb
189
+ - spec/dummy/config/initializers/cookies_serializer.rb
190
+ - spec/dummy/config/initializers/inflections.rb
191
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
192
+ - spec/dummy/config/initializers/assets.rb
193
+ - spec/dummy/config/initializers/backtrace_silencers.rb
194
+ - spec/dummy/app/views/layouts/application.html.erb
195
+ - spec/dummy/app/assets/javascripts/application.js
196
+ - spec/dummy/app/assets/stylesheets/application.css
197
+ - spec/dummy/app/models/interval.rb
198
+ - spec/dummy/app/controllers/application_controller.rb
199
+ - spec/dummy/app/helpers/application_helper.rb
200
+ - spec/dummy/public/422.html
201
+ - spec/dummy/public/404.html
202
+ - spec/dummy/public/favicon.ico
203
+ - spec/dummy/public/500.html
204
+ - spec/dummy/config.ru
205
+ - spec/dummy/test/fixtures/intervals.yml
206
+ - spec/dummy/test/models/interval_test.rb
207
+ - spec/dummy/README.rdoc
208
+ - spec/dummy/log/test.log
209
+ - spec/dummy/log/development.log
@@ -1,32 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ActsAsIntervalTest < ActiveSupport::TestCase
4
- def test_future_interval_method
5
- interval = Interval.new
6
- assert_equal true, interval.respond_to?(:future_intervals)
7
- end
8
- def test_past_interval_method
9
- interval = Interval.new
10
- assert_equal true, interval.respond_to?(:past_intervals)
11
- end
12
- def test_overlapping_interval_method
13
- interval = Interval.new
14
- assert_equal true, interval.respond_to?(:overlapping_intervals)
15
- end
16
- def test_intervals_before
17
- old_interval = Interval.create(starts_at: 1.month.ago, ends_at: 1.week.ago)
18
- older_interval = Interval.create(starts_at: 2.year.ago, ends_at: 1.year.ago)
19
- Interval.create(starts_at: 1.month.since, ends_at: 1.year.since)
20
- Interval.create(starts_at: 1.years.ago, ends_at: 1.years.since)
21
- new_interval = Interval.create(starts_at: 1.day.ago, ends_at: 1.hour.ago)
22
- assert_equal new_interval.past_intervals, [old_interval, older_interval]
23
- end
24
- def test_intervals_after
25
- Interval.create(starts_at: 1.month.ago, ends_at: 1.week.ago)
26
- Interval.create(starts_at: 2.year.ago, ends_at: 1.year.ago)
27
- after_interval = Interval.create(starts_at: 1.month.since, ends_at: 1.year.since)
28
- Interval.create(starts_at: 1.years.ago, ends_at: 1.years.since)
29
- new_interval = Interval.create(starts_at: 1.day.ago, ends_at: 1.hour.ago)
30
- assert_equal new_interval.future_intervals, [after_interval]
31
- end
32
- end
@@ -1,15 +0,0 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
- require "rails/test_help"
6
-
7
- Rails.backtrace_cleaner.remove_silencers!
8
-
9
- # Load support files
10
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
-
12
- # Load fixtures from the engine
13
- if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
- ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
- end