Nah I had this issue, too... use this
FactoryGirl do
assocation :location, etc. (look it up)
end
On 01/03/2012, at 4:19 PM, S Ahmed wrote:
> I'm trying to use factory for a test case, but the model I am creating via
> the factory depends on another model, how do you setup a factory like thi
>From reading the error and the docs, it sounds like the last one:
select 'Honda', :from => "account[car_type]"
...should work. The one thing I can think of that might keep it from
working would be not being scoped to an area that includes the select box.
Perhaps you could install pry and add bin
Here is the relevant documentation:
http://rdoc.info/github/thoughtbot/factory_girl/file/GETTING_STARTED.md#Associations
Or if it already exists you might try:
FactoryGirl.define :account do
location { Location.where("city = ?", 'Austin').first }
end
(The code in the block just needs to retur
I'm trying to use factory for a test case, but the model I am creating via
the factory depends on another model, how do you setup a factory like this?
Model Account has a location_id attribute (where Location is another model)
So how do I set it?
FactoryGirl. do
location_id /
en
My html looks like:
Acura Honda Ford
Toyota GM
My requests spec looks like:
before do
select '7', :from => "account[car_type]"
fill_in ..
..
end
I get the error message:
Failure/Error: select '7', :from => "account[car_type]"
Capybara::ElementNotFound:
cannot select option
On Feb 29, 2012, at 5:58 AM, Mohamad El-Husseini wrote:
> Sorry, after much frustration, I closed the terminal window and restarted
> everything. The test passed. I have a feeling it might have had something to
> do with Spork or Guard... sorry for the false alarm! I should restart my
> termin
Sorry, after much frustration, I closed the terminal window and restarted
everything. The test passed. I have a feeling it might have had something
to do with Spork or Guard... sorry for the false alarm! I should restart my
terminal more often!
On Wednesday, February 29, 2012 6:18:10 AM UTC-3,
On Feb 28, 2012, at 9:43 PM, Mohamad El-Husseini wrote:
> I ran this scenario in the console and it works as expected. But RSpec keeps
> failing the test and I can't understand why.
>
> describe User do
>
> before do
> @user = User.new(name: "Mickey Mouse", email: "mic...@disney.com",
>
I ran this scenario in the console and it works as expected. But RSpec
keeps failing the test and I can't understand why.
describe User do
before do
@user = User.new(name: "Mickey Mouse", email: "mic...@disney.com",
password: "m1ckey", password_confirmation: "m1ckey")
end
# Passwor