acts_as_full_calendar_event 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +49 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +99 -0
- data/Rakefile +12 -0
- data/acts_as_full_calendar_event.gemspec +33 -0
- data/lib/acts_as_full_calendar_event.rb +17 -0
- data/lib/acts_as_full_calendar_event/calendar_event.rb +98 -0
- data/lib/acts_as_full_calendar_event/serializers/full_calendar_event_serializer.rb +55 -0
- data/lib/acts_as_full_calendar_event/services/calendar.rb +73 -0
- data/lib/acts_as_full_calendar_event/version.rb +3 -0
- data/spec/acts_as_full_calendar_event_spec.rb +92 -0
- data/spec/factories/category.rb +7 -0
- data/spec/factories/event.rb +7 -0
- data/spec/factories/other_category.rb +7 -0
- data/spec/factories/other_event.rb +7 -0
- data/spec/serializers/full_calendar_event_serializer_spec.rb +24 -0
- data/spec/services/calendar_spec.rb +195 -0
- data/spec/spec_helper.rb +207 -0
- data/spec/support/factory_bot.rb +9 -0
- metadata +212 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: be37c3fabda76b2a5efd690e5115de75a8943c1b5b127d62914902241490f64c
|
4
|
+
data.tar.gz: 50cd7e761a4cd2bc740ea6ce93e95b268b7b514647c21b06e813f2b50b73e760
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7141947b51ebae0238cf4b12910154677257b130daa914bd7d764b51559a211f73ad75291c00e097597a6e952891eb17b75acc5065f0d56d0173f232e824ee1a
|
7
|
+
data.tar.gz: a4228f1a3edd66795c2086773010eece50fc531510f44a8aa1d94104a4793f367d04fc137dac34392c8ba93e7af865e8815298241a374d9b137bfd29fe1fdaf1
|
data/.gitignore
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
*.rbc
|
2
|
+
capybara-*.html
|
3
|
+
.rspec
|
4
|
+
/log
|
5
|
+
/tmp
|
6
|
+
/db/*.sqlite3
|
7
|
+
/db/*.sqlite3-journal
|
8
|
+
/public/system
|
9
|
+
/coverage/
|
10
|
+
/spec/tmp
|
11
|
+
*.orig
|
12
|
+
rerun.txt
|
13
|
+
pickle-email-*.html
|
14
|
+
|
15
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
16
|
+
config/initializers/secret_token.rb
|
17
|
+
config/master.key
|
18
|
+
|
19
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
20
|
+
# config/secrets.yml
|
21
|
+
|
22
|
+
# dotenv
|
23
|
+
# TODO Comment out this rule if environment variables can be committed
|
24
|
+
.env
|
25
|
+
|
26
|
+
## Environment normalization:
|
27
|
+
/.bundle
|
28
|
+
/vendor/bundle
|
29
|
+
|
30
|
+
# these should all be checked in to normalize the environment:
|
31
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
35
|
+
|
36
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
37
|
+
/vendor/assets/bower_components
|
38
|
+
*.bowerrc
|
39
|
+
bower.json
|
40
|
+
|
41
|
+
# Ignore pow environment settings
|
42
|
+
.powenv
|
43
|
+
|
44
|
+
# Ignore Byebug command history file.
|
45
|
+
.byebug_history
|
46
|
+
|
47
|
+
# Ignore node_modules
|
48
|
+
node_modules/
|
49
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
acts_as_full_calendar_event (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
active_model_serializers (0.9.7)
|
10
|
+
activemodel (>= 3.2)
|
11
|
+
concurrent-ruby (~> 1.0)
|
12
|
+
activemodel (4.2.11.1)
|
13
|
+
activesupport (= 4.2.11.1)
|
14
|
+
builder (~> 3.1)
|
15
|
+
activerecord (4.2.11.1)
|
16
|
+
activemodel (= 4.2.11.1)
|
17
|
+
activesupport (= 4.2.11.1)
|
18
|
+
arel (~> 6.0)
|
19
|
+
activesupport (4.2.11.1)
|
20
|
+
i18n (~> 0.7)
|
21
|
+
minitest (~> 5.1)
|
22
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
23
|
+
tzinfo (~> 1.1)
|
24
|
+
appraisal (2.2.0)
|
25
|
+
bundler
|
26
|
+
rake
|
27
|
+
thor (>= 0.14.0)
|
28
|
+
arel (6.0.4)
|
29
|
+
ast (2.4.0)
|
30
|
+
builder (3.2.3)
|
31
|
+
byebug (11.0.1)
|
32
|
+
concurrent-ruby (1.1.5)
|
33
|
+
database_cleaner (1.7.0)
|
34
|
+
diff-lcs (1.3)
|
35
|
+
docile (1.1.5)
|
36
|
+
factory_bot (4.11.1)
|
37
|
+
activesupport (>= 3.0.0)
|
38
|
+
i18n (0.9.5)
|
39
|
+
concurrent-ruby (~> 1.0)
|
40
|
+
json (2.2.0)
|
41
|
+
minitest (5.11.3)
|
42
|
+
parallel (1.17.0)
|
43
|
+
parser (2.6.3.0)
|
44
|
+
ast (~> 2.4.0)
|
45
|
+
powerpack (0.1.2)
|
46
|
+
rainbow (2.2.2)
|
47
|
+
rake
|
48
|
+
rake (12.3.3)
|
49
|
+
rspec (3.8.0)
|
50
|
+
rspec-core (~> 3.8.0)
|
51
|
+
rspec-expectations (~> 3.8.0)
|
52
|
+
rspec-mocks (~> 3.8.0)
|
53
|
+
rspec-core (3.8.2)
|
54
|
+
rspec-support (~> 3.8.0)
|
55
|
+
rspec-expectations (3.8.4)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.8.0)
|
58
|
+
rspec-mocks (3.8.1)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.8.0)
|
61
|
+
rspec-support (3.8.2)
|
62
|
+
rubocop (0.49.1)
|
63
|
+
parallel (~> 1.10)
|
64
|
+
parser (>= 2.3.3.1, < 3.0)
|
65
|
+
powerpack (~> 0.1)
|
66
|
+
rainbow (>= 1.99.1, < 3.0)
|
67
|
+
ruby-progressbar (~> 1.7)
|
68
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
69
|
+
ruby-progressbar (1.10.1)
|
70
|
+
simplecov (0.15.1)
|
71
|
+
docile (~> 1.1.0)
|
72
|
+
json (>= 1.8, < 3)
|
73
|
+
simplecov-html (~> 0.10.0)
|
74
|
+
simplecov-html (0.10.2)
|
75
|
+
sqlite3 (1.3.13)
|
76
|
+
thor (0.20.3)
|
77
|
+
thread_safe (0.3.6)
|
78
|
+
tzinfo (1.2.5)
|
79
|
+
thread_safe (~> 0.1)
|
80
|
+
unicode-display_width (1.6.0)
|
81
|
+
|
82
|
+
PLATFORMS
|
83
|
+
ruby
|
84
|
+
|
85
|
+
DEPENDENCIES
|
86
|
+
active_model_serializers (~> 0.9.3)
|
87
|
+
activerecord (= 4.2.11.1)
|
88
|
+
acts_as_full_calendar_event!
|
89
|
+
appraisal (~> 2.2)
|
90
|
+
byebug
|
91
|
+
database_cleaner
|
92
|
+
factory_bot (~> 4.8)
|
93
|
+
rspec (~> 3.6)
|
94
|
+
rubocop (~> 0.49.1)
|
95
|
+
simplecov (~> 0.15.0)
|
96
|
+
sqlite3 (~> 1.3.6)
|
97
|
+
|
98
|
+
BUNDLED WITH
|
99
|
+
1.16.6
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
$:.push File.expand_path("../lib", __FILE__)
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "acts_as_full_calendar_event"
|
8
|
+
s.version = "1.0.1"
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Adrian Fernandez"]
|
11
|
+
s.email = ["adrianfernandez85@gmail.com"]
|
12
|
+
s.homepage = "http://github.com/adrian-fernandez/acts_as_full_calendar_event"
|
13
|
+
s.summary = "Rails gem to allowing records to be votable"
|
14
|
+
s.description = "Rails gem to allowing records to be votable"
|
15
|
+
s.license = "MIT"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_development_dependency "rspec", "~> 3.6"
|
23
|
+
s.add_development_dependency "activerecord", "4.2.11.1"
|
24
|
+
s.add_development_dependency "sqlite3", "~> 1.3.6"
|
25
|
+
s.add_development_dependency "rubocop", "~> 0.49.1"
|
26
|
+
s.add_development_dependency "simplecov", "~> 0.15.0"
|
27
|
+
s.add_development_dependency "appraisal", "~> 2.2"
|
28
|
+
s.add_development_dependency "byebug"
|
29
|
+
s.add_development_dependency "factory_bot", "~> 4.8"
|
30
|
+
s.add_development_dependency "database_cleaner"
|
31
|
+
s.add_development_dependency "active_model_serializers", "~> 0.9.3"
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_record"
|
4
|
+
require "active_support/inflector"
|
5
|
+
require "active_model_serializers"
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
+
|
9
|
+
module ActsAsFullCalendarEvent
|
10
|
+
if defined?(ActiveRecord::Base)
|
11
|
+
require "acts_as_full_calendar_event/calendar_event"
|
12
|
+
require "acts_as_full_calendar_event/serializers/full_calendar_event_serializer"
|
13
|
+
require "acts_as_full_calendar_event/services/calendar"
|
14
|
+
|
15
|
+
ActiveRecord::Base.extend ActsAsFullCalendarEvent::CalendarEvent
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/concern'
|
4
|
+
|
5
|
+
module ActsAsFullCalendarEvent
|
6
|
+
module CalendarEvent
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
mattr_accessor :acts_as_full_calendar_event_options
|
10
|
+
|
11
|
+
class_methods do
|
12
|
+
def calendar_items
|
13
|
+
self.public_send(acts_as_full_calendar_event_options[:method_fields])
|
14
|
+
end
|
15
|
+
|
16
|
+
def calendar_items_filter_by_category(category_id)
|
17
|
+
self.public_send(acts_as_full_calendar_event_options[:method_filter_category], category_id)
|
18
|
+
end
|
19
|
+
|
20
|
+
def calendar_items_filter_by_user(user_id)
|
21
|
+
self.public_send(acts_as_full_calendar_event_options[:method_filter_user], user_id)
|
22
|
+
end
|
23
|
+
|
24
|
+
def calendar_items_filter_by_date(start_date, end_date)
|
25
|
+
self.public_send(acts_as_full_calendar_event_options[:method_filter_date], start_date, end_date)
|
26
|
+
end
|
27
|
+
|
28
|
+
def calendar_items_categories
|
29
|
+
return [] unless self.respond_to?(acts_as_full_calendar_event_options[:method_categories])
|
30
|
+
self.public_send(acts_as_full_calendar_event_options[:method_categories])
|
31
|
+
end
|
32
|
+
|
33
|
+
def calendar_category_class
|
34
|
+
self.public_send(acts_as_full_calendar_event_options[:field_category_class])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def acts_as_full_calendar_event(args = {})
|
39
|
+
calendar_class_args = %i[
|
40
|
+
method_fields
|
41
|
+
method_filter_category
|
42
|
+
method_filter_user
|
43
|
+
method_filter_date
|
44
|
+
method_categories
|
45
|
+
field_category_class
|
46
|
+
].freeze
|
47
|
+
|
48
|
+
define_method :acts_as_full_calendar_event_options do
|
49
|
+
self.class.instance_variable_get("@acts_as_full_calendar_event_options")
|
50
|
+
end
|
51
|
+
|
52
|
+
class_eval do
|
53
|
+
@acts_as_full_calendar_event_options = { }.merge(args)
|
54
|
+
|
55
|
+
def self.calendar_event?
|
56
|
+
true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class_args = args.select { |key, value| calendar_class_args.include?(key) }
|
61
|
+
self.acts_as_full_calendar_event_options = { }.merge(class_args)
|
62
|
+
end
|
63
|
+
|
64
|
+
def calendar_item_start_at
|
65
|
+
self.public_send(acts_as_full_calendar_event_options[:field_start])
|
66
|
+
end
|
67
|
+
|
68
|
+
def calendar_item_end_at
|
69
|
+
self.public_send(acts_as_full_calendar_event_options[:field_end])
|
70
|
+
end
|
71
|
+
|
72
|
+
def calendar_item_title
|
73
|
+
self.public_send(acts_as_full_calendar_event_options[:field_title])
|
74
|
+
end
|
75
|
+
|
76
|
+
def calendar_item_color
|
77
|
+
self.public_send(acts_as_full_calendar_event_options[:field_color])
|
78
|
+
end
|
79
|
+
|
80
|
+
def calendar_item_text_color
|
81
|
+
self.public_send(acts_as_full_calendar_event_options[:field_text_color])
|
82
|
+
end
|
83
|
+
|
84
|
+
def calendar_item_url
|
85
|
+
self.public_send(acts_as_full_calendar_event_options[:field_url])
|
86
|
+
end
|
87
|
+
|
88
|
+
def calendar_item_link_data_toggle
|
89
|
+
self.public_send(acts_as_full_calendar_event_options[:field_link_data_toggle])
|
90
|
+
end
|
91
|
+
|
92
|
+
def calendar_item_link_data_target
|
93
|
+
self.public_send(acts_as_full_calendar_event_options[:field_link_data_target])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
ActiveRecord::Base.send(:include, ActsAsFullCalendarEvent::CalendarEvent)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module ActsAsFullCalendarEvent
|
2
|
+
class FullCalendarEventSerializer < ActiveModel::Serializer
|
3
|
+
attributes(
|
4
|
+
:id,
|
5
|
+
:start,
|
6
|
+
:end,
|
7
|
+
:title,
|
8
|
+
:color,
|
9
|
+
:textColor,
|
10
|
+
:link_url,
|
11
|
+
:link_data_toggle,
|
12
|
+
:link_data_target
|
13
|
+
)
|
14
|
+
|
15
|
+
def start
|
16
|
+
object.calendar_item_start_at
|
17
|
+
end
|
18
|
+
|
19
|
+
def end
|
20
|
+
object.calendar_item_end_at
|
21
|
+
end
|
22
|
+
|
23
|
+
def title
|
24
|
+
object.calendar_item_title
|
25
|
+
end
|
26
|
+
|
27
|
+
def color
|
28
|
+
if object.calendar_item_color.present?
|
29
|
+
object.calendar_item_color
|
30
|
+
else
|
31
|
+
""
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def textColor
|
36
|
+
if object.calendar_item_text_color.present?
|
37
|
+
object.calendar_item_text_color
|
38
|
+
else
|
39
|
+
""
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def link_url
|
44
|
+
object.calendar_item_url
|
45
|
+
end
|
46
|
+
|
47
|
+
def link_data_target
|
48
|
+
object.calendar_item_link_data_target
|
49
|
+
end
|
50
|
+
|
51
|
+
def link_data_toggle
|
52
|
+
object.calendar_item_link_data_toggle
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module ActsAsFullCalendarEvent
|
2
|
+
class Calendar
|
3
|
+
attr_reader :user_id, :categories, :items, :start_date, :end_date
|
4
|
+
private :user_id, :categories, :start_date, :end_date
|
5
|
+
|
6
|
+
def initialize(params:)
|
7
|
+
raise(ArgumentError, "params must include 'start' having a date value") if params[:start].blank? || params[:start].class != Date
|
8
|
+
raise(ArgumentError, "params must include 'end' having a date value") if params[:end].blank? || params[:end].class != Date
|
9
|
+
|
10
|
+
@user_id = params[:user_id] if params.has_key?(:user_id)
|
11
|
+
@categories = JSON.parse(params[:categories] || '{}')
|
12
|
+
@start_date = params[:start]
|
13
|
+
@end_date = params[:end]
|
14
|
+
end
|
15
|
+
|
16
|
+
def filter
|
17
|
+
@items = []
|
18
|
+
|
19
|
+
item_classes.each do |item_class|
|
20
|
+
items = item_class.calendar_items
|
21
|
+
items = filter_by_category(items, item_class) if has_categories_filter?
|
22
|
+
items = filter_by_date(items)
|
23
|
+
items = filter_by_user(items) if has_user_filter?
|
24
|
+
|
25
|
+
@items << items
|
26
|
+
end
|
27
|
+
|
28
|
+
items.flatten
|
29
|
+
end
|
30
|
+
|
31
|
+
def available_categories
|
32
|
+
categories = []
|
33
|
+
|
34
|
+
item_classes.each do |item_class|
|
35
|
+
categories << item_class.calendar_items_categories
|
36
|
+
end
|
37
|
+
|
38
|
+
categories.flatten
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def filter_by_date(items)
|
44
|
+
items.public_send(:calendar_items_filter_by_date, start_date, end_date)
|
45
|
+
end
|
46
|
+
|
47
|
+
def filter_by_category(items, item_class)
|
48
|
+
if categories.has_key?(item_class.calendar_category_class.to_s)
|
49
|
+
items.public_send(:calendar_items_filter_by_category, categories[item_class.calendar_category_class.to_s].split(",").flatten)
|
50
|
+
else
|
51
|
+
items
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def filter_by_user(items)
|
56
|
+
items.public_send(:calendar_items_filter_by_user, user_id)
|
57
|
+
end
|
58
|
+
|
59
|
+
def item_classes
|
60
|
+
ActiveRecord::Base.descendants.select do |c|
|
61
|
+
c.respond_to?(:calendar_event?) && c.calendar_event?
|
62
|
+
end.map(&:name).map(&:constantize)
|
63
|
+
end
|
64
|
+
|
65
|
+
def has_user_filter?
|
66
|
+
user_id.present?
|
67
|
+
end
|
68
|
+
|
69
|
+
def has_categories_filter?
|
70
|
+
categories.present? && categories != {}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "byebug"
|
3
|
+
|
4
|
+
describe ActsAsFullCalendarEvent do
|
5
|
+
it "adds methods" do
|
6
|
+
expect(Event.respond_to?(:calendar_items)).to eq(true)
|
7
|
+
expect(Event.respond_to?(:calendar_items_filter_by_category)).to eq(true)
|
8
|
+
expect(Event.respond_to?(:calendar_items_filter_by_user)).to eq(true)
|
9
|
+
expect(Event.respond_to?(:calendar_items_filter_by_date)).to eq(true)
|
10
|
+
expect(Event.respond_to?(:calendar_items_categories)).to eq(true)
|
11
|
+
expect(Event.respond_to?(:calendar_category_class)).to eq(true)
|
12
|
+
expect(Event.new.respond_to?(:calendar_item_start_at)).to eq(true)
|
13
|
+
expect(Event.new.respond_to?(:calendar_item_end_at)).to eq(true)
|
14
|
+
expect(Event.new.respond_to?(:calendar_item_title)).to eq(true)
|
15
|
+
expect(Event.new.respond_to?(:calendar_item_text_color)).to eq(true)
|
16
|
+
expect(Event.new.respond_to?(:calendar_item_color)).to eq(true)
|
17
|
+
expect(Event.new.respond_to?(:calendar_item_url)).to eq(true)
|
18
|
+
expect(Event.new.respond_to?(:calendar_item_link_data_toggle)).to eq(true)
|
19
|
+
expect(Event.new.respond_to?(:calendar_item_link_data_target)).to eq(true)
|
20
|
+
end
|
21
|
+
|
22
|
+
context "methods return value" do
|
23
|
+
let!(:event1) { create(:event, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), category_id: 1, user_id: 1) }
|
24
|
+
let!(:event2) { create(:event, start_at: Date.new(2018, 1, 15), end_at: Date.new(2018, 1, 31), category_id: 1, user_id: 2) }
|
25
|
+
let!(:event3) { create(:event, start_at: Date.new(2018, 2, 1), end_at: Date.new(2018, 2, 2), category_id: 1, user_id: 2) }
|
26
|
+
let!(:event4) { create(:event, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), category_id: 2, user_id: 2) }
|
27
|
+
|
28
|
+
let!(:category) { create(:category, id: 1, name: "Category 1") }
|
29
|
+
let!(:category2) { create(:category, id: 2, name: "Category 2") }
|
30
|
+
let!(:category3) { create(:category, id: 3, name: "Category 3") }
|
31
|
+
|
32
|
+
it "#calendar_items" do
|
33
|
+
expect(Event.calendar_items).to eq([event1, event2, event3, event4])
|
34
|
+
end
|
35
|
+
|
36
|
+
it "#calendar_items_filter_by_category" do
|
37
|
+
expect(Event.calendar_items_filter_by_category(1)).to eq([event1, event2, event3])
|
38
|
+
expect(Event.calendar_items_filter_by_category(2)).to eq([event4])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "#calendar_items_filter_by_user" do
|
42
|
+
expect(Event.calendar_items_filter_by_user(1)).to eq([event1])
|
43
|
+
expect(Event.calendar_items_filter_by_user(2)).to eq([event2, event3, event4])
|
44
|
+
end
|
45
|
+
|
46
|
+
it "#calendar_items_filter_by_date" do
|
47
|
+
expect(Event.calendar_items_filter_by_date(Date.new(2018, 1, 1), Date.new(2018, 1, 31))).to eq([event1, event2, event4])
|
48
|
+
expect(Event.calendar_items_filter_by_date(Date.new(2018, 1, 1), Date.new(2018, 2, 10))).to eq([event1, event2, event3, event4])
|
49
|
+
expect(Event.calendar_items_filter_by_date(Date.new(2018, 1, 10), Date.new(2018, 2, 10))).to eq([event2, event3])
|
50
|
+
end
|
51
|
+
|
52
|
+
it "#calendar_items_categories" do
|
53
|
+
expect(Event.calendar_items_categories.map(&:name)).to eq(["Category 1", "Category 2", "Category 3"])
|
54
|
+
end
|
55
|
+
|
56
|
+
it "#calendar_category_class" do
|
57
|
+
expect(Event.calendar_category_class).to eq(Category)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "#calendar_item_start_at" do
|
61
|
+
expect(event1.calendar_item_start_at).to eq(Date.new(2018, 1, 1))
|
62
|
+
end
|
63
|
+
|
64
|
+
it "#calendar_item_end_at" do
|
65
|
+
expect(event1.calendar_item_end_at).to eq(Date.new(2018, 1, 31))
|
66
|
+
end
|
67
|
+
|
68
|
+
it "#calendar_item_title" do
|
69
|
+
expect(event1.calendar_item_title).to eq("title")
|
70
|
+
end
|
71
|
+
|
72
|
+
it "#calendar_item_color" do
|
73
|
+
expect(event1.calendar_item_color).to eq("#FF0000")
|
74
|
+
end
|
75
|
+
|
76
|
+
it "#calendar_item_text_color" do
|
77
|
+
expect(event1.calendar_item_text_color).to eq("#AAFFBB")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "#calendar_item_url" do
|
81
|
+
expect(event1.calendar_item_url).to eq("URL")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "#calendar_item_link_data_toggle" do
|
85
|
+
expect(event1.calendar_item_link_data_toggle).to eq("modal")
|
86
|
+
end
|
87
|
+
|
88
|
+
it "#calendar_item_link_data_target" do
|
89
|
+
expect(event1.calendar_item_link_data_target).to eq("#modal")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "byebug"
|
3
|
+
|
4
|
+
describe ActsAsFullCalendarEvent::FullCalendarEventSerializer do
|
5
|
+
let!(:event1) { create(:event, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), category_id: 1, user_id: 1) }
|
6
|
+
|
7
|
+
it "returns correct json" do
|
8
|
+
serializer = ActsAsFullCalendarEvent::FullCalendarEventSerializer.new(event1)
|
9
|
+
|
10
|
+
result = serializer.serializable_hash
|
11
|
+
|
12
|
+
expect(result).to eq({
|
13
|
+
id: 1,
|
14
|
+
start: Date.new(2018, 1, 1),
|
15
|
+
end: Date.new(2018, 1, 31),
|
16
|
+
title: "title",
|
17
|
+
color: "#FF0000",
|
18
|
+
textColor: "#AAFFBB",
|
19
|
+
link_url: "URL",
|
20
|
+
link_data_target: "#modal",
|
21
|
+
link_data_toggle: "modal"
|
22
|
+
})
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "byebug"
|
3
|
+
|
4
|
+
describe ActsAsFullCalendarEvent::Calendar do
|
5
|
+
describe "validates required attrs" do
|
6
|
+
it "works with all params" do
|
7
|
+
expect { ActsAsFullCalendarEvent::Calendar.new(
|
8
|
+
params: {
|
9
|
+
user_id: 1,
|
10
|
+
start: Date.new(2018, 1, 1),
|
11
|
+
end: Date.new(2018, 1, 31),
|
12
|
+
categories: { "1": 1 }
|
13
|
+
}
|
14
|
+
)}.not_to raise_error(ArgumentError)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requires start" do
|
18
|
+
expect { ActsAsFullCalendarEvent::Calendar.new(
|
19
|
+
params: {
|
20
|
+
user_id: 1,
|
21
|
+
end: Date.new(2018, 1, 31),
|
22
|
+
categories: { "1": 1 }
|
23
|
+
}
|
24
|
+
)}.to raise_error(ArgumentError)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "requires end" do
|
28
|
+
expect { ActsAsFullCalendarEvent::Calendar.new(
|
29
|
+
params: {
|
30
|
+
user_id: 1,
|
31
|
+
start: Date.new(2018, 1, 1),
|
32
|
+
categories: { "1": 1 }
|
33
|
+
}
|
34
|
+
)}.to raise_error(ArgumentError)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "doesn't require user_id" do
|
38
|
+
expect { ActsAsFullCalendarEvent::Calendar.new(
|
39
|
+
params: {
|
40
|
+
start: Date.new(2018, 1, 1),
|
41
|
+
end: Date.new(2018, 1, 31),
|
42
|
+
categories: { "1": 1 }
|
43
|
+
}
|
44
|
+
)}.not_to raise_error(ArgumentError)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "doesn't require categories" do
|
48
|
+
expect { ActsAsFullCalendarEvent::Calendar.new(
|
49
|
+
params: {
|
50
|
+
user_id: 1,
|
51
|
+
start: Date.new(2018, 1, 11),
|
52
|
+
end: Date.new(2018, 1, 31)
|
53
|
+
}
|
54
|
+
)}.not_to raise_error(ArgumentError)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe ".item_classes" do
|
59
|
+
it "returns all classes having ActsAsFullCalendarEvent" do
|
60
|
+
calendar = ActsAsFullCalendarEvent::Calendar.new(
|
61
|
+
params: {
|
62
|
+
user_id: 1,
|
63
|
+
start: Date.new(2018, 1, 1),
|
64
|
+
end: Date.new(2018, 1, 31)
|
65
|
+
}
|
66
|
+
)
|
67
|
+
|
68
|
+
klasses = calendar.send(:item_classes).map(&:to_s)
|
69
|
+
expect(klasses.count).to eq(2)
|
70
|
+
expect(klasses.include?("Event")).to be_truthy
|
71
|
+
expect(klasses.include?("OtherEvent")).to be_truthy
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe ".available_categories" do
|
76
|
+
let!(:category) { create(:category, id: 1, name: "Category 1") }
|
77
|
+
let!(:category2) { create(:category, id: 2, name: "Category 2") }
|
78
|
+
let!(:category3) { create(:category, id: 3, name: "Category 3") }
|
79
|
+
|
80
|
+
it "returns all categories" do
|
81
|
+
calendar = ActsAsFullCalendarEvent::Calendar.new(
|
82
|
+
params: {
|
83
|
+
user_id: 1,
|
84
|
+
start: Date.new(2018, 1, 1),
|
85
|
+
end: Date.new(2018, 1, 31)
|
86
|
+
}
|
87
|
+
)
|
88
|
+
|
89
|
+
categories = calendar.available_categories
|
90
|
+
expect(categories).to eq([category, category2, category3])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe ".filter" do
|
95
|
+
let!(:event1_user1_cat1) { create(:event, id: 1, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), category_id: category.id, user_id: 1) }
|
96
|
+
let!(:event2_user1_cat2) { create(:event, id: 2, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), category_id: category2.id, user_id: 1) }
|
97
|
+
let!(:event3_user1_cat2) { create(:event, id: 3, start_at: Date.new(2018, 2, 1), end_at: Date.new(2018, 2, 20), category_id: category2.id, user_id: 1) }
|
98
|
+
let!(:event4_user2_cat1) { create(:event, id: 4, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), category_id: category.id, user_id: 2) }
|
99
|
+
let!(:event5_user2_cat2) { create(:event, id: 5, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), category_id: category2.id, user_id: 2) }
|
100
|
+
let!(:event6_user2_cat2) { create(:event, id: 6, start_at: Date.new(2018, 2, 1), end_at: Date.new(2018, 2, 20), category_id: category2.id, user_id: 2) }
|
101
|
+
|
102
|
+
let!(:other_event1_user1_cat1) { create(:other_event, id: 11, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), other_category_id: other_category.id, user_id: 1) }
|
103
|
+
let!(:other_event2_user1_cat2) { create(:other_event, id: 12, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), other_category_id: other_category2.id, user_id: 1) }
|
104
|
+
let!(:other_event3_user1_cat2) { create(:other_event, id: 13, start_at: Date.new(2018, 2, 1), end_at: Date.new(2018, 2, 20), other_category_id: other_category2.id, user_id: 1) }
|
105
|
+
let!(:other_event4_user2_cat1) { create(:other_event, id: 14, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), other_category_id: other_category.id, user_id: 2) }
|
106
|
+
let!(:other_event5_user2_cat2) { create(:other_event, id: 15, start_at: Date.new(2018, 1, 1), end_at: Date.new(2018, 1, 31), other_category_id: other_category2.id, user_id: 2) }
|
107
|
+
let!(:other_event6_user2_cat2) { create(:other_event, id: 16, start_at: Date.new(2018, 2, 1), end_at: Date.new(2018, 2, 20), other_category_id: other_category2.id, user_id: 2) }
|
108
|
+
|
109
|
+
let!(:category) { create(:category, id: 1, name: "Category 1") }
|
110
|
+
let!(:category2) { create(:category, id: 2, name: "Category 2") }
|
111
|
+
let!(:category3) { create(:category, id: 3, name: "Category 3") }
|
112
|
+
let!(:other_category) { create(:other_category, id: 1, name: "Other Category 1") }
|
113
|
+
let!(:other_category2) { create(:other_category, id: 2, name: "Other Category 2") }
|
114
|
+
let!(:other_category3) { create(:other_category, id: 3, name: "Other Category 3") }
|
115
|
+
let(:calendar) do
|
116
|
+
ActsAsFullCalendarEvent::Calendar.new(
|
117
|
+
params: {
|
118
|
+
user_id: user_id,
|
119
|
+
start: start_date,
|
120
|
+
end: end_date,
|
121
|
+
categories: categories
|
122
|
+
}
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
context "with all filters" do
|
127
|
+
let(:user_id) { 1 }
|
128
|
+
let(:categories) { { "Category": [1], "OtherCategory": [2] }.to_json }
|
129
|
+
|
130
|
+
context "with dates before all events" do
|
131
|
+
let(:start_date) { Date.new(2017, 12, 1) }
|
132
|
+
let(:end_date) { Date.new(2018, 1, 1) }
|
133
|
+
|
134
|
+
it "doesn't return anything" do
|
135
|
+
expect(calendar.filter).to eq([])
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "with events in dates" do
|
140
|
+
let(:start_date) { Date.new(2018, 1, 1) }
|
141
|
+
let(:end_date) { Date.new(2018, 1, 31) }
|
142
|
+
|
143
|
+
it "returns events" do
|
144
|
+
expect(Event.all.count).to eq(6)
|
145
|
+
expect(OtherEvent.all.count).to eq(6)
|
146
|
+
expect(calendar.filter).to eq([
|
147
|
+
event1_user1_cat1,
|
148
|
+
other_event2_user1_cat2
|
149
|
+
])
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context "with dates after all events" do
|
154
|
+
let(:start_date) { Date.new(2018, 1, 31) }
|
155
|
+
let(:end_date) { Date.new(2018, 2, 10) }
|
156
|
+
|
157
|
+
it "doesn't return anything" do
|
158
|
+
expect(calendar.filter).to eq([])
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
context "without user_id" do
|
164
|
+
let(:start_date) { Date.new(2018, 1, 1) }
|
165
|
+
let(:end_date) { Date.new(2018, 1, 31) }
|
166
|
+
let(:user_id) { nil }
|
167
|
+
let(:categories) { { "Category": [1], "OtherCategory": [2] }.to_json }
|
168
|
+
|
169
|
+
it "returns events for all users" do
|
170
|
+
expect(calendar.filter).to eq([
|
171
|
+
event1_user1_cat1,
|
172
|
+
event4_user2_cat1,
|
173
|
+
other_event2_user1_cat2,
|
174
|
+
other_event5_user2_cat2
|
175
|
+
])
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context "without categories" do
|
180
|
+
let(:start_date) { Date.new(2018, 1, 1) }
|
181
|
+
let(:end_date) { Date.new(2018, 1, 31) }
|
182
|
+
let(:user_id) { 1 }
|
183
|
+
let(:categories) { nil }
|
184
|
+
|
185
|
+
it "returns events for all categories" do
|
186
|
+
expect(calendar.filter).to eq([
|
187
|
+
event1_user1_cat1,
|
188
|
+
event2_user1_cat2,
|
189
|
+
other_event1_user1_cat1,
|
190
|
+
other_event2_user1_cat2
|
191
|
+
])
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
|
4
|
+
require "sqlite3"
|
5
|
+
require "acts_as_full_calendar_event"
|
6
|
+
require "factory_bot"
|
7
|
+
require 'database_cleaner'
|
8
|
+
require "active_model_serializers"
|
9
|
+
|
10
|
+
# Dir["./spec/shared_example/**/*.rb"].sort.each { |f| require f }
|
11
|
+
Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
|
12
|
+
Dir["./spec/serializers/**/*.rb"].sort.each { |f| require f }
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.before(:suite) do
|
16
|
+
DatabaseCleaner.strategy = :transaction
|
17
|
+
DatabaseCleaner.clean_with(:truncation)
|
18
|
+
end
|
19
|
+
|
20
|
+
config.around(:each) do |example|
|
21
|
+
DatabaseCleaner.cleaning do
|
22
|
+
example.run
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
|
28
|
+
|
29
|
+
ActiveRecord::Schema.define(version: 1) do
|
30
|
+
create_table :categories do |t|
|
31
|
+
t.string :name
|
32
|
+
end
|
33
|
+
|
34
|
+
create_table :other_categories do |t|
|
35
|
+
t.string :name
|
36
|
+
end
|
37
|
+
|
38
|
+
create_table :events do |t|
|
39
|
+
t.date :start_at
|
40
|
+
t.date :end_at
|
41
|
+
t.integer :user_id
|
42
|
+
t.integer :category_id
|
43
|
+
end
|
44
|
+
|
45
|
+
create_table :other_events do |t|
|
46
|
+
t.date :start_at
|
47
|
+
t.date :end_at
|
48
|
+
t.integer :user_id
|
49
|
+
t.integer :other_category_id
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class Event < ActiveRecord::Base
|
54
|
+
belongs_to :category
|
55
|
+
|
56
|
+
acts_as_full_calendar_event field_start: :calendar_inicio,
|
57
|
+
field_end: :calendar_fin,
|
58
|
+
field_title: :calendar_title,
|
59
|
+
field_color: :calendar_color,
|
60
|
+
field_text_color: :calendar_text_color,
|
61
|
+
field_url: :url_for_calendar,
|
62
|
+
field_link_data_toggle: :calendar_link_data_toggle,
|
63
|
+
field_link_data_target: :calendar_link_data_target,
|
64
|
+
method_fields: :for_calendario,
|
65
|
+
method_filter_category: :within_calendar_category,
|
66
|
+
method_filter_user: :by_user_id,
|
67
|
+
method_filter_date: :filter_by_date,
|
68
|
+
method_categories: :categories,
|
69
|
+
field_category_class: :category_class
|
70
|
+
|
71
|
+
def self.category_class
|
72
|
+
Category
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.categories
|
76
|
+
Category.all
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.for_calendario
|
80
|
+
all
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.within_calendar_category(category_id)
|
84
|
+
where(category_id: category_id)
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.by_user_id(user_id)
|
88
|
+
where(user_id: user_id)
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.filter_by_date(start_at, end_at)
|
92
|
+
where("start_at >= ? AND end_at <= ?", start_at, end_at)
|
93
|
+
end
|
94
|
+
|
95
|
+
def calendar_inicio
|
96
|
+
start_at
|
97
|
+
end
|
98
|
+
|
99
|
+
def calendar_fin
|
100
|
+
end_at
|
101
|
+
end
|
102
|
+
|
103
|
+
def calendar_title
|
104
|
+
"title"
|
105
|
+
end
|
106
|
+
|
107
|
+
def calendar_color
|
108
|
+
"#FF0000"
|
109
|
+
end
|
110
|
+
|
111
|
+
def calendar_text_color
|
112
|
+
"#AAFFBB"
|
113
|
+
end
|
114
|
+
|
115
|
+
def url_for_calendar
|
116
|
+
"URL"
|
117
|
+
end
|
118
|
+
|
119
|
+
def calendar_link_data_toggle
|
120
|
+
"modal"
|
121
|
+
end
|
122
|
+
|
123
|
+
def calendar_link_data_target
|
124
|
+
"#modal"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
class OtherEvent < ActiveRecord::Base
|
129
|
+
belongs_to :other_category
|
130
|
+
|
131
|
+
acts_as_full_calendar_event field_start: :calendar_inicio,
|
132
|
+
field_end: :calendar_fin,
|
133
|
+
field_title: :calendar_title,
|
134
|
+
field_color: :calendar_color,
|
135
|
+
field_text_color: :calendar_text_color,
|
136
|
+
field_url: :url_for_calendar,
|
137
|
+
field_link_data_toggle: :calendar_link_data_toggle,
|
138
|
+
field_link_data_target: :calendar_link_data_target,
|
139
|
+
method_fields: :for_calendario,
|
140
|
+
method_filter_category: :within_calendar_category,
|
141
|
+
method_filter_user: :by_user_id,
|
142
|
+
method_filter_date: :filter_by_date,
|
143
|
+
method_categories: :categories,
|
144
|
+
field_category_class: :category_class
|
145
|
+
|
146
|
+
def self.for_calendario
|
147
|
+
all
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.by_user_id(user_id)
|
151
|
+
where(user_id: user_id)
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.filter_by_date(start_at, end_at)
|
155
|
+
where("start_at >= ? AND end_at <= ?", start_at, end_at)
|
156
|
+
end
|
157
|
+
|
158
|
+
def calendar_inicio
|
159
|
+
start_at
|
160
|
+
end
|
161
|
+
|
162
|
+
def calendar_fin
|
163
|
+
end_at
|
164
|
+
end
|
165
|
+
|
166
|
+
def calendar_title
|
167
|
+
"title"
|
168
|
+
end
|
169
|
+
|
170
|
+
def calendar_color
|
171
|
+
"#FF0000"
|
172
|
+
end
|
173
|
+
|
174
|
+
def calendar_text_color
|
175
|
+
"#AAFFBB"
|
176
|
+
end
|
177
|
+
|
178
|
+
def url_for_calendar
|
179
|
+
"URL"
|
180
|
+
end
|
181
|
+
|
182
|
+
def calendar_link_data_toggle
|
183
|
+
"modal"
|
184
|
+
end
|
185
|
+
|
186
|
+
def calendar_link_data_target
|
187
|
+
"#modal"
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.category_class
|
191
|
+
OtherCategory
|
192
|
+
end
|
193
|
+
|
194
|
+
def self.categories
|
195
|
+
OtherCategory.all
|
196
|
+
end
|
197
|
+
|
198
|
+
def self.within_calendar_category(category_id)
|
199
|
+
where(other_category_id: category_id)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
class Category < ActiveRecord::Base
|
204
|
+
end
|
205
|
+
|
206
|
+
class OtherCategory < ActiveRecord::Base
|
207
|
+
end
|
metadata
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acts_as_full_calendar_event
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adrian Fernandez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activerecord
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.2.11.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.2.11.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sqlite3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.6
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.6
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.49.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.49.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.15.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.15.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: appraisal
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: factory_bot
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.8'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.8'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: database_cleaner
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: active_model_serializers
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.9.3
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.9.3
|
153
|
+
description: Rails gem to allowing records to be votable
|
154
|
+
email:
|
155
|
+
- adrianfernandez85@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- Gemfile
|
162
|
+
- Gemfile.lock
|
163
|
+
- Rakefile
|
164
|
+
- acts_as_full_calendar_event.gemspec
|
165
|
+
- lib/acts_as_full_calendar_event.rb
|
166
|
+
- lib/acts_as_full_calendar_event/calendar_event.rb
|
167
|
+
- lib/acts_as_full_calendar_event/serializers/full_calendar_event_serializer.rb
|
168
|
+
- lib/acts_as_full_calendar_event/services/calendar.rb
|
169
|
+
- lib/acts_as_full_calendar_event/version.rb
|
170
|
+
- spec/acts_as_full_calendar_event_spec.rb
|
171
|
+
- spec/factories/category.rb
|
172
|
+
- spec/factories/event.rb
|
173
|
+
- spec/factories/other_category.rb
|
174
|
+
- spec/factories/other_event.rb
|
175
|
+
- spec/serializers/full_calendar_event_serializer_spec.rb
|
176
|
+
- spec/services/calendar_spec.rb
|
177
|
+
- spec/spec_helper.rb
|
178
|
+
- spec/support/factory_bot.rb
|
179
|
+
homepage: http://github.com/adrian-fernandez/acts_as_full_calendar_event
|
180
|
+
licenses:
|
181
|
+
- MIT
|
182
|
+
metadata: {}
|
183
|
+
post_install_message:
|
184
|
+
rdoc_options: []
|
185
|
+
require_paths:
|
186
|
+
- lib
|
187
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
requirements: []
|
198
|
+
rubyforge_project:
|
199
|
+
rubygems_version: 2.7.8
|
200
|
+
signing_key:
|
201
|
+
specification_version: 4
|
202
|
+
summary: Rails gem to allowing records to be votable
|
203
|
+
test_files:
|
204
|
+
- spec/acts_as_full_calendar_event_spec.rb
|
205
|
+
- spec/factories/category.rb
|
206
|
+
- spec/factories/event.rb
|
207
|
+
- spec/factories/other_category.rb
|
208
|
+
- spec/factories/other_event.rb
|
209
|
+
- spec/serializers/full_calendar_event_serializer_spec.rb
|
210
|
+
- spec/services/calendar_spec.rb
|
211
|
+
- spec/spec_helper.rb
|
212
|
+
- spec/support/factory_bot.rb
|