Re: What is the best modelstructure and routes?

I will look into factory girl (I've seen some things about it but I'm still not confortable with the way of working with it)

You might want to have a look at this https://github.com/thoughtbot/factory_g … STARTED.md

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

So namespace should be the best option I suppose?

Yup smile

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

This factory girl is just not working for me...
Don't kill me if I'm wrong but:

FactoryGirl.define do
  factory :signup_customer do
    id = 2110001
    name = "AVK POLSKA Sp. zo.o."
    email = ""
    address_1 = "ul. Jakubowska 1"
    address_2 = "Pniewy 62-045"
    zipcode = 62
    city = "Pniewy"
    currency = "PLN"
    country_id = "PL"
    contact_person_id = "AZU"
    reset_token = nil
    reset_token_init = nil
  end
end

factories.rb

And:

user = FactoryGirl.save(:signup_customer)
    it "has right data" do
      visit signup_path
      fill_in :id, :with => user.id
      fill_in :name, :with => user.name
      fill_in :email, :with => user.email
      fill_in :email_confirmation, :with => user.email
      click_button "Create account"
      #current_path.should eq(login_path)
      page.should have_content("Success")
    end

customer.spec

Makes that my test won't work at all...

EDIT:
I've created a stackoverflow topic: http://stackoverflow.com/questions/1327 … ng-factory

Last edited by ReBa (2012-11-07 12:17:20)

Re: What is the best modelstructure and routes?

Rather than save try create
user = FactoryGirl.create(:signup_customer)

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

customesr_spec.rb:

require 'spec_helper'


describe "customers" do
  describe "signup" do
    #FactoryGirl.find_definitions
    user = FactoryGirl.create(:signup_customer)
    it "has right data" do
      visit signup_path
      fill_in :id, :with => 2110001
      fill_in :name, :with => "AVK POLSKA Sp. zo.o."
      fill_in :email, :with => "my.email@provider.be"
      fill_in :email_confirmation, :with => "my.email@provider.be"
      click_button "Create account"
      page.should have_content("Fireprotection")
    end
end

factories.rb

FactoryGirl.define do
  factory :signup_customer, class: Customer do
    id = 2110001
    name = "AVK POLSKA Sp. zo.o."
    email = ""
    address_1 = "ul. Jakubowska 1"
    address_2 = "Pniewy 62-045"
    zipcode = 62
    city = "Pniewy"
    currency = "PLN"
    country_id = "PL"
    contact_person_id = "AZU"
    reset_token = nil
    reset_token_init = nil
  end
end

My new error:

Running tests with args ["--drb", "-f", "progress", "-r", "c:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-rspec-2.1.1/lib/guard/rspec/formatter.rb",
 "-f", "Guard::RSpec::Formatter", "--out", "/dev/null", "--failure-exit-code", "2", "spec"]...
  <-- take tuple(1); slave.run...
09:17:40 - ERROR - Guard::RSpec failed to achieve its <start>, exception was:
> [#73C9383A03A6] DRb::DRbUnknownError: ActiveRecord::
> [#73C9383A03A6] c:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1095:in `method_missing'
> [#73C9383A03A6] c:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-rspec-2.1.1/lib/guard/rspec/runner.rb:124:in `run_via_drb'

Re: What is the best modelstructure and routes?

Wow! That's a new one on me.
Haven't a clue on the cause. I'll see if I can find out something on it.

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

Working with 3.2.8 -> could be a bug?

Re: What is the best modelstructure and routes?

Unlikely to be a bug. Possibly an incompatibility issue. I've found nothing on this error. At least you have a solution

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

A solution? What he told in stackoverflow didn't work, although I did something wrong I still get the same errormessage.

Re: What is the best modelstructure and routes?

Sorry, misunderstood your post. It's not solved then?
Just spotted something

"c:/Ruby193/lib/ruby/gems/1.9.1/gems

Can you tell me what version of Ruby you are running? You should be on at least 1.9.2 and prefferably on 1.9.3
Ruby 1.9.1 is known to not be compatible

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

My version of Ruby is:
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

Should have mentioned that I meant that I was working wit rails 3.2.8

Last edited by ReBa (2012-11-08 03:40:38)

Re: What is the best modelstructure and routes?

At what point did thos error start happening? It was working before!

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

ok, can you show me your gemfile

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

I've found the sollution 5 minutes ago smile

In stead of placing

user = FactoryGirl.create(:signup_customer)

I had to:

let(:customer) {FactoryGirl.create(:signedup_customer)}

+ I removed the spork extention. It held it up a little

Last edited by ReBa (2012-11-08 06:35:36)

Re: What is the best modelstructure and routes?

Nice one!
Do your tests now work?

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

Yes and no tongue

I've put a gist online, maybe you could check it.

https://gist.github.com/4037771

The most important part is that it sais:

Error: page.should have_content("Forgot")

The problem is that if you look at it you see the customer sent:

({\"utf8\"=>\"√\", \"customer\"=>{\"id\"=>\"my.email@company.be\", \"name\"=>\"\", \"email\"=>\"\
", \"email_confirmation\"=>\"\"}, \"commit\"=>\"Create account\", \"action\"=>\"create\", \"controller\"=>\"customers\"})

It sets my ID as a password?!

Last edited by ReBa (2012-11-08 12:06:13)

Re: What is the best modelstructure and routes?

What does your rails test.log show?

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

I don't have a test.log file. Where do I find that one?

Re: What is the best modelstructure and routes?

ok, it should be in the logs file where your development.log and your production.log files are
Could you add this line

  save_and_open_page

immedialtely after your last fill_in call then tell me what is showing in your browser?

Last edited by jamesw (2012-11-08 14:14:32)

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)

Re: What is the best modelstructure and routes?

The browser isn't opening at all...