mardi 9 juin 2015

What is the difference between User.make and User.new?

In Capybara docs, it has

describe "the signin process", :type => :feature do
  before :each do
    User.make(:email => 'user@example.com', :password => 'password')
  end    
  it "signs me in" do
    visit '/sessions/new'
    within("#session") do
      fill_in 'Email', :with => 'user@example.com'
      fill_in 'Password', :with => 'password'
    end
    click_button 'Sign in'
    expect(page).to have_content 'Success'
  end
end

My question is what is the difference between User.make and User.create; As from this question: Ruby on Rails - what is make method on a model? User.make is a Machnist gem specific method. Why would Capybara include that in it's docs and not just user User.create, is it vital or really useful with testing specs?

Aucun commentaire:

Enregistrer un commentaire