I suggest doing those tests in the model, not in the controller. Just
do that fixture thing for the controller spec to pass. But pass the
same thing in the model. Here's a sample of how I do it
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe ProductImage do
before(:all) do
@valid_attributes = {
:uploaded_data => fixture_file_upload("100x100.jpg",'image/jpg'),
:product_id => 1
}
@product_image = ProductImage.create(@valid_attributes)
end
it "should create a new instance given valid attributes" do
ProductImage.create!(@valid_attributes)
end
end
Ramon Tayag
On Thu, Nov 13, 2008 at 7:37 PM, Mano ah <[EMAIL PROTECTED]> wrote:
> Ramon Tayag wrote:
>> You can put that barcode in the spec/fixtures directory. However,
>> you'll need to manually place it there.
>>
>> Ramon Tayag
>
> ok. Also please can i know how to test sending an image using rspec.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users