simple_calendar 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/simple_calendar.rb +0 -1
- data/lib/simple_calendar/calendar.rb +1 -1
- data/lib/simple_calendar/version.rb +1 -1
- data/spec/calendar_spec.rb +7 -6
- data/spec/simple_calendar_spec.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b1e55a8908e0a4b08914cb7ab29d65e7ffb663d
|
4
|
+
data.tar.gz: f51b57f8c4f5793ef0ba8b239b75564b487c4e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fa2ea181e2ab663772657fdf02801082e9a08682c6659c10af791d4f9d2a1f0acc4caff00e1ce157cc13ad2956b456552867452bd71d21dcde65162802c5bd9
|
7
|
+
data.tar.gz: fd5e76a474b59eba0bb377f48fd8304fb8f8714177ff312b98bb404ae76460cf5e219eea12a0b8759db932c191967cc3be3e860d752cc1fe286652e909730ce0
|
data/README.md
CHANGED
@@ -89,7 +89,7 @@ pass it in as the `attribute` option**
|
|
89
89
|
|
90
90
|
```erb
|
91
91
|
<%= month_calendar(attribute: :starts_at) do |date| %>
|
92
|
-
<%=
|
92
|
+
<%= date %>
|
93
93
|
<% end %>
|
94
94
|
```
|
95
95
|
**If you already have a model with a start time attribute called something other than `start_time` or accesses it through a relationship, you can alias the attribute by defining a `start_time` method in the my_model.rb file and not have to specify it separately as in the above example**
|
data/lib/simple_calendar.rb
CHANGED
@@ -10,7 +10,7 @@ module SimpleCalendar
|
|
10
10
|
@view_context = view_context
|
11
11
|
@options = opts
|
12
12
|
|
13
|
-
@params = @view_context.params
|
13
|
+
@params = @view_context.respond_to?(:params) ? @view_context.params : Hash.new
|
14
14
|
@params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
|
15
15
|
@params = @params.with_indifferent_access.except(*PARAM_KEY_BLACKLIST)
|
16
16
|
end
|
data/spec/calendar_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'action_controller'
|
2
3
|
require 'simple_calendar/calendar'
|
3
4
|
|
4
5
|
class ViewContext
|
@@ -10,15 +11,15 @@ class ViewContext
|
|
10
11
|
|
11
12
|
def params
|
12
13
|
if @start_date.present?
|
13
|
-
{start_date: @start_date}
|
14
|
+
ActionController::Parameters.new({start_date: @start_date})
|
14
15
|
else
|
15
|
-
|
16
|
+
ActionController::Parameters.new
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
21
|
describe SimpleCalendar::Calendar do
|
21
|
-
let(:calendar) { SimpleCalendar::Calendar.new(
|
22
|
+
let(:calendar) { SimpleCalendar::Calendar.new(ViewContext.new) }
|
22
23
|
|
23
24
|
it 'renders a partial with the same name as the class' do
|
24
25
|
expect(calendar.send(:partial_name)).to eq("simple_calendar/calendar")
|
@@ -30,7 +31,7 @@ describe SimpleCalendar::Calendar do
|
|
30
31
|
end
|
31
32
|
|
32
33
|
it 'allows you to override the default attribute' do
|
33
|
-
expect(SimpleCalendar::Calendar.new(
|
34
|
+
expect(SimpleCalendar::Calendar.new(ViewContext.new, attribute: :starts_at).send(:attribute)).to eq(:starts_at)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -43,7 +44,7 @@ describe SimpleCalendar::Calendar do
|
|
43
44
|
event3 = double(start_time: tomorrow.at_noon)
|
44
45
|
|
45
46
|
events = [event1, event2, event3].shuffle
|
46
|
-
calendar = SimpleCalendar::Calendar.new(
|
47
|
+
calendar = SimpleCalendar::Calendar.new(ViewContext.new, events: events)
|
47
48
|
|
48
49
|
sorted_events = calendar.send(:sorted_events)
|
49
50
|
|
@@ -53,7 +54,7 @@ describe SimpleCalendar::Calendar do
|
|
53
54
|
|
54
55
|
it 'handles events without a start time' do
|
55
56
|
event = double(start_time: nil)
|
56
|
-
calendar = SimpleCalendar::Calendar.new(
|
57
|
+
calendar = SimpleCalendar::Calendar.new(ViewContext.new, events: [event])
|
57
58
|
|
58
59
|
expect{calendar.send(:sorted_events)}.not_to raise_error
|
59
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project: simple_calendar
|
97
|
-
rubygems_version: 2.5.1
|
97
|
+
rubygems_version: 2.4.5.1
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: A simple Rails 3 and Rails 4 calendar
|