This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if 'createTouch' of document | |
| ignore = /:hover\b/ | |
| try | |
| for stylesheet in document.styleSheets | |
| idxsToDelete = [] | |
| # detect hover rules | |
| for rule, idx in stylesheet.cssRules | |
| if rule.type is CSSRule.STYLE_RULE and ignore.test(rule.selectorText) | |
| newSelector = _.reject rule.selectorText.split(","), (s) -> ignore.test s | |
| if newSelector.length > 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defaults: &defaults | |
| cloudant: | |
| url: <%= ENV["CLOUDANT_URL"] %> | |
| facebook_database: "facebook_data" | |
| development: | |
| <<: *defaults | |
| cloudant: | |
| url: "some url" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OrderItem < ActiveRecord::Base | |
| belongs_to :item | |
| after_update :adjust_inventory, :if => lambda { | |
| (size_changed? || item_id_changed?) && !returned? | |
| } | |
| def adjust_inventory | |
| if item_id_changed? | |
| Item.find(item_id_was).increment_stock(size_was) | |
| item.reload.decrement_stock(size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| belongs_to :order | |
| belongs_to :item | |
| validate :item_has_not_been_sent? | |
| def user | |
| self.order.user | |
| end | |
| def item_has_not_been_sent? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| has_many :orders | |
| has_many :order_items, :through => :orders | |
| def revenue | |
| #TODO: stubbing OrderItem#price means I can't use .sum(:price). Is there a better way to use stubs AND sql? | |
| #order_items.kept.sum(:price) | |
| order_items.kept.reduce(0) { |sum, n| sum + n.price } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it "marks order_items as returned", :driver => :webkit do | |
| browser.authenticate(username, password) | |
| visit some_path | |
| end |