clarion/spec/models/user_spec.rb

32 lines
957 B
Ruby
Raw Normal View History

2014-07-28 14:15:08 +03:00
require 'rails_helper'
RSpec.describe User do
it 'lets Devise handle email and password validations' do
expect(build(:user)).to be_a Devise::Models::Validatable
end
it "can clone a previous profile for use in a different conference" do
user = create :user
old_conference = create :conference
new_conference = create :conference
old_profile = create :personal_profile, {
user: user,
biography: "Old profile bio",
conference: old_conference
}
expect(user.personal_profile(old_conference)).to eq old_profile
expect(user.personal_profile(new_conference)).to be_nil
new_profile = user.clone_recent_profile(new_conference)
expect(new_profile.biography).to eq old_profile.biography
user.reload
user.personal_profiles << new_profile
expect(user.personal_profile(old_conference)).to eq old_profile
expect(user.personal_profile(new_conference)).to eq new_profile
end
2014-07-28 14:15:08 +03:00
end