parsley/spec/models/ingredient_spec.rb
Dan Elbert 3b4134f684 units
2016-01-14 15:22:15 -06:00

27 lines
442 B
Ruby

require 'rails_helper'
RSpec.describe Ingredient, type: :model do
describe 'validation' do
it 'validates density' do
i = build(:ingredient)
expect(i).to be_valid
i.density = '5'
expect(i).not_to be_valid
i.density = '5 cup'
expect(i).not_to be_valid
i.density = '5 gram/cup'
expect(i).to be_valid
i.density = '5 mile/hour'
expect(i).not_to be_valid
end
end
end