'kine'
- inflector.singularize('kine'); //=> 'cow'
- ```
-
- Creating an inflector and adding rules later.
-
- ```javascript
- var inflector = Ember.Inflector.inflector;
-
- inflector.pluralize('advice'); // => 'advices'
- inflector.uncountable('advice');
- inflector.pluralize('advice'); // => 'advice'
-
- inflector.pluralize('formula'); // => 'formulas'
- inflector.irregular('formula', 'formulae');
- inflector.pluralize('formula'); // => 'formulae'
-
- // you would not need to add these as they are the default rules
- inflector.plural(/$/, 's');
- inflector.singular(/s$/i, '');
- ```
-
- Creating an inflector with a nondefault ruleset.
-
- ```javascript
- var rules = {
- plurals: [ /$/, 's' ],
- singular: [ /\s$/, '' ],
- irregularPairs: [
- [ 'cow', 'kine' ]
- ],
- uncountable: [ 'fish' ]
- };
-
- var inflector = new Ember.Inflector(rules);
- ```
-
- @class Inflector
- @namespace Ember
- */
- function Inflector(ruleSet) {
- ruleSet = ruleSet || {};
- ruleSet.uncountable = ruleSet.uncountable || {};
- ruleSet.irregularPairs = ruleSet.irregularPairs || {};
-
- var rules = this.rules = {
- plurals: ruleSet.plurals || [],
- singular: ruleSet.singular || [],
- irregular: {},
- irregularInverse: {},
- uncountable: {}
- };
-
- loadUncountable(rules, ruleSet.uncountable);
- loadIrregular(rules, ruleSet.irregularPairs);
- }
-
- Inflector.prototype = {
- /**
- @method plural
- @param {RegExp} regex
- @param {String} string
- */
- plural: function(regex, string) {
- this.rules.plurals.push([regex, string.toLowerCase()]);
- },
-
- /**
- @method singular
- @param {RegExp} regex
- @param {String} string
- */
- singular: function(regex, string) {
- this.rules.singular.push([regex, string.toLowerCase()]);
- },
-
- /**
- @method uncountable
- @param {String} regex
- */
- uncountable: function(string) {
- loadUncountable(this.rules, [string.toLowerCase()]);
- },
-
- /**
- @method irregular
- @param {String} singular
- @param {String} plural
- */
- irregular: function (singular, plural) {
- loadIrregular(this.rules, [[singular, plural]]);
- },
-
- /**
- @method pluralize
- @param {String} word
- */
- pluralize: function(word) {
- return this.inflect(word, this.rules.plurals, this.rules.irregular);
- },
-
- /**
- @method singularize
- @param {String} word
- */
- singularize: function(word) {
- return this.inflect(word, this.rules.singular, this.rules.irregularInverse);
- },
-
- /**
- @protected
-
- @method inflect
- @param {String} word
- @param {Object} typeRules
- @param {Object} irregular
- */
- inflect: function(word, typeRules, irregular) {
- var inflection, substitution, result, lowercase, isBlank,
- isUncountable, isIrregular, isIrregularInverse, rule;
-
- isBlank = BLANK_REGEX.test(word);
-
- if (isBlank) {
- return word;
- }
-
- lowercase = word.toLowerCase();
-
- isUncountable = this.rules.uncountable[lowercase];
-
- if (isUncountable) {
- return word;
- }
-
- isIrregular = irregular && irregular[lowercase];
-
- if (isIrregular) {
- return isIrregular;
- }
-
- for (var i = typeRules.length, min = 0; i > min; i--) {
- inflection = typeRules[i-1];
- rule = inflection[0];
-
- if (rule.test(word)) {
- break;
- }
- }
-
- inflection = inflection || [];
-
- rule = inflection[0];
- substitution = inflection[1];
-
- result = word.replace(rule, substitution);
-
- return result;
- }
- };
-
- __exports__["default"] = Inflector;
- });
-define("ember-inflector/lib/system/string",
- ["./inflector","exports"],
- function(__dependency1__, __exports__) {
- "use strict";
- var Inflector = __dependency1__["default"];
- var pluralize = function(word) {
- return Inflector.inflector.pluralize(word);
- };
-
- var singularize = function(word) {
- return Inflector.inflector.singularize(word);
- };
-
- __exports__.pluralize = pluralize;
- __exports__.singularize = singularize;
- });
-global.DS = requireModule('ember-data/lib/main')['default'];
-}(Ember.lookup));
diff --git a/fig.yml b/fig.yml
index cfaa69df..4ce9b969 100644
--- a/fig.yml
+++ b/fig.yml
@@ -1,7 +1,8 @@
db:
image: bterkuile/couchdb
volumes:
- - db:/usr/local/var/lib/couchdb
+ - db/data:/usr/local/var/lib/couchdb
+ - db/config:/usr/local/etc/couchdb
expose:
- 5984
net: host
diff --git a/spec/acceptance_steps/global_list_steps.rb b/spec/acceptance_steps/global_list_steps.rb
index 1c6e5655..f187302e 100644
--- a/spec/acceptance_steps/global_list_steps.rb
+++ b/spec/acceptance_steps/global_list_steps.rb
@@ -20,5 +20,5 @@ step 'a new order on a table in another section is created' do
# @new_section = create :section, title: 'Terrace', supplier: @supplier
# @new_table = create :table, number: 59, section: @new_section, supplier: @supplier
@new_list = create :list, section: @other_section, table: @other_table, supplier: @supplier, user_ids: [@user.id]
- @new_order = @new_list.place_order(products: {@product.id => 3}, user: @user)
+ @new_order = @new_list.place_order(product_orders: [ {'product_id' => @product.id, 'quantity' => 3}], user: @user)
end
diff --git a/spec/acceptance_steps/global_order_steps.rb b/spec/acceptance_steps/global_order_steps.rb
index 0a39e2b4..e6e18193 100644
--- a/spec/acceptance_steps/global_order_steps.rb
+++ b/spec/acceptance_steps/global_order_steps.rb
@@ -1,7 +1,7 @@
step "A new order is placed" do
@user ||= create :user
@list = create :list, state: 'active', supplier: @supplier, table: @table, section: @section, user_ids: [@user.id]
- @order = @list.place_order products: {@product.id => 2}, user: @user
+ @order = @list.place_order product_orders: [{ 'product_id' => @product.id, 'quantity' => 2}], user: @user
end
step "an order with :quantity products :product_name should have been created" do |quantity, product_name|
diff --git a/spec/acceptance_steps/order_steps.rb b/spec/acceptance_steps/order_steps.rb
index ab35449f..e0b78e58 100644
--- a/spec/acceptance_steps/order_steps.rb
+++ b/spec/acceptance_steps/order_steps.rb
@@ -9,7 +9,7 @@ step "the order should be marked as delivered" do
end
step "another order is placed" do
- @new_order = @list.place_order(products: {@product.id => 5}, user: @user)
+ @new_order = @list.place_order(product_orders: [{ 'product_id' => @product.id, 'quantity' => 5}], user: @user)
end
step "the user order should be created as a new order" do
diff --git a/spec/acceptance_steps/users/order_products_steps.rb b/spec/acceptance_steps/users/order_products_steps.rb
index 145bf9cb..ba0c1675 100644
--- a/spec/acceptance_steps/users/order_products_steps.rb
+++ b/spec/acceptance_steps/users/order_products_steps.rb
@@ -43,7 +43,7 @@ step "there is another signed in user on the same list" do
end
step 'the other user orders a product :count times' do |count|
- @list.place_order products: {@product.id => count.to_i}, user: @other_user
+ @list.place_order product_orders: [{'product_id' => @product.id, 'quantity' => count.to_i}], user: @other_user
end
step 'the other user is part of the list' do
diff --git a/spec/factories/list_payment.rb b/spec/factories/list_payment.rb
new file mode 100644
index 00000000..f1458303
--- /dev/null
+++ b/spec/factories/list_payment.rb
@@ -0,0 +1,5 @@
+FactoryGirl.define do
+ factory :list_payment do
+
+ end
+end
diff --git a/spec/fixtures/pages/about.html b/spec/fixtures/pages/about.html
new file mode 100644
index 00000000..4652058f
--- /dev/null
+++ b/spec/fixtures/pages/about.html
@@ -0,0 +1,7 @@
+Logo-bigMozo.bar is een systeem om bestellingen te doen met je smartphone. Als je wel eens op een terras of een afgelegen deel van een horeca gelegenheid hebt gezeten en vond dat het te lang duurde voordat er iemand aan je kwam vragen wat je wil bestellen dan weet je dat er nog veel te verbeteren is.
+
+Om horeca gelegenheden te helpen de vraag van klanten beter te kunnen verwerken is mozo.bar ontstaan. Mozo.bar is een toevoeging voor horeca gelegenheden om klanten met hun smartphone te laten bestellen. Dit is de focus van Mozo.bar! Om het gemak en de sfeer waar mensen aan gewend zijn te handhaven integreert Mozo.bar zo goed mogelijk met de ervaring van mensen. Klanten kunnen gewoon op een lijstje bestellen en bij ondersteunde systemen komt de bestelling gewoon achter de bar of in de keuken uitgeprint.
+
+Mozo.bar is gratis om in gebruik te nemen en in een handomdraai toegevoegd als extra dienst. Maak als horeca gelegenheid een account aan. Richt deze in en je kan aan de slag!
+
+Heb je een ervaring of idee waardoor we de ervaring voor zowel de horeca bezoeker als de horeca gelegenheid kunnen verbeteren mail dit dan naar: experience@mozo.bar dan kunnen wij ervoor zorgen dat het gaan naar een horeca gelegenheid leuk en makkelijk wordt!
diff --git a/spec/fixtures/pages/home.html b/spec/fixtures/pages/home.html
new file mode 100644
index 00000000..2349c2bf
--- /dev/null
+++ b/spec/fixtures/pages/home.html
@@ -0,0 +1,4 @@
+
+
Welkom bij de mozo.bar website! Mozo.bar is een mobiele app waarmee je gemakkelijk bestellingen kan doen op terrassen, in bars of restaurants. Scan een Qr code op de tafel, en krijg meteen het menu te zien. Klik aan wat je wilt hebben en bestel. Dat is alles!
+Momenteel is mozo.bar in de ontwikkelingsfase. Dit houdt in dat er nog veel moet gebeuren en dat we volledig open staan voor alle input die we kunnen krijgen. Onze missie is om zowel klant als kroegeigenaar blij te maken met de mogelijkheden die deze tijd ons biedt.
+Schrijf je in op Facebook of Twitter om op de hoogte te worden gehouden.
diff --git a/spec/javascript/models/product_test.coffee b/spec/javascript/models/product_test.coffee
new file mode 100644
index 00000000..71f96110
--- /dev/null
+++ b/spec/javascript/models/product_test.coffee
@@ -0,0 +1,13 @@
+moduleForModel 'product', 'Product model',
+ needs: [
+ 'model:product_variant',
+ 'model:product_category',
+ 'model:section_area',
+ 'model:product_order',
+ 'model:order',
+ 'model:supplier'
+ ]
+
+#test "Nothing yet", ->
+ #element = @subject()
+ #assert 2, 2
diff --git a/spec/javascript/models/section-element_test.coffee b/spec/javascript/models/section-element_test.coffee
index 50300f54..19d108f4 100644
--- a/spec/javascript/models/section-element_test.coffee
+++ b/spec/javascript/models/section-element_test.coffee
@@ -1,5 +1,5 @@
moduleForModel 'section-element', 'Section element model',
- needs: ['model:section', 'model:table']
+ needs: ['model:section', 'model:table', 'model:section-area']
test "box_size", ->
element = @subject
diff --git a/spec/models/list_payment_spec.rb b/spec/models/list_payment_spec.rb
new file mode 100644
index 00000000..fde2dbaf
--- /dev/null
+++ b/spec/models/list_payment_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe ListPayment do
+ it "does completes a list if amount is equal to the list amount" do
+ list = create :list, price: 10.22
+ create :list_payment, amount: 10.22, list: list
+ list.should be_closed
+ end
+ it "does completes a list if amount is greater than the list amount" do
+ list = create :list, price: 10.22
+ create :list_payment, amount: 12, list: list
+ list.should be_closed
+ end
+ it "does completes a list if amount is less than the list amount, but total payments on list bigger" do
+ list = create :list, price: 10.22
+ create :list_payment, amount: 7, list: list
+ list.should be_active
+ create :list_payment, amount: 7, list: list
+ list.should be_closed
+ end
+end
diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb
index 15280fab..aacfe0bb 100644
--- a/spec/models/list_spec.rb
+++ b/spec/models/list_spec.rb
@@ -126,30 +126,30 @@ describe List do
describe '#place_order' do
it 'returns an order object' do
- list.place_order(products: {product.id => 7}, user: user).should be_a Order
+ list.place_order(product_orders: [{'product_id' => product.id, 'quantity' => 7}], user: user).should be_a Order
end
it 'creates an order' do
- expect{ list.place_order(products: {product.id => 7}, user: user) }.to change{ Order.count }.by(1)
+ expect{ list.place_order(product_orders: [{'product_id' => product.id, 'quantity' => 7}], user: user) }.to change{ Order.count }.by(1)
end
describe 'broadcasting' do
it 'broadcasts to the user and the supplier the active order counter' do
# create existing order
- list.place_order(products: {product.id => 7}, user: user)
+ list.place_order(product_orders: [{'product_id' => product.id, 'quantity' => 7}], user: user)
# expect{
- # list.place_order(products: {product.id => 3}, user: user)
+ # list.place_order(product_orders: [{product_id: product.id, quantity: 5}], user: user)
# }.to broadcast_to_user(user.id).message('orders_placed_count').with(count: 2)
expect{
- list.place_order(products: {product.id => 5}, user: user)
+ list.place_order(product_orders: [{'product_id' => product.id, 'quantity' => 5}], user: user)
}.to broadcast_to_supplier(supplier.id).message('orders_placed_count').with(count: 2)
end
end
it 'sets the list price as kind of caching' do
- list.place_order(products: {product.id => 7}, user: user)
+ list.place_order(product_orders: [{'product_id' => product.id, 'quantity' => 7}], user: user)
list.reload
list.price.should == 15.54
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index bdc8fc5a..74e7d3d0 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -106,6 +106,7 @@ RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = true
config.filter_run_excluding broken: true
config.render_views = true
+ config.expect_with(:rspec) { |c| c.syntax = [:expect, :should] }
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock :facebook, {
diff --git a/wip.md b/wip.md
index 944a7224..bf99750d 100644
--- a/wip.md
+++ b/wip.md
@@ -103,3 +103,11 @@ Integrations
- Bonnetjes machine
- Payleven? Payment
+
+
+Braindump:
+
+Create blog
+Explanation about ordering
+The price is the actual price at the restaurant, is different when
+waited for a long time