similar to: How to Test Multimodel Paperclip attachments?

Displaying 20 results from an estimated 300 matches similar to: "How to Test Multimodel Paperclip attachments?"

2012 Jun 08
1
[Rails 3.2.5] Rails: unit test fixture_path : fixture_file_upload cannot find the file ...
I am trying to perform a test unit, using FactoryGirl include ActionDispatch::TestProcess FactoryGirl.define do factory :article do ....... photo { fixture_file_upload ''/files/test.jpg'', ''image/jpg'' } end end IN mt test_helper.rb I defined the fixture_path def fixture_path File.dirname(__FILE__) + "/fixtures/" #
2012 Nov 12
7
RSpec: controller POST create
Rails 3.1.3 rspec-rails (2.11.4) rspec 2.11.1 I am new to rspec. I don''t quite understand tests for POST create part. I have generated scaffold, and simultaneously it generated controller_spec.rb as well. it "assigns a newly created plan as @plan" do post :create, {:plan => valid_attributes}, valid_session assigns(:plan).should be_a(Plan)
2013 Sep 04
2
Speed up image processing of Paperclip in Acceptance Tests
Hi All, I have a question here: How to Speed up image processing of Paperclip in Acceptance Tests When running capybara feature specs I can see lots of Slow factory notices which are populated byfactory_girl. These Slow factory things heavy slow down the feature specs, I think, even feature specs are intrinsic slow specs. Then I had some inspect and found out most of the Slow factory was
2013 Oct 08
1
Trouble with rspec and FactoryGirl Sequence
I''m following Michael Hartl''s Ruby on Rails 3 Tutorial but I''m using Rails 3.2.8 and FactoryGirl 4.2.0 and rspec 2.14.1 I''m in chapter 10 trying to generate tests for pagination (using will_paginate 3.2.5 which works fine in dev) I can get FactoryGirl to test just fine if I don''t use Sequence but I can''t seem to figure out the correct syntax
2012 Nov 08
1
validates_uniqueness_of(*attr_names) w scope not working in unit test
Rails 3.2.8 Very strange , it works in dv mode console , but not in a unit test class User < ActiveRecord::Base belongs_to :subdomain validates_uniqueness_of :email, :scope => :subdomain_id class UserTest < ActiveSupport::TestCase def initialize_user @booboo = FactoryGirl.create(:subdomain, name: "booboo") @coocoo = FactoryGirl.create(:subdomain, name:
2012 Aug 18
2
Paperclip images are not stored in my directory
It is my User.rb model, My images are not stored in my assets directory.. has_attached_file :photo, :styles => { :small => "100x100#", :large => "500x500>", :thumb => "60x60>" }, :url => "/assets/users/:id/:style/:basename.:extension", :path =>
2013 Aug 22
1
How do I deal with ActiveRecord::RecordInvalid: Validation failed:
Hello all, I am currently writing model tests in rails 4. I am attempting to add an error to a reservation object if the total number of reservations for a given date and time has reached a pre-determined limit. When my test runs, it is hitting the appropriate code but it is raising the following error as opposed to just giving me an error in the object that I can use.
2011 Nov 18
1
What does :count actually mean in assert_select?
Hi guys, I tried reading up the RSPEC Book (Dec 2010) and googled a bit but I could not find anything. I''m using Rspec2. Example: spec/factories/categories.rb ====================== FactoryGirl.define do factory :category_intakes, :class => ''category'' do name ''intakes and filters'' description ''airfilters and
2006 May 01
0
Testing File Upload error
I am trying to build some tests where a file is uploaded and than processed by file column. Perhaps I am misunderstanding the new fixture_file_upload that was introduced in 1.1 but I can''t seem to get it to work correctly. I am trying to run a functional test to make sure that a redirect is made to the appropriate page from a create action. I create an issue and the issue can
2007 Apr 24
1
Testing for multipart form uploads
Hi, I''m trying to do integration tests that require uploading files via multipart posts. Have seen a very similar discussion, but cannot get it to work. Maybe, it''s out of date now with Rails 1.2.3: http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/fdfd2c040a2425f4 >From what I understand, fixture_file_upload''s output is translated a String.
2012 Nov 18
3
remarkable activerecord association RSpec
i''m using gem Remarkable activerecord for association. i''ve installed remarkable and remarkable activerecrod both gem. i''ve added both gem in my Gemfile. i''ve added "remarkable_activerecord" as required in spec_helper.rb. describe Authentication do FactoryGirl.build(:authentication).should belong_to(:user)
2013 Jun 18
1
Getting rspec error: Net::SMTPServerBusy: Relay access denied
I''m trying to test registration emails (sent with devise), and I keep getting the error: Net::SMTPServerBusy: 454 4.7.1 <model_spec-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org>: Relay access denied I''m running Rails 3.2.11 with Capybara, and I have (temporarily) chopped my spec_helper.rb and test.rb files down to the bare minimum, still getting the error above.
2013 Feb 28
1
Validation Failed: Userkey has already been taken, Email has already been taken
Hi, I am using Factory girl with rspec and capybara for testing my rails appliction. I have the below code FactoryGirl.define do factory :user do |f| f.email "sss1 at gmail.com" f.userkey "12ssd345q62" end end When I run the test it is failing as "Validation Failed: Userkey has already been taken, Email has already been taken". What could be the reason for
2012 Nov 17
0
How to get more debug information in test log ?
Im one of my unit tests, I got an error I cannot even start looking for the issue as few information are logged ... Using the test console , there is no error at all : > rails console test >> Loading test environment (Rails 3.2.9.rc3) > site1 = FactoryGirl.create(:cms_site, label: "booboo") >> BEGIN .. .. >> but running my tests > unit > ruby -Itest
2014 Jun 09
0
How can I test my controller via rspec for something other than response.should be_success?
1) Right now this is just testing a successful response. However, since I've gone and created a Post via FactoryGirl... how can I test the @post.id equals one of the id's being returned by the get: index json? describe Api::V1::PostsController do context 'Post' do before(:each) do @post = FactoryGirl.create(:post) end context '#index' do
2014 Feb 11
0
Cucumber test question
Hello all, I am trying to understand when I try to run a test in cucumber what I am missing that it is failing. I am using FactoryGirl to create my records and using cucumber to test my logic however I know that I am doing something wrong in my testing I just can't seem to figure out what. Here is what I have: Feature: Feature: All features related to staff info Scenario: notification
2007 Nov 09
9
fixture_file_upload and edge rspec?
Hi all, I had some specs that were using fixture_file_upload that were passing just fine. Then I froze edge rails to get some 2.0 functionality, then a I upgraded to trunk rspec to deal with uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper After a couple other of tribulations, I have now gotten down to just a couple of not passing specs, all using the fixture_file_upload.
2008 Jun 09
10
Testing file attachment with Paperclip
Does someone have an example on faking a file upload for just ensuring it gets called, without actually uploading the file to s3. I thought that stubbing Model.has_attached_file would be enough, but it doesn''t seem so ... This is what I did: Video.stub!( :has_attached_file ).with( :name ).and_return( true ) has_attached_file is from paperclip, it gets mixed to the model. 1)
2009 Nov 10
4
Model spec for file upload with paperclip and fastercsv
I just started my ImportsController and was this was really the way to go: ////////import.rb///////////////// class Import < ActiveRecord::Base has_attached_file :csv validates_attachment_presence :csv after_save :process_csv private def process_csv FasterCSV.foreach( csv.path) do |row| #TODO end end end /////////import_spec.rb///////////////// require
2006 May 01
10
large file storing in postgres sucks?
Hi, I''m not sure if this is a postgres issue or not, but I''m using Postgres 8.1. I have (in my functional tests) the following code: upload = fixture_file_upload(''/files/podcast.mp3'', ''audio/mpeg'') post :create, :product => valid_product, :media => { :image => upload } And then in the controller: blob = Blob.create :data