Displaying 7 results from an estimated 7 matches for "have_one".
Did you mean:
have_zone
2007 May 05
4
autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
...describe "A User (in general)" do
> > before(:each) do
> > @user = User.new
> > end
> >
> > it { @user.should have_many(:contest_public_votes) }
> > it { @user.should have_many(:design_industry_user_interests) }
> > it { @user.should have_one(:user_extension) }
> > end
> >
When I''ve used the autogenerated names, I''ve used specify:
specify { @user.should have_many(:contest_public_votes) }
specify { @user.should have_many(:design_industry_user_interests) }
specify { @user.should have_one(:user_extension) }...
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 a customer as well.
On the flip side, ''have_present'' doesn''t really tell me what...
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 "remarkable_activerecord", "~> 4.0.0.alpha4"...
2007 Jan 15
1
Using One Lookup Table for Multiple Model Properties
I have a model that has two properties that both come from the same
database table.
Let''s say I have a "Lead" model. This Lead has both a contact "State"
(as in Colorado, Arkansas, etc.) and a "Property State" where the house
he''s looking to refinance is located. Both of these should obviously
be objects of the type "state".
2007 May 04
2
Custom Matcher and NAME NOT GENERATED annoyance
...ers to fulfill associations and validations of attributes.
Example:
describe "A User (in general)" do
before(:each) do
@user = User.new
end
it { @user.should have_many(:contest_public_votes) }
it { @user.should have_many(:design_industry_user_interests) }
it { @user.should have_one(:user_extension) }
end
That creates the following descriptions:
A User (in general)
- should has_many contest_public_votes
- should has_many design_industry_user_interests
- should has_one user_extension
A new User
- should not be valid without first_name
- should not be valid without last_name...
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall.
Thanks to Wilson for converting to the new form. I''ve added a few
lines. Basically, it iterates over your model associations and does
two things.
- First, just try to call the association. Usually fixes speeling
erors or other such silliness.
- Second, try to find a record with an :include on the association.
This
2008 Feb 11
1
STI question
Hi,
I am learning Single Table Inheritance and have a question.
In my application, a message may be written by a user or by a guest.
Thus a writer of a message is virtually associated either to a user or a
guest.
class Message < ActiveRecord::Base
end
class UserMessage < Message
belongs_to :writer, :class_name => ''User''
end
class GuestMessage < Message