require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe 'fluid_infusion/_uploader.html.erb' do before do view.stubs(:upload_url).returns("/assets/_PID_/file_assets") view.stubs(:container_id).returns('111') end it "should permit locals for container_content_type" do render :partial => "fluid_infusion/uploader", :locals => {:container_content_type=>"foo_bar"} rendered.should have_selector "form.fl-uploader.fl-progEnhance-basic", :action => "/assets/_PID_/file_assets" do with_tag "input#container_content_type", :value => "foo_bar" end end it "should permit locals for uploader html_options" do render :partial => "fluid_infusion/uploader", :locals => {:html_options=>{:uploader_options => {:accept => "application/pdf"}}} rendered.should have_selector "input#Filedata", :type => "file", :accept=>"application/pdf" end it "should work with no locals passed in" do render rendered.should have_selector "form.fl-uploader.fl-progEnhance-basic", :action => "/assets/_PID_/file_assets" do without_tag "input#container_content_type" with_tag "input#Filedata", :type=>"file" do without_tag "[accept=?]" end end end end