event_calendar_engine 0.1.11 → 0.2.0
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/Gemfile.lock +39 -35
- data/VERSION +1 -1
- data/app/controllers/event_revisions_controller.rb +1 -1
- data/app/controllers/events_controller.rb +21 -36
- data/app/controllers/links_controller.rb +62 -0
- data/app/helpers/event_calendar/application_helper.rb +73 -4
- data/app/models/event.rb +21 -43
- data/app/models/event_instance_methods.rb +40 -9
- data/app/models/link.rb +19 -0
- data/app/views/event_revisions/_list_group.html.erb +1 -1
- data/app/views/events/_details.html.erb +2 -1
- data/app/views/events/_event.html.erb +2 -0
- data/app/views/events/_event_details.html.erb +22 -17
- data/app/views/events/_form.html.erb +47 -3
- data/app/views/events/_list_group.html.erb +1 -1
- data/app/views/events/_one_day_list_event.html.erb +1 -1
- data/app/views/events/edit.html.erb +1 -1
- data/app/views/links/_form.html.erb +18 -0
- data/app/views/links/_link.html.erb +6 -0
- data/app/views/links/_links.html.erb +6 -0
- data/app/views/links/create.js.rjs +14 -0
- data/app/views/links/edit.html.erb +3 -0
- data/app/views/links/new.html.erb +3 -0
- data/app/views/links/show.html.erb +3 -0
- data/app/views/links/update.js.rjs +15 -0
- data/config/routes.rb +1 -56
- data/db/migrate/20110204223256_add_presenters_facilitators_to_events.rb +11 -0
- data/db/migrate/20110206000427_create_event_calendar_links.rb +23 -0
- data/db/schema.rb +18 -1
- data/public/javascripts/event_calendar/event_calendar.js +7 -0
- data/public/javascripts/event_calendar/event_calendar_behaviors.js +92 -23
- data/public/stylesheets/event_calendar/blueprint/screen.css +1 -0
- data/spec/controllers/events_controller_spec.rb +4 -2
- data/spec/controllers/links_controller_spec.rb +140 -0
- data/spec/fixtures/event_calendar_events.yml +12 -2
- data/spec/fixtures/event_calendar_events_links.yml +3 -0
- data/spec/fixtures/event_calendar_links.yml +4 -0
- data/spec/helpers/event_calendar/application_helper_spec.rb +4 -4
- data/spec/models/event_instance_methods_spec.rb +58 -0
- data/spec/models/event_revision_spec.rb +11 -10
- data/spec/models/event_spec.rb +31 -65
- data/spec/models/link_spec.rb +31 -0
- data/spec/spec_helpers/helpers.rb +15 -0
- metadata +29 -6
- data/app/views/events/_times.html.erb +0 -5
@@ -6,15 +6,16 @@ describe EventRevision do
|
|
6
6
|
@valid_attributes = {
|
7
7
|
:name => "value for name",
|
8
8
|
:event_type => "Meeting",
|
9
|
-
:start_on =>
|
10
|
-
:end_on =>
|
9
|
+
:start_on => Time.now,
|
10
|
+
:end_on => Time.now,
|
11
|
+
:timezone => 'Pacific Time (US & Canada)',
|
11
12
|
:location => "value for location",
|
12
13
|
:description => "value for description"
|
13
14
|
}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
#@event = Event.create!(@valid_attributes)
|
16
|
+
#@event.name = 'other value'
|
17
|
+
#@event.save
|
18
|
+
#@event_revision = @event.find_revision(:previous)
|
18
19
|
|
19
20
|
# pending
|
20
21
|
#@contact = mock_model(Contact)
|
@@ -23,14 +24,14 @@ describe EventRevision do
|
|
23
24
|
|
24
25
|
it "should have an attendee collection" do
|
25
26
|
pending
|
26
|
-
|
27
|
+
#@event_revision.attendees.count.should == 0
|
27
28
|
end
|
28
29
|
|
29
30
|
it "should instantiate Contacts as attendees" do
|
30
31
|
pending
|
31
|
-
Contact.should_receive(:find).and_return([@contact])
|
32
|
-
|
33
|
-
|
32
|
+
#Contact.should_receive(:find).and_return([@contact])
|
33
|
+
#@event_revision.attendee_roster = "#{@contact.id}"
|
34
|
+
#@event_revision.attendees.should == [@contact]
|
34
35
|
end
|
35
36
|
|
36
37
|
end
|
data/spec/models/event_spec.rb
CHANGED
@@ -12,12 +12,12 @@ describe Event do
|
|
12
12
|
}
|
13
13
|
@may_2010 = Event.create!(@valid_attributes)
|
14
14
|
@mar_2100 = Event.create!(@valid_attributes.merge!({
|
15
|
-
:start_on =>
|
16
|
-
:end_on =>
|
15
|
+
:start_on => (365 * 24 * 5).hours.from_now,
|
16
|
+
:end_on => ((365 * 24 * 5) + 72).hours.from_now
|
17
17
|
}))
|
18
18
|
@current = Event.create!(@valid_attributes.merge!({
|
19
|
-
:start_on =>
|
20
|
-
:end_on =>
|
19
|
+
:start_on => 72.hours.ago,
|
20
|
+
:end_on => 48.hours.from_now
|
21
21
|
}))
|
22
22
|
end
|
23
23
|
|
@@ -35,7 +35,7 @@ describe Event do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "Event.between finds events between limits" do
|
38
|
-
Event.between(
|
38
|
+
Event.between((362 * 24 * 5).hours.from_now, ((365 * 24 * 5) + 72).hours.from_now).first.should eql @mar_2100
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should create a new instance given valid attributes" do
|
@@ -44,9 +44,34 @@ describe Event do
|
|
44
44
|
|
45
45
|
it "must start before it can end" do
|
46
46
|
event = Event.new(@valid_attributes)
|
47
|
-
event.end_on =
|
47
|
+
event.end_on = 6.months.ago
|
48
48
|
event.should_not be_valid
|
49
49
|
end
|
50
|
+
|
51
|
+
context "setting default end_on of start_on + 1.hour if start_on is present and" do
|
52
|
+
before(:each) do
|
53
|
+
Time.zone = 'Pacific Time (US & Canada)'
|
54
|
+
end
|
55
|
+
let(:event) do
|
56
|
+
Event.new(@valid_attributes.merge!({
|
57
|
+
:timezone => 'Pacific Time (US & Canada)',
|
58
|
+
:start_on => 1.hour.from_now,
|
59
|
+
:end_on => nil
|
60
|
+
}))
|
61
|
+
end
|
62
|
+
|
63
|
+
it "end_on is blank" do
|
64
|
+
event.one_day?.should be_true
|
65
|
+
event.valid?
|
66
|
+
event.end_on.should eq event.start_on + 1.hour
|
67
|
+
end
|
68
|
+
it "end_on <= start_on" do
|
69
|
+
event.end_on = 4.hours.ago
|
70
|
+
event.one_day?.should be_true
|
71
|
+
event.valid?
|
72
|
+
event.end_on.should eq event.start_on + 1.hour
|
73
|
+
end
|
74
|
+
end
|
50
75
|
|
51
76
|
it "should find event types" do
|
52
77
|
Event.create!(@valid_attributes)
|
@@ -77,63 +102,4 @@ describe Event do
|
|
77
102
|
event.revision_number.should == 0
|
78
103
|
end
|
79
104
|
|
80
|
-
context "with attendees" do
|
81
|
-
|
82
|
-
before(:each) do
|
83
|
-
@event = Event.create!(@valid_attributes)
|
84
|
-
# pending
|
85
|
-
#@contact = mock_model(Contact)
|
86
|
-
#@event.add_attendees([@contact.id])
|
87
|
-
#@event.save
|
88
|
-
#Contact.stub(:find).and_return([@contact])
|
89
|
-
end
|
90
|
-
|
91
|
-
context "adding an attendee" do
|
92
|
-
|
93
|
-
it "should update attendee_roster" do
|
94
|
-
pending
|
95
|
-
@event.attendee_roster.should == @contact.id.to_s
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should create a new version" do
|
99
|
-
pending
|
100
|
-
@event.revision_number.should == 1
|
101
|
-
end
|
102
|
-
|
103
|
-
it "should have previous set of attendees available through the previous revision" do
|
104
|
-
pending
|
105
|
-
@event.find_revision(:previous).attendees.count.should == 0
|
106
|
-
@event.add_attendees([@contact.id])
|
107
|
-
@event.find_revision(:previous).attendees.count.should == 1
|
108
|
-
@event.attendees.count.should == 2
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
context "removing an attendee" do
|
113
|
-
|
114
|
-
before(:each) do
|
115
|
-
# pending
|
116
|
-
#@event.attendees.count.should == 1
|
117
|
-
#@attendee = @event.attendees.first
|
118
|
-
#@event.drop_attendees(@attendee.contact_id)
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should not include the removed attendee in the current collection" do
|
122
|
-
pending
|
123
|
-
@event.attendees.count.should == 0
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should create a new version" do
|
127
|
-
pending
|
128
|
-
@event.revision_number.should == 2
|
129
|
-
end
|
130
|
-
|
131
|
-
it "should have previous set of attendees available through the previous revision" do
|
132
|
-
pending
|
133
|
-
@event.find_revision(:previous).attendees.should == @attendee.contact
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
105
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
associations = {
|
4
|
+
:has_and_belongs_to_many => %w(events)
|
5
|
+
}
|
6
|
+
|
7
|
+
describe Link do
|
8
|
+
subject{ Link }
|
9
|
+
|
10
|
+
let(:link){ Link.new }
|
11
|
+
|
12
|
+
spec_associations(associations, :class => Link)
|
13
|
+
|
14
|
+
describe "a valid Link" do
|
15
|
+
before(:all) do
|
16
|
+
link.valid?
|
17
|
+
end
|
18
|
+
it "has a name" do
|
19
|
+
link.should have(1).error_on(:name)
|
20
|
+
end
|
21
|
+
it "has a url" do
|
22
|
+
link.errors[:url].should include('can\'t be blank')
|
23
|
+
end
|
24
|
+
it "has a /valid/ url but will prepend 'http://' by default if no protocol is detected and url is not blank" do
|
25
|
+
link.name = 'Test'
|
26
|
+
link.url = 'test.com'
|
27
|
+
link.valid?.should be_true
|
28
|
+
link.url.should eq 'http://test.com'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
def spec_associations(associations, options={})
|
2
|
+
subject = options[:class] unless subject.present?
|
3
|
+
if subject.blank?
|
4
|
+
raise ArgumentError, "spec_associations expects a subject to be set to the target class; eg subject{ YourActiveRecordModel }"
|
5
|
+
end
|
6
|
+
it_prefix = options[:it_prefix]
|
7
|
+
it_prefix += " " unless it_prefix.blank?
|
8
|
+
associations.each do |type, names|
|
9
|
+
names.each do |name|
|
10
|
+
it "#{it_prefix}#{type} #{name}" do
|
11
|
+
subject.to_s.constantize.reflections.should include(name.to_sym)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_calendar_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason LaPier
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-02-06 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -398,6 +398,7 @@ files:
|
|
398
398
|
- app/controllers/event_calendar/application_controller.rb
|
399
399
|
- app/controllers/event_revisions_controller.rb
|
400
400
|
- app/controllers/events_controller.rb
|
401
|
+
- app/controllers/links_controller.rb
|
401
402
|
- app/helpers/event_calendar/application_helper.rb
|
402
403
|
- app/helpers/events_helper.rb
|
403
404
|
- app/models/attendee.rb
|
@@ -405,6 +406,7 @@ files:
|
|
405
406
|
- app/models/event.rb
|
406
407
|
- app/models/event_instance_methods.rb
|
407
408
|
- app/models/event_revision.rb
|
409
|
+
- app/models/link.rb
|
408
410
|
- app/models/participant.rb
|
409
411
|
- app/models/participator.rb
|
410
412
|
- app/views/attendees/_add_attendees.html.erb
|
@@ -428,7 +430,6 @@ files:
|
|
428
430
|
- app/views/events/_list_group.html.erb
|
429
431
|
- app/views/events/_multi_day_list_event.html.erb
|
430
432
|
- app/views/events/_one_day_list_event.html.erb
|
431
|
-
- app/views/events/_times.html.erb
|
432
433
|
- app/views/events/attendees.html.erb
|
433
434
|
- app/views/events/edit.html.erb
|
434
435
|
- app/views/events/index.html.erb
|
@@ -436,6 +437,14 @@ files:
|
|
436
437
|
- app/views/events/search.html.erb
|
437
438
|
- app/views/events/show.html.erb
|
438
439
|
- app/views/layouts/application.html.erb
|
440
|
+
- app/views/links/_form.html.erb
|
441
|
+
- app/views/links/_link.html.erb
|
442
|
+
- app/views/links/_links.html.erb
|
443
|
+
- app/views/links/create.js.rjs
|
444
|
+
- app/views/links/edit.html.erb
|
445
|
+
- app/views/links/new.html.erb
|
446
|
+
- app/views/links/show.html.erb
|
447
|
+
- app/views/links/update.js.rjs
|
439
448
|
- config/application.rb
|
440
449
|
- config/blueprint_settings.yml
|
441
450
|
- config/boot.rb
|
@@ -459,6 +468,8 @@ files:
|
|
459
468
|
- db/migrate/20101011200048_make_events_revisable.rb
|
460
469
|
- db/migrate/20101223221015_change_start_on_end_on_to_timestamp.rb
|
461
470
|
- db/migrate/20101223233354_add_timezone_to_events.rb
|
471
|
+
- db/migrate/20110204223256_add_presenters_facilitators_to_events.rb
|
472
|
+
- db/migrate/20110206000427_create_event_calendar_links.rb
|
462
473
|
- db/schema.rb
|
463
474
|
- db/seeds.rb
|
464
475
|
- lib/event_calendar.rb
|
@@ -547,12 +558,18 @@ files:
|
|
547
558
|
- spec/controllers/attendees_controller_spec.rb
|
548
559
|
- spec/controllers/event_revisions_controller_spec.rb
|
549
560
|
- spec/controllers/events_controller_spec.rb
|
561
|
+
- spec/controllers/links_controller_spec.rb
|
550
562
|
- spec/fixtures/event_calendar_events.yml
|
563
|
+
- spec/fixtures/event_calendar_events_links.yml
|
564
|
+
- spec/fixtures/event_calendar_links.yml
|
551
565
|
- spec/helpers/event_calendar/application_helper_spec.rb
|
552
566
|
- spec/models/deletable_instance_methods_spec.rb
|
567
|
+
- spec/models/event_instance_methods_spec.rb
|
553
568
|
- spec/models/event_revision_spec.rb
|
554
569
|
- spec/models/event_spec.rb
|
570
|
+
- spec/models/link_spec.rb
|
555
571
|
- spec/spec_helper.rb
|
572
|
+
- spec/spec_helpers/helpers.rb
|
556
573
|
- spec/spec_helpers/mocks.rb
|
557
574
|
has_rdoc: true
|
558
575
|
homepage: http://github.com/inertialbit/event_calendar
|
@@ -592,10 +609,16 @@ test_files:
|
|
592
609
|
- spec/controllers/attendees_controller_spec.rb
|
593
610
|
- spec/controllers/event_revisions_controller_spec.rb
|
594
611
|
- spec/controllers/events_controller_spec.rb
|
612
|
+
- spec/controllers/links_controller_spec.rb
|
595
613
|
- spec/fixtures/event_calendar_events.yml
|
614
|
+
- spec/fixtures/event_calendar_events_links.yml
|
615
|
+
- spec/fixtures/event_calendar_links.yml
|
596
616
|
- spec/helpers/event_calendar/application_helper_spec.rb
|
597
617
|
- spec/models/deletable_instance_methods_spec.rb
|
618
|
+
- spec/models/event_instance_methods_spec.rb
|
598
619
|
- spec/models/event_revision_spec.rb
|
599
620
|
- spec/models/event_spec.rb
|
621
|
+
- spec/models/link_spec.rb
|
600
622
|
- spec/spec_helper.rb
|
623
|
+
- spec/spec_helpers/helpers.rb
|
601
624
|
- spec/spec_helpers/mocks.rb
|