menu and menu_category

This commit is contained in:
Min Zeya Phyo
2017-03-27 22:09:16 +06:30
parent 75db4dbc26
commit 40423c12d3
18 changed files with 144 additions and 9 deletions

View File

@@ -0,0 +1,7 @@
require 'rails_helper'
RSpec.describe MenuCategory, type: :model do
it { should validate_presence_of(:name) }
it { should belong_to(:menu) }
end

12
spec/models/menu_spec.rb Normal file
View File

@@ -0,0 +1,12 @@
require 'rails_helper'
RSpec.describe Menu, type: :model do
it { should have_many(:menu_categories).dependent(:destroy) }
it { should validate_presence_of(:name) }
it { should validate_presence_of(:is_active) }
it { should validate_presence_of(:valid_days) }
it { should validate_presence_of(:valid_time_from) }
it { should validate_presence_of(:valid_time_to) }
end

10
spec/models/room_spec.rb Normal file
View File

@@ -0,0 +1,10 @@
require 'rails_helper'
RSpec.describe Room, type: :model do
it { should belong_to(:zone) }
it { should validate_presence_of(:name) }
it { should validate_presence_of(:seater) }
it { should validate_presence_of(:is_active) }
end

View File

@@ -4,6 +4,8 @@ RSpec.describe Zone, type: :model do
# Association test
# ensure Todo model has a 1:m relationship with the Item model
it { should have_many(:seat_tables).dependent(:destroy) }
it { should have_many(:rooms).dependent(:destroy) }
# Validation tests
# ensure columns title and created_by are present before saving
it { should validate_presence_of(:name) }