Use 1.9+ Hash syntax

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/6827/head
Alex Coles 10 years ago
parent cf0a1e85b4
commit 31d1d4b297
  1. 4
      app/controllers/meeting_agendas_controller.rb
  2. 16
      app/controllers/meeting_contents_controller.rb
  3. 34
      app/controllers/meetings_controller.rb
  4. 12
      app/helpers/meeting_contents_helper.rb
  5. 2
      app/helpers/meetings_helper.rb
  6. 2
      app/helpers/message_accessibility_helper.rb
  7. 2
      app/models/journal/meeting_content_journal.rb
  8. 2
      app/models/journal/meeting_journal.rb
  9. 30
      app/models/meeting.rb
  10. 8
      app/models/meeting_content.rb
  11. 4
      app/models/meeting_participant.rb
  12. 10
      features/step_definitions/meeting_steps.rb
  13. 42
      lib/open_project/meeting/engine.rb
  14. 2
      lib/open_project/meeting/patches/project_patch.rb
  15. 2
      spec/controllers/meeting_agendas_controller_spec.rb
  16. 2
      spec/controllers/meeting_minutes_controller_spec.rb
  17. 10
      spec/controllers/meetings_controller_spec.rb
  18. 2
      spec/factories/meeting_content_journal_factory.rb
  19. 2
      spec/factories/meeting_factory.rb
  20. 2
      spec/mailers/meeting_mailer_spec.rb
  21. 4
      spec/models/meeting_agenda_spec.rb
  22. 2
      spec/models/meeting_content_journal_spec.rb
  23. 2
      spec/models/meeting_minutes_spec.rb
  24. 22
      spec/models/meeting_spec.rb
  25. 34
      spec/models/user_deletion_spec.rb
  26. 2
      spec/routing/previews_routing_spec.rb
  27. 2
      spec/support/plugin_spec_helper.rb

@ -25,12 +25,12 @@ class MeetingAgendasController < MeetingContentsController
def close
@meeting.close_agenda_and_copy_to_minutes!
redirect_back_or_default :controller => '/meetings', :action => 'show', :id => @meeting
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
end
def open
@content.unlock!
redirect_back_or_default :controller => '/meetings', :action => 'show', :id => @meeting
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
end
private

@ -38,10 +38,10 @@ class MeetingContentsController < ApplicationController
def show
if params[:id].present? && @content.version == params[:id].to_i
# Redirect links to the last version
redirect_to :controller => '/meetings',
:action => :show,
:id => @meeting,
:tab => @content_type.sub(/^meeting_/, '')
redirect_to controller: '/meetings',
action: :show,
id: @meeting,
tab: @content_type.sub(/^meeting_/, '')
return
end
#go to an old version if a version id is given
@ -55,7 +55,7 @@ class MeetingContentsController < ApplicationController
@content.author = User.current
if @content.save
flash[:notice] = l(:notice_successful_update)
redirect_back_or_default :controller => '/meetings', :action => 'show', :id => @meeting
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
else
end
rescue ActiveRecord::StaleObjectError
@ -72,7 +72,7 @@ class MeetingContentsController < ApplicationController
.page(page_param)
.per_page(per_page_param)
render 'meeting_contents/history', :layout => !request.xhr?
render 'meeting_contents/history', layout: !request.xhr?
end
def diff
@ -91,7 +91,7 @@ class MeetingContentsController < ApplicationController
end
flash[:notice] = l(:notice_successful_notification)
end
redirect_back_or_default :controller => '/meetings', :action => 'show', :id => @meeting
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
end
def default_breadcrumb
@ -101,7 +101,7 @@ class MeetingContentsController < ApplicationController
private
def find_meeting
@meeting = Meeting.find(params[:meeting_id], :include => [:project, :author, :participants, :agenda, :minutes])
@meeting = Meeting.find(params[:meeting_id], include: [:project, :author, :participants, :agenda, :minutes])
@project = @meeting.project
@author = User.current
rescue ActiveRecord::RecordNotFound

@ -21,9 +21,9 @@
class MeetingsController < ApplicationController
around_filter :set_time_zone
before_filter :find_project, :only => [:index, :new, :create]
before_filter :find_meeting, :except => [:index, :new, :create]
before_filter :convert_params, :only => [:create, :update]
before_filter :find_project, only: [:index, :new, :create]
before_filter :find_meeting, except: [:index, :new, :create]
before_filter :convert_params, only: [:create, :update]
before_filter :authorize
helper :journals
@ -32,7 +32,7 @@ class MeetingsController < ApplicationController
include WatchersHelper
include PaginationHelper
menu_item :new_meeting, :only => [:new, :create]
menu_item :new_meeting, only: [:new, :create]
def index
scope = @project.meetings
@ -62,21 +62,21 @@ class MeetingsController < ApplicationController
@meeting.attributes = params[:meeting]
if params[:copied_from_meeting_id].present? && params[:copied_meeting_agenda_text].present?
@meeting.agenda = MeetingAgenda.new(
:text => params[:copied_meeting_agenda_text],
:comment => "Copied from Meeting ##{params[:copied_from_meeting_id]}")
text: params[:copied_meeting_agenda_text],
comment: "Copied from Meeting ##{params[:copied_from_meeting_id]}")
@meeting.agenda.author = User.current
end
if @meeting.save
text = l(:notice_successful_create)
if User.current.time_zone.nil?
link = l(:notice_timezone_missing, :zone => Time.zone)
text += " #{view_context.link_to(link, {:controller => '/my', :action => :account},:class => "link_to_profile")}"
link = l(:notice_timezone_missing, zone: Time.zone)
text += " #{view_context.link_to(link, {controller: '/my', action: :account},class: "link_to_profile")}"
end
flash[:notice] = text.html_safe
redirect_to :action => 'show', :id => @meeting
redirect_to action: 'show', id: @meeting
else
render :action => 'new', :project_id => @project
render action: 'new', project_id: @project
end
end
@ -86,14 +86,14 @@ class MeetingsController < ApplicationController
def copy
params[:copied_from_meeting_id] = @meeting.id
params[:copied_meeting_agenda_text] = @meeting.agenda.text if @meeting.agenda.present?
@meeting = @meeting.copy(:author => User.current)
render :action => 'new', :project_id => @project
@meeting = @meeting.copy(author: User.current)
render action: 'new', project_id: @project
end
def destroy
@meeting.destroy
flash[:notice] = l(:notice_successful_delete)
redirect_to :action => 'index', :project_id => @project
redirect_to action: 'index', project_id: @project
end
def edit
@ -104,9 +104,9 @@ class MeetingsController < ApplicationController
@meeting.attributes = params[:meeting]
if @meeting.save
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :id => @meeting
redirect_to action: 'show', id: @meeting
else
render :action => 'edit'
render action: 'edit'
end
end
@ -134,7 +134,7 @@ class MeetingsController < ApplicationController
end
def find_meeting
@meeting = Meeting.find(params[:id], :include => [:project, :author, {:participants => :user}, :agenda, :minutes])
@meeting = Meeting.find(params[:id], include: [:project, :author, {participants: :user}, :agenda, :minutes])
@project = @meeting.project
rescue ActiveRecord::RecordNotFound
render_404
@ -154,6 +154,6 @@ class MeetingsController < ApplicationController
params[:meeting][:duration] = params[:meeting][:duration].to_hours
# Force defaults on participants
params[:meeting][:participants_attributes] ||= {}
params[:meeting][:participants_attributes].each {|p| p.reverse_merge! :attended => false, :invited => false}
params[:meeting][:participants_attributes].each {|p| p.reverse_merge! attended: false, invited: false}
end
end

@ -49,29 +49,29 @@ module MeetingContentsHelper
def close_meeting_agenda_link(content_type, meeting)
case content_type
when "meeting_agenda"
link_to_if_authorized l(:label_meeting_close), {:controller => '/meeting_agendas', :action => 'close', :meeting_id => meeting}, :method => :put, :class => "icon icon-locked show-meeting_agenda"
link_to_if_authorized l(:label_meeting_close), {controller: '/meeting_agendas', action: 'close', meeting_id: meeting}, method: :put, class: "icon icon-locked show-meeting_agenda"
when "meeting_minutes"
link_to_if_authorized l(:label_meeting_agenda_close), {:controller => '/meeting_agendas', :action => 'close', :meeting_id => meeting}, :method => :put, :class => "icon icon-locked show-meeting_minutes"
link_to_if_authorized l(:label_meeting_agenda_close), {controller: '/meeting_agendas', action: 'close', meeting_id: meeting}, method: :put, class: "icon icon-locked show-meeting_minutes"
end
end
def open_meeting_agenda_link(content_type, meeting)
case content_type
when "meeting_agenda"
link_to_if_authorized l(:label_meeting_open), {:controller => '/meeting_agendas', :action => 'open', :meeting_id => meeting}, :method => :put, :class => 'icon icon-unlocked show-meeting_agenda', :confirm => l(:text_meeting_agenda_open_are_you_sure)
link_to_if_authorized l(:label_meeting_open), {controller: '/meeting_agendas', action: 'open', meeting_id: meeting}, method: :put, class: 'icon icon-unlocked show-meeting_agenda', confirm: l(:text_meeting_agenda_open_are_you_sure)
when "meeting_minutes"
end
end
def meeting_content_edit_link(content_type)
link_to l(:button_edit), "#", :class => "icon icon-edit show-#{content_type}", :accesskey => accesskey(:edit), :onclick => "$$('.edit-#{content_type}').invoke('show'); $$('.show-#{content_type}').invoke('hide'); return false;"
link_to l(:button_edit), "#", class: "icon icon-edit show-#{content_type}", accesskey: accesskey(:edit), onclick: "$$('.edit-#{content_type}').invoke('show'); $$('.show-#{content_type}').invoke('hide'); return false;"
end
def meeting_content_history_link(content_type, meeting)
link_to_if_authorized l(:label_history), {:controller => '/' + content_type.pluralize, :action => 'history', :meeting_id => meeting}, :class => "icon icon-wiki show-#{content_type}"
link_to_if_authorized l(:label_history), {controller: '/' + content_type.pluralize, action: 'history', meeting_id: meeting}, class: "icon icon-wiki show-#{content_type}"
end
def meeting_content_notify_link(content_type, meeting)
link_to_if_authorized l(:label_notify), {:controller => '/' + content_type.pluralize, :action => 'notify', :meeting_id => meeting}, :method => :put, :class => "icon icon-mail show-#{content_type}"
link_to_if_authorized l(:label_notify), {controller: '/' + content_type.pluralize, action: 'notify', meeting_id: meeting}, method: :put, class: "icon icon-mail show-#{content_type}"
end
end

@ -26,6 +26,6 @@ module MeetingsHelper
def render_meeting_journal(model, journal, options = {})
return "" if journal.initial?
journal_content = render_journal_details(journal, :label_updated_time_by, model, options)
content_tag "div", journal_content, { :id => "change-#{journal.id}", :class => "journal" }
content_tag "div", journal_content, { id: "change-#{journal.id}", class: "journal" }
end
end

@ -36,7 +36,7 @@ module MessageAccessibilityHelper
ids_with_label = select_ids.zip([:label_meeting_hour, :label_meeting_minute])
ids_with_label.each do |iwl|
labels += content_tag(:label, l(iwl[1]), :for => iwl[0], :class => 'hidden-for-sighted')
labels += content_tag(:label, l(iwl[1]), for: iwl[0], class: 'hidden-for-sighted')
end
(labels + select).html_safe

@ -23,7 +23,7 @@ class Journal::MeetingContentJournal < Journal::BaseJournal
self.table_name = "meeting_content_journals"
belongs_to :meeting
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
def editable?
false

@ -22,5 +22,5 @@
class Journal::MeetingJournal < Journal::BaseJournal
self.table_name = "meeting_journals"
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
end

@ -23,30 +23,30 @@ class Meeting < ActiveRecord::Base
self.table_name = 'meetings'
belongs_to :project
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_one :agenda, :dependent => :destroy, :class_name => 'MeetingAgenda'
has_one :minutes, :dependent => :destroy, :class_name => 'MeetingMinutes'
has_many :contents, :class_name => 'MeetingContent', :readonly => true
has_many :participants, :dependent => :destroy, :class_name => 'MeetingParticipant'
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
has_one :agenda, dependent: :destroy, class_name: 'MeetingAgenda'
has_one :minutes, dependent: :destroy, class_name: 'MeetingMinutes'
has_many :contents, class_name: 'MeetingContent', readonly: true
has_many :participants, dependent: :destroy, class_name: 'MeetingParticipant'
default_scope order("#{Meeting.table_name}.start_time DESC")
scope :from_tomorrow, :conditions => ['start_time >= ?', Date.tomorrow.beginning_of_day]
scope :from_tomorrow, conditions: ['start_time >= ?', Date.tomorrow.beginning_of_day]
scope :with_users_by_date, order("#{Meeting.table_name}.title ASC")
.includes({:participants => :user}, :author)
.includes({participants: :user}, :author)
attr_accessible :title, :location, :start_time, :duration
acts_as_watchable
acts_as_searchable :columns => ["#{table_name}.title", "#{MeetingContent.table_name}.text"],
:include => [:contents, :project],
:date_column => "#{table_name}.created_at"
acts_as_searchable columns: ["#{table_name}.title", "#{MeetingContent.table_name}.text"],
include: [:contents, :project],
date_column: "#{table_name}.created_at"
acts_as_journalized
acts_as_event title: Proc.new {|o| "#{l :label_meeting}: #{o.title} \
#{format_date o.start_time} \
#{format_time o.start_time, false}-#{format_time o.end_time, false})"},
url: Proc.new {|o| {:controller => '/meetings', :action => 'show', :id => o}},
url: Proc.new {|o| {controller: '/meetings', action: 'show', id: o}},
author: Proc.new {|o| o.user},
description: ""
@ -55,7 +55,7 @@ class Meeting < ActiveRecord::Base
register_on_journal_formatter(:datetime, 'start_time')
register_on_journal_formatter(:plaintext, 'location')
accepts_nested_attributes_for :participants, :allow_destroy => true
accepts_nested_attributes_for :participants, allow_destroy: true
validates_presence_of :title, :start_time, :duration
@ -95,7 +95,7 @@ class Meeting < ActiveRecord::Base
def author=(user)
super
# Don't add the author as participant if we already have some through nested attributes
self.participants.build(:user => user, :invited => true) if (self.new_record? && self.participants.empty? && user)
self.participants.build(user: user, invited: true) if (self.new_record? && self.participants.empty? && user)
end
# Returns true if usr or current user is allowed to view the meeting
@ -107,7 +107,7 @@ class Meeting < ActiveRecord::Base
changeable_participants = self.participants.select(&:invited).collect{|p| p.user}
changeable_participants = changeable_participants + self.participants.select(&:attended).collect{|p| p.user}
changeable_participants = changeable_participants + \
self.project.users.all(:include => { :memberships => [:roles, :project] } ).select{|u| self.visible?(u) }
self.project.users.all(include: { memberships: [:roles, :project] } ).select{|u| self.visible?(u) }
changeable_participants.uniq{|user| user.id}
end
@ -151,7 +151,7 @@ class Meeting < ActiveRecord::Base
def close_agenda_and_copy_to_minutes!
self.agenda.lock!
self.create_minutes(:text => agenda.text, :comment => "Minutes created")
self.create_minutes(text: agenda.text, comment: "Minutes created")
end
alias :original_participants_attributes= :participants_attributes=

@ -21,11 +21,11 @@
class MeetingContent < ActiveRecord::Base
belongs_to :meeting
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
attr_accessor :comment
validates_length_of :comment, :maximum => 255, :allow_nil => true
validates_length_of :comment, maximum: 255, allow_nil: true
attr_accessible :text, :lock_version, :comment
@ -34,7 +34,7 @@ class MeetingContent < ActiveRecord::Base
acts_as_journalized
acts_as_event type: Proc.new {|o| "#{o.class.to_s.underscore.dasherize}"},
title: Proc.new {|o| "#{o.class.model_name.human}: #{o.meeting.title}"},
url: Proc.new {|o| {:controller => '/meetings', :action => 'show', :id => o.meeting}}
url: Proc.new {|o| {controller: '/meetings', action: 'show', id: o.meeting}}
User.before_destroy do |user|
MeetingContent.update_all ['author_id = ?', DeletedUser.first], ['author_id = ?', user.id]
@ -58,7 +58,7 @@ class MeetingContent < ActiveRecord::Base
def at_version(version)
journals
.joins("JOIN meeting_contents ON meeting_contents.id = journals.journable_id AND meeting_contents.type='#{self.class.to_s}'")
.where(:version => version)
.where(version: version)
.first.data
end

@ -23,8 +23,8 @@ class MeetingParticipant < ActiveRecord::Base
belongs_to :meeting
belongs_to :user
scope :invited, :conditions => {:invited => true}
scope :attended, :conditions => {:attended => true}
scope :invited, conditions: {invited: true}
scope :attended, conditions: {attended: true}
attr_accessible :email, :name, :invited, :attended, :user, :user_id, :meeting

@ -29,7 +29,7 @@ end
Given /^there is (\d+) [Mm]eetings? in project "(.+)" that start (.*) days? from now with:$/ do |count,project,time,table|
count.to_i.times do
m = FactoryGirl.build(:meeting, :start_time => Time.now + time.to_i.days)
m = FactoryGirl.build(:meeting, start_time: Time.now + time.to_i.days)
m.project = Project.find_by_name(project)
send_table_to_object(m, table)
end
@ -37,7 +37,7 @@ end
Given /^the [Mm]eeting "(.+)" has 1 agenda with:$/ do |meeting,table|
m = Meeting.find_by_title(meeting)
ma = MeetingAgenda.find_by_meeting_id(m.id) || FactoryGirl.build(:meeting_agenda, :meeting => m)
ma = MeetingAgenda.find_by_meeting_id(m.id) || FactoryGirl.build(:meeting_agenda, meeting: m)
send_table_to_object(ma, table)
end
@ -49,20 +49,20 @@ end
Given /^the [Mm]eeting "(.+)" has minutes with:$/ do |meeting,table|
m = Meeting.find_by_title(meeting)
mm = MeetingMinutes.find_by_meeting_id(m.id) || FactoryGirl.build(:meeting_minutes, :meeting => m)
mm = MeetingMinutes.find_by_meeting_id(m.id) || FactoryGirl.build(:meeting_minutes, meeting: m)
send_table_to_object(mm, table)
end
Given /^"(.+)" is invited to the [Mm]eeting "(.+)"$/ do |user,meeting|
m = Meeting.find_by_title(meeting)
p = m.participants.detect{|p| p.user_id = User.find_by_login(user).id} || FactoryGirl.build(:meeting_participant, :meeting => m)
p = m.participants.detect{|p| p.user_id = User.find_by_login(user).id} || FactoryGirl.build(:meeting_participant, meeting: m)
p.invited = true
p.save
end
Given /^"(.+)" attended the [Mm]eeting "(.+)"$/ do |user,meeting|
m = Meeting.find_by_title(meeting)
p = m.participants.detect{|p| p.user_id = User.find_by_login(user).id} || FactoryGirl.build(:meeting_participant, :meeting => m)
p = m.participants.detect{|p| p.user_id = User.find_by_login(user).id} || FactoryGirl.build(:meeting_participant, meeting: m)
p.attended = true
p.save
end

@ -27,35 +27,35 @@ module OpenProject::Meeting
include OpenProject::Plugins::ActsAsOpEngine
register 'openproject-meeting',
:author_url => 'http://finn.de',
:requires_openproject => '>= 4.0.0' do
author_url: 'http://finn.de',
requires_openproject: '>= 4.0.0' do
project_module :meetings do
permission :create_meetings, {:meetings => [:new, :create, :copy]}, :require => :member
permission :edit_meetings, {:meetings => [:edit, :update]}, :require => :member
permission :delete_meetings, {:meetings => [:destroy]}, :require => :member
permission :view_meetings, {:meetings => [:index, :show], :meeting_agendas => [:history, :show, :diff], :meeting_minutes => [:history, :show, :diff]}
permission :create_meeting_agendas, {:meeting_agendas => [:update, :preview]}, :require => :member
permission :close_meeting_agendas, {:meeting_agendas => [:close, :open]}, :require => :member
permission :send_meeting_agendas_notification, {:meeting_agendas => [:notify]}, :require => :member
permission :create_meeting_minutes, {:meeting_minutes => [:update, :preview]}, :require => :member
permission :send_meeting_minutes_notification, {:meeting_minutes => [:notify]}, :require => :member
permission :create_meetings, {meetings: [:new, :create, :copy]}, require: :member
permission :edit_meetings, {meetings: [:edit, :update]}, require: :member
permission :delete_meetings, {meetings: [:destroy]}, require: :member
permission :view_meetings, {meetings: [:index, :show], meeting_agendas: [:history, :show, :diff], meeting_minutes: [:history, :show, :diff]}
permission :create_meeting_agendas, {meeting_agendas: [:update, :preview]}, require: :member
permission :close_meeting_agendas, {meeting_agendas: [:close, :open]}, require: :member
permission :send_meeting_agendas_notification, {meeting_agendas: [:notify]}, require: :member
permission :create_meeting_minutes, {meeting_minutes: [:update, :preview]}, require: :member
permission :send_meeting_minutes_notification, {meeting_minutes: [:notify]}, require: :member
end
Redmine::Search.map do |search|
search.register :meetings
end
menu :project_menu, :meetings, {:controller => '/meetings', :action => 'index'},
:caption => :project_module_meetings,
:param => :project_id,
:after => :wiki,
:html => {:class => 'icon2 icon-quote' }
menu :project_menu, :new_meeting, {:controller => '/meetings', :action => 'new'},
:param => :project_id,
:caption => :label_meeting_new,
:parent => :meetings,
:html => {:class => 'icon2 icon-add' }
menu :project_menu, :meetings, {controller: '/meetings', action: 'index'},
caption: :project_module_meetings,
param: :project_id,
after: :wiki,
html: {class: 'icon2 icon-quote' }
menu :project_menu, :new_meeting, {controller: '/meetings', action: 'new'},
param: :project_id,
caption: :label_meeting_new,
parent: :meetings,
html: {class: 'icon2 icon-add' }
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable "meeting_minutes"

@ -23,7 +23,7 @@ module OpenProject::Meeting
module ProjectPatch
def self.included(receiver)
receiver.class_eval do
has_many :meetings, :include => [:author], :dependent => :destroy
has_many :meetings, include: [:author], dependent: :destroy
end
end
end

@ -20,7 +20,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe MeetingAgendasController, :type => :controller do
describe MeetingAgendasController, type: :controller do
let(:meeting) { FactoryGirl.create(:meeting) }
let(:user) { FactoryGirl.create(:admin) }

@ -20,7 +20,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe MeetingMinutesController, :type => :controller do
describe MeetingMinutesController, type: :controller do
let(:meeting) { FactoryGirl.create(:meeting) }
let(:user) { FactoryGirl.create(:admin) }

@ -20,7 +20,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe MeetingsController, :type => :controller do
describe MeetingsController, type: :controller do
before(:each) do
@p = mock_model(Project)
allow(@controller).to receive(:authorize)
@ -42,7 +42,7 @@ describe MeetingsController, :type => :controller do
end
describe "html" do
before(:each) do
get "index", :project_id => @p.id
get "index", project_id: @p.id
end
it {expect(response).to be_success}
it {expect(assigns(:meetings_by_start_year_month_date)).to eql @grouped }
@ -58,7 +58,7 @@ describe MeetingsController, :type => :controller do
end
describe "html" do
before(:each) do
get "show", :id => @m.id
get "show", id: @m.id
end
it {expect(response).to be_success}
end
@ -74,7 +74,7 @@ describe MeetingsController, :type => :controller do
end
describe "html" do
before(:each) do
get "new", :project_id => @p.id
get "new", project_id: @p.id
end
it {expect(response).to be_success}
it {expect(assigns(:meeting)).to eql @m}
@ -89,7 +89,7 @@ describe MeetingsController, :type => :controller do
end
describe "html" do
before(:each) do
get "edit", :id => @m.id
get "edit", id: @m.id
end
it {expect(response).to be_success}
it {expect(assigns(:meeting)).to eql @m}

@ -19,6 +19,6 @@
#++
FactoryGirl.define do
factory :journal_meeting_content_journal, :class => Journal::MeetingContentJournal do
factory :journal_meeting_content_journal, class: Journal::MeetingContentJournal do
end
end

@ -20,7 +20,7 @@
FactoryGirl.define do
factory :meeting do |m|
author :factory => :user
author factory: :user
project
m.sequence(:title) { |n| "Meeting #{n}" }
end

@ -20,7 +20,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe MeetingMailer, :type => :mailer do
describe MeetingMailer, type: :mailer do
let(:role) { FactoryGirl.create(:role, permissions: [:view_meetings]) }
let(:project) { FactoryGirl.create(:project) }
let(:author) { FactoryGirl.create(:user, member_in_project: project, member_through_role: role) }

@ -20,9 +20,9 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe "MeetingAgenda", :type => :model do
describe "MeetingAgenda", type: :model do
before(:each) do
@a = FactoryGirl.build :meeting_agenda, :text => "Some content...\n\nMore content!\n\nExtraordinary content!!"
@a = FactoryGirl.build :meeting_agenda, text: "Some content...\n\nMore content!\n\nExtraordinary content!!"
end
# TODO: Test the right user and messages are set in the history

@ -22,7 +22,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
require 'journal/meeting_content_journal'
describe Journal, :type => :model do
describe Journal, type: :model do
include PluginSpecHelper
let(:journal) { FactoryGirl.build(:meeting_content_journal) }

@ -20,7 +20,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe "MeetingMinutes", :type => :model do
describe "MeetingMinutes", type: :model do
before do
@min = FactoryGirl.build :meeting_minutes
end

@ -20,7 +20,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe Meeting, :type => :model do
describe Meeting, type: :model do
it {is_expected.to belong_to :project}
it {is_expected.to belong_to :author}
it {is_expected.to validate_presence_of :title}
@ -30,16 +30,16 @@ describe Meeting, :type => :model do
let(:project) { FactoryGirl.create(:project) }
let(:user1) { FactoryGirl.create(:user) }
let(:user2) { FactoryGirl.create(:user) }
let(:meeting) { FactoryGirl.create(:meeting, :project => project, :author => user1) }
let(:meeting) { FactoryGirl.create(:meeting, project: project, author: user1) }
let(:agenda) do
meeting.create_agenda :text => "Meeting Agenda text"
meeting.create_agenda text: "Meeting Agenda text"
meeting.agenda(true) # avoiding stale object errors
end
let(:role) { FactoryGirl.create(:role, :permissions => [:view_meetings]) }
let(:role) { FactoryGirl.create(:role, permissions: [:view_meetings]) }
before do
@m = FactoryGirl.build :meeting, :title => "dingens"
@m = FactoryGirl.build :meeting, title: "dingens"
end
describe "to_s" do
@ -69,12 +69,12 @@ describe Meeting, :type => :model do
describe "Journalized Objects" do
before(:each) do
@project ||= FactoryGirl.create(:project_with_types)
@current = FactoryGirl.create(:user, :login => "user1", :mail => "user1@users.com")
@current = FactoryGirl.create(:user, login: "user1", mail: "user1@users.com")
allow(User).to receive(:current).and_return(@current)
end
it 'should work with meeting' do
@meeting ||= FactoryGirl.create(:meeting, :title => "Test", :project => @project, :author => @current)
@meeting ||= FactoryGirl.create(:meeting, title: "Test", project: @project, author: @current)
initial_journal = @meeting.journals.first
recreated_journal = @meeting.recreate_initial_journal!
@ -95,7 +95,7 @@ describe Meeting, :type => :model do
end
describe "WITH a user not having the view_meetings permission" do
let(:role2) { FactoryGirl.create(:role, :permissions => []) }
let(:role2) { FactoryGirl.create(:role, permissions: []) }
before do
# adding both users so that the author is valid
@ -129,7 +129,7 @@ describe Meeting, :type => :model do
project.save!
meeting.participants.build(:user => user2)
meeting.participants.build(user: user2)
meeting.save!
end
@ -160,7 +160,7 @@ describe Meeting, :type => :model do
project.save!
meeting.start_time = DateTime.new(2013,3,27,15,35)
meeting.participants.build(:user => user2)
meeting.participants.build(user: user2)
meeting.save!
end
@ -175,7 +175,7 @@ describe Meeting, :type => :model do
end
it "should set the author to the provided author if one is given" do
copy = meeting.copy :author => user2
copy = meeting.copy author: user2
expect(copy.author).to eq(user2)
end

@ -20,7 +20,7 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe User, "#destroy", :type => :model do
describe User, "#destroy", type: :model do
let(:user) { FactoryGirl.create(:user) }
let(:user2) { FactoryGirl.create(:user) }
let(:substitute_user) { DeletedUser.first }
@ -29,12 +29,12 @@ describe User, "#destroy", :type => :model do
project
end
let(:meeting) { FactoryGirl.create(:meeting, :project => project,
:author => user2) }
let(:participant) { FactoryGirl.create(:meeting_participant, :user => user,
:meeting => meeting,
:invited => true,
:attended => true) }
let(:meeting) { FactoryGirl.create(:meeting, project: project,
author: user2) }
let(:participant) { FactoryGirl.create(:meeting_participant, user: user,
meeting: meeting,
invited: true,
attended: true) }
before do
user
@ -122,7 +122,7 @@ describe User, "#destroy", :type => :model do
describe "WHEN the user created a meeting" do
let(:associations) { [:author] }
let(:associated_instance) { FactoryGirl.build(:meeting, :project => project) }
let(:associated_instance) { FactoryGirl.build(:meeting, project: project) }
let(:associated_class) { Meeting }
it_should_behave_like "created journalized associated object"
@ -130,7 +130,7 @@ describe User, "#destroy", :type => :model do
describe "WHEN the user updated a meeting" do
let(:associations) { [:author] }
let(:associated_instance) { FactoryGirl.build(:meeting, :project => project) }
let(:associated_instance) { FactoryGirl.build(:meeting, project: project) }
let(:associated_class) { Meeting }
it_should_behave_like "updated journalized associated object"
@ -138,8 +138,8 @@ describe User, "#destroy", :type => :model do
describe "WHEN the user created a meeting agenda" do
let(:associations) { [:author] }
let(:associated_instance) { FactoryGirl.build(:meeting_agenda, :meeting => meeting,
:text => "lorem")}
let(:associated_instance) { FactoryGirl.build(:meeting_agenda, meeting: meeting,
text: "lorem")}
let(:associated_class) { MeetingAgenda }
it_should_behave_like "created journalized associated object"
@ -147,8 +147,8 @@ describe User, "#destroy", :type => :model do
describe "WHEN the user updated a meeting agenda" do
let(:associations) { [:author] }
let(:associated_instance) { FactoryGirl.build(:meeting_agenda, :meeting => meeting,
:text => "lorem")}
let(:associated_instance) { FactoryGirl.build(:meeting_agenda, meeting: meeting,
text: "lorem")}
let(:associated_class) { MeetingAgenda }
it_should_behave_like "updated journalized associated object"
@ -156,8 +156,8 @@ describe User, "#destroy", :type => :model do
describe "WHEN the user created a meeting minutes" do
let(:associations) { [:author] }
let(:associated_instance) { FactoryGirl.build(:meeting_minutes, :meeting => meeting,
:text => "lorem")}
let(:associated_instance) { FactoryGirl.build(:meeting_minutes, meeting: meeting,
text: "lorem")}
let(:associated_class) { MeetingMinutes }
it_should_behave_like "created journalized associated object"
@ -165,8 +165,8 @@ describe User, "#destroy", :type => :model do
describe "WHEN the user updated a meeting minutes" do
let(:associations) { [:author] }
let(:associated_instance) { FactoryGirl.build(:meeting_minutes, :meeting => meeting,
:text => "lorem")}
let(:associated_instance) { FactoryGirl.build(:meeting_minutes, meeting: meeting,
text: "lorem")}
let(:associated_class) { MeetingMinutes }
it_should_behave_like "updated journalized associated object"

@ -28,7 +28,7 @@
require 'spec_helper'
describe 'preview', :type => :routing do
describe 'preview', type: :routing do
it "should connect POST /meetings/:meeting_id/agenda/preview to meeting_agendas#preview" do
expect(post("/meetings/1/agenda/preview")).to route_to(controller: 'meeting_agendas',
meeting_id: '1',

@ -22,7 +22,7 @@ module PluginSpecHelper
shared_examples_for "customized journal class" do
describe :save do
let(:text) { "Lorem ipsum" }
let(:changed_data) { { :text => [nil, text] } }
let(:changed_data) { { text: [nil, text] } }
describe "WITHOUT compression" do
before do

Loading…
Cancel
Save