Style upgrades and emberified supplier lists
This commit is contained in:
@@ -7,12 +7,12 @@ end
|
||||
|
||||
step "the user clicks on the order product button :product_name" do |product_name|
|
||||
@last_product = instance_variable_get product_name.underscore.gsub(/\s/, '_').prepend('@')
|
||||
button = find ".order-product-#{@last_product.id}"
|
||||
button = find ".order-product-#{@last_product.id} .add-product-to-list"
|
||||
button.click
|
||||
end
|
||||
|
||||
step "the user clicks on the user order button" do
|
||||
find('#active-order-table .btn-primary').click
|
||||
find('.order-selected-products-button').click
|
||||
sleep 1
|
||||
end
|
||||
|
||||
|
||||
@@ -1,14 +1,36 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe ProductCategory do
|
||||
let(:all_week){ Array.new(7, 1) }
|
||||
let(:show_saturday){ [0,0,0,0,0,0,1] }
|
||||
let(:show_sunday){ [1,0,0,0,0,0,0] }
|
||||
|
||||
describe '#week_days' do
|
||||
let(:product_category) { create :product_category }
|
||||
subject { product_category }
|
||||
let(:default) { Array.new(7, 1) }
|
||||
let(:default) { all_week }
|
||||
its(:week_days) { should == default }
|
||||
it "typecasts strings into integers" do
|
||||
subject.week_days = Array.new(7, "0")
|
||||
subject.week_days.should == Array.new(7, 0)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#for_supplier_in_time' do
|
||||
subject{ described_class }
|
||||
let(:supplier){ create :supplier, time_zone: 'Tijuana', night_offset: 150 }
|
||||
|
||||
it 'works for a normal product category' do
|
||||
c1 = create :product_category, supplier: supplier, name: 'Lunch', full_day: true, week_days: all_week
|
||||
c2 = create :product_category, supplier: supplier, name: 'Happy hour', full_day: false, week_days: all_week, start_from: 1320, end_on: 1380 # from 22 to 23 hour
|
||||
subject.for_supplier_in_time(supplier, Time.now.beginning_of_day + 1300.minutes).should == [c1]
|
||||
subject.for_supplier_in_time(supplier, Time.now.beginning_of_day + 1350.minutes).should == [c1, c2]
|
||||
end
|
||||
|
||||
it 'finds sunday morning products on saturday categories' do
|
||||
c1 = create :product_category, supplier: supplier, name: 'Lunch', full_day: true, week_days: show_saturday
|
||||
c2 = create :product_category, supplier: supplier, name: 'Sunday special', full_day: true, week_days: show_sunday
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Symbol do
|
||||
it 'to_json becomes a string in json format' do
|
||||
:abc.to_json.should == 'abc'
|
||||
end
|
||||
|
||||
it 'as_json becomes a string in json format' do
|
||||
:abc.as_json.should == 'abc'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user