rspec seems to behave now

This commit is contained in:
2014-08-13 16:06:16 +02:00
parent 3fc7030002
commit d6e7c4998f
7 changed files with 10 additions and 25 deletions
@@ -5,9 +5,10 @@ App.User= DS.Model.extend
name: attr('string') name: attr('string')
list: DS.belongsTo('list') # in ember scope not many to many (yet) list: DS.belongsTo('list') # in ember scope not many to many (yet)
join_requests: DS.hasMany('join_request') join_requests: DS.hasMany('join_request')
facebook_image: (-> "http://graph.facebook.com/#{@get('facebook_id')}/picture?type=square").property('facebook_id')
facebook_image_tag: (-> facebook_image_tag: (->
facebook_id = @get('facebook_id')
return '' unless facebook_id
url = "http://graph.facebook.com/#{facebook_id}/picture?type=square"
name = @get('name') name = @get('name')
url = @get('facebook_image')
new Handlebars.SafeString "<img src=\"#{url}\" alt=\"#{name}\" title=\"#{name}\" >" new Handlebars.SafeString "<img src=\"#{url}\" alt=\"#{name}\" title=\"#{name}\" >"
).property('facebook_image', 'name') ).property('facebook_id', 'name')
@@ -13,7 +13,7 @@ if table.active_list
/.table-action-row /.table-action-row
a{action "editTable" table}: span.fa.fa-lg.fa-wrench a{action "editTable" table}: span.fa.fa-lg.fa-wrench
each user in table.active_list.users each user in table.active_list.users
img src=user.facebook_image span= user.facebook_image_tag
if editmodedisabled if editmodedisabled
.table-settings .table-settings
select select
@@ -3,10 +3,6 @@ root.Qsupplier=
watch_events: -> watch_events: ->
faye = new Faye.Client(event_host) faye = new Faye.Client(event_host)
faye.subscribe "/supplier/#{supplier_object.id}", (e)=> faye.subscribe "/supplier/#{supplier_object.id}", (e)=>
<% if Rails.env.development? %>
console.log "Event: #{e.event}"
console.log e.data
<% end %>
if(e.event == 'new_order') if(e.event == 'new_order')
if App if App
App.store().pushPayload(e.data) App.store().pushPayload(e.data)
@@ -19,7 +19,7 @@ module Suppliers
else else
@lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25) @lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
end end
@lists.include_relation(:table) @lists.include_relation(:table, :users, orders: {product_orders: :product})
render json: @lists, each_serializer: SupplierListSerializer render json: @lists, each_serializer: SupplierListSerializer
end end
-12
View File
@@ -2,17 +2,5 @@ class OrderSerializer < Qwaiter::Serializer
embed :ids, include: true embed :ids, include: true
attributes :state, :list_id, :section_id, :table_id #, :price attributes :state, :list_id, :section_id, :table_id #, :price
# todo, put this logic in Ember
#def product_orders
#@product_orders ||= object.product_orders.include_relation(:product) .map do |product_order|
#{product_name: product_order.product.name, id: product_order.id, quantity: product_order.quantity, price: product_order.price}
#end
#end
# todo, put this logic in Ember
#def price
#product_orders.inject(0){|sum, po| sum + po[:quantity] * po[:price]}.round(2)
#end
has_many :product_orders has_many :product_orders
end end
@@ -38,7 +38,7 @@ Feature: Supplier section view
Then the section table should not have any active list markings anymore Then the section table should not have any active list markings anymore
And the list should be marked as closed And the list should be marked as closed
@javascript @broken @javascript
Scenario: Selecting a specific section limits the result to the lists and orders of those sections Scenario: Selecting a specific section limits the result to the lists and orders of those sections
Given there is an active list and order Given there is an active list and order
And I am signed in as supplier And I am signed in as supplier
@@ -54,7 +54,7 @@ Feature: Supplier section view
And I should see the order and the new order And I should see the order and the new order
@javascript @broken @javascript
Scenario: Going to edit mode and change section properties Scenario: Going to edit mode and change section properties
Given there is an active list and order Given there is an active list and order
And there are 2 supplier sections And there are 2 supplier sections
@@ -67,7 +67,7 @@ Feature: Supplier section view
When I click the supplier section normal mode button When I click the supplier section normal mode button
Then the supplier last section properties should be updated to the new values Then the supplier last section properties should be updated to the new values
@javascript @broken @javascript
Scenario: A new order is created when the view is already loaded Scenario: A new order is created when the view is already loaded
Given there is a confirmed and open supplier Given there is a confirmed and open supplier
And there is a table in the section And there is a table in the section
+1 -1
View File
@@ -18,7 +18,7 @@ Dir.glob("spec/acceptance_steps/**/*steps.rb") { |f| load f, true }
I18n.locale =I18n.default_locale I18n.locale =I18n.default_locale
Devise.stretches = 1 Devise.stretches = 1
Capybara.javascript_driver = :webkit Capybara.javascript_driver = :webkit
Capybara.default_wait_time = 4 # ember needs more time than the default of 2 Capybara.default_wait_time = 6 # ember needs more time than the default of 2
#Capybara.javascript_driver = :selenium #Capybara.javascript_driver = :selenium
module FactoryAttributesFor module FactoryAttributesFor