@ -18,7 +18,7 @@ describe MeetingsController do
end
end
describe " html " do
describe " html " do
before ( :each ) do
before ( :each ) do
get " index "
get " index " , :project_id = > @p . id
end
end
it { response . should be_success }
it { response . should be_success }
it { assigns ( :meetings_by_start_year_month_date ) . should eql @ms }
it { assigns ( :meetings_by_start_year_month_date ) . should eql @ms }
@ -34,7 +34,7 @@ describe MeetingsController do
end
end
describe " html " do
describe " html " do
before ( :each ) do
before ( :each ) do
get " show "
get " show " , :id = > @m . id
end
end
it { response . should be_success }
it { response . should be_success }
end
end
@ -50,7 +50,7 @@ describe MeetingsController do
end
end
describe " html " do
describe " html " do
before ( :each ) do
before ( :each ) do
get " new "
get " new " , :project_id = > @p . id
end
end
it { response . should be_success }
it { response . should be_success }
it { assigns ( :meeting ) . should eql @m }
it { assigns ( :meeting ) . should eql @m }
@ -59,39 +59,35 @@ describe MeetingsController do
describe " new with copy " do
describe " new with copy " do
before ( :each ) do
before ( :each ) do
Project . stub! ( :find ) . and_return ( @p )
Project . stub! ( :find ) . with ( @p . id . to_s ) . and_return ( @p )
@m = mock_model ( Meeting )
end
@m . stub! ( :project = )
describe " with a valid meeting ID " do
@m . stub! ( :author = )
before ( :each ) do
Meeting . stub! ( :new ) . and_return ( @m )
@mc = FactoryGirl . create ( :meeting , " duration " = > 1 . 5 , " location " = > " Raum 4 " , " title " = > " dingens " , " updated_at " = > Time . parse ( " Thu Feb 17 11:33:22 +0100 2011 " ) , :start_time = > Time . parse ( " Fri Feb 18 14:36:25 +0100 2011 " ) )
@participants = [ FactoryGirl . create ( :meeting_participant , :meeting = > @mc ) ]
end
describe " html " do
before ( :each ) do
get " new " , :project_id = > @p . id , :copy_from_id = > @mc . id
end
it { response . should be_success }
it { assigns ( :meeting ) . title . should eql " dingens " }
it { assigns ( :meeting ) . duration . should eql 1 . 5 }
it { assigns ( :meeting ) . location . should eql " Raum 4 " }
it { assigns ( :meeting ) . start_time . should eql ( Date . tomorrow + 10 . hours ) }
it { assigns ( :meeting ) . participants . should eql @participants }
end
end
end
#describe "with a valid meeting ID" do
# before(:each) do
# @mc = mock_model(Meeting)
# Meeting.stub!(:find).and_return(@mc)
# @mc.stub!(:attributes).and_return({"duration"=>1.5, "location"=>"Raum 4", "title"=>"dingens", "updated_at"=>Time.parse("Thu Feb 17 11:33:22 +0100 2011")})
# @mc.stub!(:start_time).and_return(Time.parse("Fri Feb 18 14:36:25 +0100 2011"))
# @mc.stub!(:participants).and_return([mock_model(MeetingParticipant), mock_model(MeetingParticipant), mock_model(MeetingParticipant)])
# end
# describe "html" do
# before(:each) do
# get "new", :copy_from_id => 1
# end
# it {pending; response.should be_success}
# it {pending; assigns(:meeting).should eql @m}
# it {pending} # TODO: testen ob das richtig kopiert wird
# end
#end
describe " with an invalid meeting ID " do
describe " with an invalid meeting ID " do
before ( :each ) do
before ( :each ) do
Meeting . stub! ( :find ) . and_raise ( ActiveRecord :: RecordNotFound )
Meeting . delete_all
end
end
describe " html " do
describe " html " do
before ( :each ) do
before ( :each ) do
get " new " , :copy_from_id = > 1
get " new " , :project_id = > @p . id , :copy_from_id = > 42
end
end
it { response . should be_success }
it { response . should be_success }
it { assigns ( :meeting ) . should eql @m }
it { assigns ( :meeting ) . should be_kind_of Meeting }
end
end
end
end
end
end
@ -104,7 +100,7 @@ describe MeetingsController do
end
end
describe " html " do
describe " html " do
before ( :each ) do
before ( :each ) do
get " edit "
get " edit " , :id = > @m . id
end
end
it { response . should be_success }
it { response . should be_success }
it { assigns ( :meeting ) . should eql @m }
it { assigns ( :meeting ) . should eql @m }