Curtis j Schofield wrote:
> On Mon, Jul 12, 2010 at 9:44 AM, Rails Learner <[email protected]>
> wrote:
>> # me error:
>> response.should have_selector( 'input',
>> :type => 'submit',
>> :value => 'Print Form' )
>> response.should be_success
>> end
>>
>> Many Thanks!
>
>
> Please include your controller code for create! :d
>
>
> --
> Make Haste Slowly
Hi Curtis,
I figure out the issue.
My controller has render_to_string that renders a pdf and then it
renders the "_show" partial. Now there is another problem. How I can
test both renders?
Here is the controller code:
def create
@page_title = 'ASQ Enrollment Form'
@child = Child.new(params[:child])
#Convert string to date.
@child.EnrollmentDate = Date.strptime(@child.EnrollmentDate,
'%Y-%m-%d')
#Concatenate the date components and assign the complete date to
ChildDob field
@child.ChildDob = Date.strptime((params[:child]['ChildDob(2i)'] +
'-' + params[:child]['ChildDob(3i)'] + '-' +
params[:child]['ChildDob(1i)']), '%m-%d-%Y') unless
((params[:child]['ChildDob(1i)']).blank? ||
(params[:child]['ChildDob(2i)']).blank? ||
(params[:child]['ChildDob(3i)']).blank?)
respond_to do |format|
if @child.valid?
FormMailer.deliver_enrollment_form(Date.today.strftime("%m-%d-%Y").to_s
+ ' - ASQ Enrollment Form - ' + @child.ChildFirstName + ' ' +
@child.ChildLastName, @child, generate_pdf(@child, false))
flash.now[:notice] = 'ASQ Enrollment form was successfully
submitted'
#format.html { redirect_to(@child, :notice => 'Child was
successfully created.') }
format.html { render :partial => 'show', :locals => { :child =>
@child }, :layout => 'children' }
format.xml { render :xml => @child, :status => :created,
:location => @child }
else
format.html { render :action => 'new' }
format.xml { render :xml => @child.errors, :status =>
:unprocessable_entity }
end
end
end
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users