diff --git a/app/controllers/meetings_controller.rb b/app/controllers/meetings_controller.rb index 00f60c881c..0cef834018 100644 --- a/app/controllers/meetings_controller.rb +++ b/app/controllers/meetings_controller.rb @@ -64,7 +64,7 @@ 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, :start_time => nil) + @meeting = @meeting.copy(:author => User.current) render :action => 'new', :project_id => @project end diff --git a/features/meetings_copy.feature b/features/meetings_copy.feature index 0f27a8b5d9..edd9909d16 100644 --- a/features/meetings_copy.feature +++ b/features/meetings_copy.feature @@ -20,9 +20,10 @@ Feature: Copy meetings And there is a role "user" And the user "alice" is a "user" in the project "dingens" And there is 1 meeting in project "dingens" created by "alice" with: - | title | Alices Meeting | - | location | CZI | - | duration | 1.5 | + | title | Alices Meeting | + | location | CZI | + | duration | 1.5 | + | start_time | 2013-03-27 18:55:00 | Scenario: Navigate to a meeting page with permission to create meetings Given the role "user" may have the following rights: @@ -44,6 +45,9 @@ Feature: Copy meetings Then the "meeting[title]" field should contain "Alices Meeting" And the "meeting[location]" field should contain "CZI" And the "meeting[duration]" field should contain "1.5" + And the "meeting[start_date]" field should contain "2013-03-27" + And the "meeting[start_time(4i)]" field should contain "18" + And the "meeting[start_time(5i)]" field should contain "55" #And no participant should be selected as attendee #And only invited participants should be selected as invitees diff --git a/spec/models/meeting_spec.rb b/spec/models/meeting_spec.rb index 67c406419f..9a78e6011f 100644 --- a/spec/models/meeting_spec.rb +++ b/spec/models/meeting_spec.rb @@ -121,4 +121,37 @@ describe Meeting do meeting.agenda.locked?.should be_true end end + + describe "Copied meetings" do + before do + project.add_member user1, [role] + project.add_member user2, [role] + + project.save! + + meeting.start_time = DateTime.new(2013,3,27,15,35) + meeting.participants.build(:user => user2) + meeting.save! + end + + it "should have the same start_time as the original meeting" do + copy = meeting.copy({}) + copy.start_time.should == meeting.start_time + end + + it "should delete the copied meeting author if no author is given as parameter" do + copy = meeting.copy({}) + copy.author.should be_nil + end + + it "should set the author to the provided author if one is given" do + copy = meeting.copy :author => user2 + copy.author.should == user2 + end + + it "should clear participant ids and attended flags for all copied attendees" do + copy = meeting.copy({}) + copy.participants.all?{ |p| p.id.nil? && !p.attended }.should be_true + end + end end