Displaying 20 results from an estimated 400 matches similar to: "Problem in testing with separate validation of :attachment_file_name"
2009 Sep 03
12
paperclip is not saving the files
Hi all,
I''ve installed paperclips but
paperclip is not saving the files
my model has
has_attached_file :attachment,:styles => { :medium => "300x300>",
:thumb => "100x100>" }
and i have db migration as
class AddAttachmentToPolicies < ActiveRecord::Migration
def self.up
add_column :policies,
2007 May 05
10
have_one and have_present
>Comment By: Luis Lavena (luislavena)
> Date: 2007-05-04 23:37
> describe "An Asset" do
> before(:each) do
> @asset = Asset.new
> end
>
> it { @asset.should have_one(:attachment) }
> it { @asset.should have_present(:something) }
> end
Food for thought on these. I like have_one a lot. It speaks to me as a
Rails developer and I think it speaks to
2012 Aug 09
2
validate_format_of message
I have validates_format_of :name, :with => *my regex*, :message => "That''s wrong"
The validation works but the message does not get displayed when the user enters invalid data.
Does anyone have any ideas how to fix it?
Thanks.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send
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 =>
2009 Aug 07
2
paperclip model fails while when updating with no attachment
Hi all,
I have paperclip running in my rails environment. I setup a new model
just for paperclip called Assets so that I could upload multiple files
per item (even though I''m only using 1 attachment per item at the
moment). Everything works except for the following:
Updating an item record with no attachment in the form but having
PREVIOUSLY attached an asset while creating or updating.
2014 Feb 18
0
How to Test Multimodel Paperclip attachments?
I'm using Rspec and FactoryGirl to create specs for multimodel paperclip
attachments. From searching other questions, it seems like a single
image attachment is more common.
Car.rb
class Car < ActiveRecord::Base
has_many :uploads, dependent: :destroy
validates :uploads, presence: { message: 'You must upload at least
one image' }
2009 Jun 07
6
Missing Template when testing with the Brain Buster Captcha partial
When I run my functional tests, they throw an error with the following
message:
ActionView::TemplateError: Missing template /_captcha.erb in view path
app/views:test/vendor/plugins/brain_buster/views/brain_busters
On line #23 of app/views/contacts/_form.html.erb
20: <%= f.label :message %><br />
21: <%= f.text_area :message %>
22:
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
2011 Sep 05
0
undefined method `dependent' - rspec and shoulda
hello,
Getting this error when using shoulda and rspec for model tests.
my gemfile
...
gem "shoulda-matchers"
..
spec file
..
it { should have_many(:balances).dependent(:destroy) }
error:
User shoulda validations
Failure/Error: it { should
have_many(:balances).dependent(:destroy) }
NoMethodError:
undefined method `dependent'' for
2011 Oct 15
0
shoulda installation troubles
I cannot manage to have shoulda working.
I''m using rvm with rails 3.1 and ruby 1.9.2
I added
group :test do
gem "shoulda"
end
to the Gemfile, and then run bundle install, thus the gem is installed,
and it is featured in the list running gem list --local.
but whenever I add something like
class ModelTest < Test::Unit::TestCase
should_not
2011 Jul 28
2
RSpec, shoulda-matchers and Rails model attributes validations
I was trying out RSpec framework in a project and got stopped doing the unit
test of a model. In particular, doing the test for the associations and the
ActiveRecord validations.
I started writing the validations but my tests didn''t look DRY at all.
Before refactoring the tests checked out and look for other people
solutions.
I found out shoulda-matchers and Shoulda (which if I
2009 Mar 03
1
shoulda tested better
We''ve made quite a few contributions in our facebooker fork (http://github.com/collectiveidea/facebooker
), but unfortunately, one thing some of our contributions have in
common with many others is the lack of testing. I want to change
that. I''d like to help lead an effort to make the facebooker tests
better.
One thing that I think would help is a little better
2011 Sep 14
1
rspec and should have_many through
Hi,
Anyone can help me with rspec shoulda validations please.
I can''t get the syntax right for these validations. Please correct me
it { should have_one :tradable, :through => :trade_order}
it { should belong_to :source, :polymorphic => true }
it { should have_many :transfers, :as => :source }
this is for Rspec 2, rails 3.1,
gem "rspec-rails"
gem
2012 Dec 04
0
Empty test suite is run after every rake task
When I run rake db:migrate or rake -T I get these lines at the end:
Finished in 0.000276 seconds.
0 tests, 0 assertions, 0 failures, 0 errors
My Gemfile is:
source ''http://rubygems.org''
gem ''rack''
gem ''rails'', ''3.0.9''
gem "acl9", ''0.12.0''
gem "fastercsv"#, :version =>
2011 Jun 30
2
How to play with shoulda with functional testing
Hi,
I am new in rails testing, and now i try to use shoulda to test the
functional section.
can anyone give me some advice, example or recommend tutorial site to
me..
thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To
2010 Jun 20
7
rspec-rails 2.0.0.beta.12 showing undefined method error for route_to
First of all, I''ve been trying to find an answer for this problem all
over the internet without luck.
The thing is that I am using RVM with ruby 1.9.2-head and I created a
new empty gemset. Then I installed bundler gem with:
gem bundler install
That installed the library into the /Users/damselem/.rvm/gems/
ruby-1.9.2-head at rails3/gems directory. Then I went to my rails 3 app
2010 Dec 22
8
Shoulda issue: no more "should have_instance_methods" ?
I''m using Shoulda.
After copying the code here....
.... http://joshuaclayton.github.com/code/2009/07/14/should-act-as-list.html....
into my test_helper file so I can test acts_as_list, I came across
issues. For one I realized I had to get rid of the _ between the
"should" and "have" in past cases, but here, I get this error when I
run my unit test:
2009 Sep 26
3
how to pass value to method in controller
how to pass value to method in controller using button_to_remote
button_to_remote ''check avaliability'',
:url => { :action => ''check_for_unique_login'', :login =>
@user.login}
above code is not working.
--
Posted via http://www.ruby-forum.com/.
2011 May 04
5
rails mongoid
I have a strange problem. Suppose I have a user model with only name
field.
I can add a field with value by creating an instance in mongodb rails
environment.
Example:
class User
include Mongoid::Document
field :name
end
Now in rails console, If you do
user = User.new
user[:name] = "xxxx"
user[:firstname] = "yyyy"
user.save
The record gets created with name and
2006 Feb 20
3
RAILS_ROOT
I just replied to someone about using send_file and while I was testing my solution I
figured out that the controllers "current working dir" appears to be the root of the app.
Then I saw a reply that Ezra sent to someone where he used RAILS_ROOT and I thought "duh,
I''ve seen that before... shoulda used that".
But, when I had an action print out RAILS_ROOT