tab/spec/models/client_spec.rb
2015-09-09 20:11:59 +02:00

30 lines
669 B
Ruby

# == Schema Information
#
# Table name: clients
#
# id :integer not null, primary key
# name :string not null
# key :string not null
# created_at :datetime not null
# updated_at :datetime not null
#
require 'rails_helper'
RSpec.describe Client, type: :model do
before :each do
@client = create :client
end
it "should have a valid factory" do
expect(@client).to be_valid
end
it "should generate a key" do
expect(@client.key).to be_present
end
it "should have a unique name" do
client = build :client, name: @client.name
expect(client).to_not be_valid
end
end