social_stream-events 1.1.1 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/javascripts/social_stream/calendar.js.erb +135 -0
- data/app/assets/javascripts/social_stream/event.js +44 -0
- data/app/assets/javascripts/social_stream/events.action.js +36 -0
- data/app/assets/javascripts/social_stream/events.poster.js +23 -0
- data/app/assets/javascripts/social_stream/events.timeline.js +6 -0
- data/app/assets/javascripts/social_stream/fullcalendar.js +135 -0
- data/app/assets/javascripts/social_stream-events.js +1 -1
- data/app/assets/stylesheets/social_stream/events/calendar/_calendar.css.sass +63 -0
- data/app/assets/stylesheets/social_stream/events/calendar/_calendar_modal.css.sass +15 -0
- data/app/assets/stylesheets/social_stream/events/calendar/_calendar_sidebar.css.sass +50 -0
- data/app/assets/stylesheets/social_stream/events/calendar/layout/_calendar.css.sass +28 -0
- data/app/assets/stylesheets/social_stream/events/calendar/layout/_calendar_modal.css.sass +60 -0
- data/app/assets/stylesheets/social_stream/events/calendar/layout/_calendar_sidebar.css.sass +26 -0
- data/app/assets/stylesheets/social_stream/events/explore/layout/_explore_timeline_events.css.sass +6 -0
- data/app/assets/stylesheets/social_stream/events/header_nav/layout/_header_nav_events.css.sass +2 -0
- data/app/assets/stylesheets/social_stream/events/repository/_repository.css.sass +16 -0
- data/app/assets/stylesheets/social_stream/events/repository/layout/_repository.css.sass +24 -0
- data/app/assets/stylesheets/social_stream/events/responsive/_responsive-1200px-min.css.sass +34 -0
- data/app/assets/stylesheets/social_stream/events/responsive/_responsive-767px-max.css.sass +77 -0
- data/app/assets/stylesheets/social_stream/events/responsive/_responsive-768px-979px.css.sass +32 -0
- data/app/assets/stylesheets/social_stream/events/timeline/_timeline_events.css.sass +66 -0
- data/app/assets/stylesheets/social_stream/events/timeline/layout/_timeline_events.css.sass +70 -0
- data/app/assets/stylesheets/social_stream-events.css.sass +42 -0
- data/app/helpers/events_helper.rb +12 -1
- data/app/models/event.rb +7 -9
- data/app/overrides/layouts/_header_signed_in/icon_nav.html.erb.deface +8 -0
- data/app/overrides/settings/_index/add_rooms.html.erb.deface +6 -0
- data/app/overrides/sidebar/_show/add_calendar.html.erb.deface +5 -0
- data/app/views/events/_calendar_month.erb +3 -1
- data/app/views/events/{_event_date.html.erb → _date.html.erb} +5 -8
- data/app/views/events/{_event_date_sidebar.html.erb → _date_sidebar.html.erb} +4 -4
- data/app/views/events/{_event_details.html.erb → _details.html.erb} +11 -8
- data/app/views/events/_event.html.erb +17 -9
- data/app/views/events/_event_sidebar.html.erb +3 -3
- data/app/views/events/_form_poster.html.erb +2 -2
- data/app/views/events/_new.html.erb +11 -20
- data/app/views/events/_poster.html.erb +13 -0
- data/app/views/events/_quick_search_result.html.erb +1 -0
- data/app/views/events/_search_result.html.erb +1 -0
- data/app/views/events/_timeline.html.erb +8 -0
- data/app/views/events/create.js.erb +4 -16
- data/app/views/events/edit.js.erb +2 -2
- data/app/views/events/index.html.erb +23 -91
- data/app/views/events/index.js.erb +1 -1
- data/app/views/rooms/_form.html.erb +11 -16
- data/app/views/rooms/_index.html.erb +3 -7
- data/app/views/settings/_rooms.html.erb +11 -0
- data/app/views/sidebar/_calendar.html.erb +48 -0
- data/config/locales/en.yml +6 -0
- data/config/locales/es.yml +6 -0
- data/lib/generators/social_stream/events/install_generator.rb +2 -3
- data/lib/social_stream/events/engine.rb +0 -12
- data/lib/social_stream/events/version.rb +1 -1
- data/lib/social_stream-events.rb +3 -12
- data/lib/tasks/db/populate.rake +44 -0
- data/social_stream-events.gemspec +2 -2
- data/spec/controllers/events_controller_spec.rb +20 -0
- data/spec/views/settings_spec.rb +39 -0
- metadata +69 -44
- data/app/assets/javascripts/social_stream.calendar.js.erb +0 -104
- data/app/assets/javascripts/social_stream.event.js +0 -55
- data/app/assets/javascripts/social_stream.events.action.js +0 -31
- data/app/assets/javascripts/social_stream.events.poster.js +0 -22
- data/app/assets/stylesheets/events.css.scss +0 -218
- data/app/assets/stylesheets/social_stream-events.css +0 -3
- data/app/decorators/social_stream/base/document_decorator.rb +0 -3
- data/app/models/activity_object_property/poster.rb +0 -2
- data/app/views/events/_event_poster.html.erb +0 -9
- data/app/views/events/_sidebar_calendar.html.erb +0 -45
- data/app/views/rooms/_settings.html.erb +0 -23
- data/lib/social_stream/events/models/document.rb +0 -26
- data/lib/social_stream/views/settings/events.rb +0 -18
- data/lib/social_stream/views/sidebar/events.rb +0 -17
@@ -1,100 +1,32 @@
|
|
1
|
-
<% content_for :headers do %>
|
2
|
-
<style type="text/css">
|
3
|
-
#sidebar {width: 0px;}
|
4
|
-
#center_body {width: 780px; max-width: 780px; border-right: 0px;}
|
5
|
-
</style>
|
6
|
-
<% end %>
|
7
|
-
|
8
1
|
<% content_for :title do %>
|
9
2
|
<%= profile_subject.name + ": " + t('event.calendar') %>
|
10
3
|
<% end %>
|
11
4
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
)
|
16
|
-
|
17
|
-
<%
|
18
|
-
|
19
|
-
<div
|
5
|
+
<section id="events">
|
6
|
+
<%= render partial: 'toolbar/profile', locals: { subject: profile_subject } %>
|
7
|
+
|
8
|
+
<div id="calendar" class="table-striped" data-events_path="<%= polymorphic_path [profile_subject, Event.new] %>" data-date="<%= params[:date] %>" data-view="<%= params[:view] %>" <%= 'data-can-create="true"' if can?(:create, new_post(profile_subject)) %>></div>
|
9
|
+
|
10
|
+
<% if can? :create, new_post(profile_subject) %>
|
11
|
+
<div id="calendar_form" class="modal hide fade">
|
12
|
+
<div class="modal-header">
|
13
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
|
14
|
+
×
|
15
|
+
</button>
|
16
|
+
<h3>
|
17
|
+
<%= t('event.new.title') %>
|
18
|
+
</h3>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="modal-body">
|
22
|
+
<%= render partial: 'new' %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
</section>
|
20
27
|
|
21
28
|
<%= javascript_tag do %>
|
22
29
|
$(function(){
|
23
|
-
|
24
|
-
<% if profile_subject.respond_to? :rooms %>
|
25
|
-
SocialStream.Events.current.roomIndex = <%= raw profile_subject.rooms.map(&:id) %>;
|
26
|
-
<% end %>
|
27
|
-
|
28
|
-
SocialStream.Events.current.eventColor = '#58310E';
|
29
|
-
|
30
|
-
SocialStream.Events.current.calendar = $('#calendar').fullCalendar({
|
31
|
-
header: {
|
32
|
-
left: 'prev,next today',
|
33
|
-
center: 'title',
|
34
|
-
right: 'month,agendaWeek,agendaDay'
|
35
|
-
},
|
36
|
-
ignoreTimezone: false,
|
37
|
-
firstDay: 1,
|
38
|
-
eventColor: SocialStream.Events.current.eventColor,
|
39
|
-
<% if can? :create, new_post(profile_subject) %>
|
40
|
-
selectable: true,
|
41
|
-
selectHelper: true,
|
42
|
-
select: function(startDate, endDate, allDay, jsEvent){
|
43
|
-
|
44
|
-
SocialStream.Events.current.newForm = new Boxy(
|
45
|
-
"<%= escape_javascript render(:partial => 'events/new') %>",
|
46
|
-
{
|
47
|
-
title: "<%= t('event.new.title') %>",
|
48
|
-
closeable: true,
|
49
|
-
closeText: "<%= t('boxy.close_text') %>",
|
50
|
-
draggable: true
|
51
|
-
}
|
52
|
-
);
|
53
|
-
|
54
|
-
|
55
|
-
SocialStream.Events.current.newForm.moveTo(jsEvent.clientX, jsEvent.clientY);
|
56
|
-
|
57
|
-
var c = SocialStream.Events.current.newForm.getContent();
|
58
|
-
|
59
|
-
c.children('#event_start_at').val(startDate.toJSON());
|
60
|
-
c.children('#event_end_at').val(endDate.toJSON());
|
61
|
-
c.children('#event_all_day').val(allDay.toString());
|
62
|
-
|
63
|
-
// From rails-scheduler gem
|
64
|
-
Scheduler.form.init(c.find('.scheduler_form'), startDate);
|
65
|
-
},
|
66
|
-
<% end %>
|
67
|
-
// Implement event edition
|
68
|
-
// editable: true,
|
69
|
-
events: function(start, end, callback) {
|
70
|
-
$.ajax({
|
71
|
-
url: "<%= escape_javascript polymorphic_path([profile_subject, Event.new]) %>",
|
72
|
-
dataType: 'json',
|
73
|
-
data: {
|
74
|
-
// our hypothetical feed requires UNIX timestamps
|
75
|
-
start: Math.round(start.getTime() / 1000),
|
76
|
-
end: Math.round(end.getTime() / 1000)
|
77
|
-
},
|
78
|
-
success: function(events) {
|
79
|
-
callback(
|
80
|
-
$.map(events, function(event) {
|
81
|
-
event.color = SocialStream.Event.color(event.roomId);
|
82
|
-
return event;
|
83
|
-
}
|
84
|
-
)
|
85
|
-
);
|
86
|
-
}
|
87
|
-
});
|
88
|
-
}
|
89
|
-
});
|
90
|
-
|
91
|
-
<% if params[:date] %>
|
92
|
-
// TODO: optimize this to save one index call
|
93
|
-
SocialStream.Events.current.calendar.fullCalendar('gotoDate', new Date(<%= escape_javascript params[:date] %> * 1000));
|
94
|
-
<% end %>
|
95
|
-
|
96
|
-
<% if params[:view] %>
|
97
|
-
SocialStream.Events.current.calendar.fullCalendar('changeView', "<%= escape_javascript params[:view] %>");
|
98
|
-
<% end %>
|
30
|
+
SocialStream.FullCalendar.show();
|
99
31
|
});
|
100
32
|
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
$("#
|
1
|
+
$("#modal-<%= params[:day] %> .modal-body").html("<%= escape_javascript render(:partial => "event_sidebar", :collection => @events) %>");
|
2
2
|
|
3
3
|
SocialStream.Event.index();
|
@@ -3,29 +3,24 @@
|
|
3
3
|
|
4
4
|
<% if f.object.errors.any? %>
|
5
5
|
<div id="error_explanation">
|
6
|
-
<h2
|
7
|
-
|
6
|
+
<h2>
|
7
|
+
<%= pluralize(f.object.errors.count, "error") %> evitaron que se guardara este espacio:
|
8
|
+
</h2>
|
8
9
|
<ul>
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
<% f.object.errors.full_messages.each do |msg| %>
|
11
|
+
<li>
|
12
|
+
<%= msg %>
|
13
|
+
</li>
|
14
|
+
<% end %>
|
12
15
|
</ul>
|
13
16
|
</div>
|
14
17
|
<% end %>
|
15
|
-
|
16
|
-
|
17
|
-
<div class="label">
|
18
|
-
<%= f.text_field :name %>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<div class="field">
|
22
|
-
<%= f.submit %>
|
23
|
-
</div>
|
24
|
-
</div>
|
18
|
+
<%= f.text_field :name %>
|
19
|
+
<%= f.submit %>
|
25
20
|
<% end %>
|
26
21
|
|
27
22
|
<%= javascript_tag do %>
|
28
23
|
$(function(){
|
29
24
|
$('#room_name').watermark("<%= escape_javascript t('room.watermark.name') %>");
|
30
25
|
});
|
31
|
-
<% end %>
|
26
|
+
<% end %>
|
@@ -1,10 +1,6 @@
|
|
1
1
|
<div id="rooms">
|
2
2
|
<% current_subject.rooms.each do |room| %>
|
3
|
-
|
4
|
-
|
5
|
-
<div class="field">
|
6
|
-
<%= link_to image_tag("btn/delete.png", :class => "menu_icon", :title => t('room.delete')), room, :class => "room_delete_link", :method => :delete, :confirm => t('room.confirm_delete'), :remote => true %>
|
7
|
-
</div>
|
8
|
-
</div>
|
3
|
+
<%= room.name %>
|
4
|
+
<%= link_to image_tag("btn/delete.png", :class => "menu_icon", :title => t('room.delete')), room, :class => "room_delete_link", :method => :delete, :confirm => t('room.confirm_delete'), :remote => true %>
|
9
5
|
<% end %>
|
10
|
-
</div>
|
6
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="accordion-group" id="room_settings">
|
2
|
+
<header class="accordion-heading">
|
3
|
+
<%= link_to t('room.settings.title'), "javascript:void(0);", class: 'accordion-toggle', "data-toggle" => 'collapse', "data-parent" => "#settings-accordion", "data-target" => "#room_settings_content" %>
|
4
|
+
</header>
|
5
|
+
|
6
|
+
<div class="content settings_content collapse" id="room_settings_content">
|
7
|
+
<%= render :partial => 'rooms/index' %>
|
8
|
+
|
9
|
+
<%= render :partial => 'rooms/form' %>
|
10
|
+
</div>
|
11
|
+
</div>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<% bow = (Time.now - 6.days).beginning_of_week %>
|
2
|
+
|
3
|
+
<div class="calendar" id="sidebar_calendar" data-path="<%= polymorphic_path([@current_subject, Event.new])%>" data-start="<%= bow.to_i %>" data-end="<%= (bow + 28.days).to_i %>">
|
4
|
+
|
5
|
+
<%= render partial: 'events/calendar_month',
|
6
|
+
locals: {
|
7
|
+
position: :top,
|
8
|
+
date: bow.to_date }
|
9
|
+
%>
|
10
|
+
|
11
|
+
<table id="days">
|
12
|
+
|
13
|
+
<% 28.times do |i| %>
|
14
|
+
<% day = bow + i.days %>
|
15
|
+
<%= raw cycle(*(Array.wrap("<tr>") + 6.times.map{""}) + Array.wrap(:name => "tr_start")) %>
|
16
|
+
<td id="day_<%= day.day %>_<%= day.month %>_<%= day.year %>">
|
17
|
+
<%= link_to day.day, polymorphic_path([profile_or_current_subject, Event.new], :date => day.to_i, :view => "agendaWeek") %>
|
18
|
+
</td>
|
19
|
+
<%= raw cycle(*(6.times.map{""} + Array.wrap('</tr>') + Array.wrap(:name => "tr_end"))) %>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<div id="modal-sidebar_calendar" class="modal hide fade" tabindex="-1" role="dialog">
|
24
|
+
<div class="modal-header">
|
25
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
26
|
+
<h3></h3>
|
27
|
+
</div>
|
28
|
+
<div class="modal-body">
|
29
|
+
<%= render partial: 'layouts/loading' %>
|
30
|
+
</div>
|
31
|
+
<div class="modal-footer">
|
32
|
+
<button class="view-calendar btn "><%= t 'event.modal.view_in_calendar' %></button>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<%= javascript_tag do %>
|
37
|
+
$(function(){
|
38
|
+
SocialStream.Calendar.show();
|
39
|
+
});
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
<%= render partial: 'events/calendar_month',
|
43
|
+
locals: {
|
44
|
+
position: :bottom,
|
45
|
+
date: (bow + 28.days).to_date
|
46
|
+
}
|
47
|
+
%>
|
48
|
+
</div>
|
data/config/locales/en.yml
CHANGED
@@ -27,11 +27,17 @@ en:
|
|
27
27
|
unfollow: "Unfollow"
|
28
28
|
calendar: "Calendar"
|
29
29
|
confirm_delete: "Delete event?"
|
30
|
+
modal:
|
31
|
+
view_in_calendar: "View in calendar"
|
30
32
|
name: "event"
|
31
33
|
new:
|
32
34
|
title: "New event"
|
33
35
|
one: "an event"
|
36
|
+
other: "events"
|
37
|
+
popover:
|
38
|
+
title: "Events on %{date}"
|
34
39
|
poster:
|
40
|
+
button: "Upload"
|
35
41
|
update: "Upload poster"
|
36
42
|
title:
|
37
43
|
one: "Event"
|
data/config/locales/es.yml
CHANGED
@@ -28,11 +28,17 @@ es:
|
|
28
28
|
unfollow: "Desapuntar"
|
29
29
|
calendar: "Calendario"
|
30
30
|
confirm_delete: "¿Borrar evento?"
|
31
|
+
modal:
|
32
|
+
view_in_calendar: "Ver en el calendario"
|
31
33
|
name: "evento"
|
32
34
|
new:
|
33
35
|
title: "Nuevo evento"
|
34
36
|
one: "un evento"
|
37
|
+
other: "eventos"
|
38
|
+
popover:
|
39
|
+
title: "Eventos el %{date}"
|
35
40
|
poster:
|
41
|
+
button: "Subir"
|
36
42
|
update: "Subir cartel"
|
37
43
|
title:
|
38
44
|
one: "Evento"
|
@@ -17,8 +17,7 @@ class SocialStream::Events::InstallGenerator < Rails::Generators::Base
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def require_stylesheets
|
20
|
-
|
21
|
-
|
22
|
-
:before => ' *= require_tree .'
|
20
|
+
append_file 'app/assets/stylesheets/social_stream.css.sass',
|
21
|
+
"@import social_stream-events\n"
|
23
22
|
end
|
24
23
|
end
|
@@ -10,18 +10,6 @@ module SocialStream
|
|
10
10
|
initializer "social_stream-events.models.register_activity_streams" do
|
11
11
|
SocialStream::ActivityStreams.register :event
|
12
12
|
end
|
13
|
-
|
14
|
-
initializer "social_stream-events.views.settings" do
|
15
|
-
SocialStream::Views::Settings.module_eval do
|
16
|
-
include SocialStream::Views::Settings::Events
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
initializer "social_stream-events.views.sidebar" do
|
21
|
-
SocialStream::Views::Sidebar.module_eval do
|
22
|
-
include SocialStream::Views::Sidebar::Events
|
23
|
-
end
|
24
|
-
end
|
25
13
|
end
|
26
14
|
end
|
27
15
|
end
|
data/lib/social_stream-events.rb
CHANGED
@@ -3,25 +3,16 @@ require 'social_stream-base'
|
|
3
3
|
require 'rails-scheduler'
|
4
4
|
|
5
5
|
module SocialStream
|
6
|
-
module Views
|
7
|
-
module Settings
|
8
|
-
autoload :Events, 'social_stream/views/settings/events'
|
9
|
-
end
|
10
|
-
|
11
|
-
module Sidebar
|
12
|
-
autoload :Events, 'social_stream/views/sidebar/events'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
6
|
module Events
|
17
7
|
autoload :Ability, 'social_stream/events/ability'
|
18
8
|
|
19
9
|
module Models
|
20
10
|
autoload :Actor, 'social_stream/events/models/actor'
|
21
|
-
autoload :Document, 'social_stream/events/models/document'
|
22
11
|
end
|
23
12
|
|
24
|
-
|
13
|
+
%w( objects quick_search_models extended_search_models repository_models ).each do |m|
|
14
|
+
SocialStream.__send__(m).push(:event) unless SocialStream.__send__(m).include?(:event)
|
15
|
+
end
|
25
16
|
end
|
26
17
|
end
|
27
18
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
namespace :db do
|
2
|
+
namespace :populate do
|
3
|
+
|
4
|
+
desc "Create populate data with events"
|
5
|
+
task :create => 'create:events'
|
6
|
+
|
7
|
+
namespace :create do
|
8
|
+
desc "Add events to populate data"
|
9
|
+
task :events => :read_environment do
|
10
|
+
scope = 2.months
|
11
|
+
|
12
|
+
SocialStream::Population::ActivityObject.new Event do |l|
|
13
|
+
l.title = Forgery::LoremIpsum.words(1+rand(4),:random => true)
|
14
|
+
l.description = Forgery::LoremIpsum.sentences(1+rand(4), :random => true)
|
15
|
+
|
16
|
+
s = rand(scope)
|
17
|
+
s *= -1 if [ true, false ].sample
|
18
|
+
|
19
|
+
l.start_at = Time.at(Time.now.to_i + s)
|
20
|
+
|
21
|
+
if rand(1) > 0.25
|
22
|
+
l.start_at = l.start_at.begining_of_day
|
23
|
+
l.end_at = l.start_at.end_of_day
|
24
|
+
l.all_day = true
|
25
|
+
else
|
26
|
+
l.end_at = l.start_at + rand(3.days)
|
27
|
+
end
|
28
|
+
|
29
|
+
l.frequency = [ 0, 2, 3 ].sample
|
30
|
+
|
31
|
+
case l.frequency
|
32
|
+
when 2
|
33
|
+
l.interval = [ 1, 2, 3 ].sample
|
34
|
+
l.week_days = 7.times.map{ |i| i }.sample(rand(6).to_i + 1)
|
35
|
+
when 3
|
36
|
+
l.week_day_order = [ 1, 2, 3, -1 ].sample
|
37
|
+
l.week_day = 7.times.map{ |i| i }.sample
|
38
|
+
l.interval = rand(3).to_i + 1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~>
|
16
|
-
s.add_runtime_dependency('rails-scheduler', '~> 0.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 2.0.0.beta1')
|
16
|
+
s.add_runtime_dependency('rails-scheduler', '~> 0.1.1')
|
17
17
|
|
18
18
|
# Development Gem dependencies
|
19
19
|
s.add_development_dependency('sqlite3-ruby')
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EventsController do
|
4
|
+
render_views
|
5
|
+
|
6
|
+
context "user's calendar" do
|
7
|
+
before do
|
8
|
+
@user = Factory(:user)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "when Anonymous" do
|
12
|
+
it "should render to login" do
|
13
|
+
get :index, user_id: @user.to_param
|
14
|
+
|
15
|
+
response.should be_success
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'settings/_index' do
|
4
|
+
let(:user) { stub_model(User, { name: "Test User",
|
5
|
+
email: "test-user@test.com",
|
6
|
+
language: 'en' } ) }
|
7
|
+
|
8
|
+
let(:group) { stub_model(Group, { name: "Test Group",
|
9
|
+
to_param: "test-group" } ) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
view.stub(:current_user).and_return(user)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "with user" do
|
16
|
+
before do
|
17
|
+
view.stub(:current_subject).and_return(user)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "does not include room settings" do
|
21
|
+
render
|
22
|
+
|
23
|
+
rendered.should_not =~ /room_settings/
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "with group" do
|
28
|
+
before do
|
29
|
+
view.stub(:current_subject).and_return(group)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "includes room settings" do
|
33
|
+
render
|
34
|
+
|
35
|
+
rendered.should =~ /room_settings/
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|