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
| import pytest | |
| from vending import VendingMachine | |
| class TestSelect: | |
| def test_invalid_selection(self): | |
| vm = VendingMachine() | |
| with pytest.raises(Exception, match="Invalid selection"): | |
| vm.select("INVALID") | |
| def test_out_of_inventory(self): |
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
| Step 16/16 : RUN ./bin/setup | |
| ---> Running in ec4a9cacc432 | |
| == Installing dependencies == | |
| The Gemfile's dependencies are satisfied | |
| yarn install v1.19.1 | |
| [1/4] Resolving packages... | |
| [2/4] Fetching packages... | |
| info [email protected]: The platform "linux" is incompatible with this module. | |
| info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. | |
| [3/4] Linking dependencies... |
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
| import { combineReducers } from 'redux' | |
| const subscribed = (state = false, action) => { | |
| switch (action.type) { | |
| case 'SET_SUBSCRIBED': | |
| return true | |
| default: | |
| return state | |
| } | |
| } |
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
| [Coveralls] Set up the SimpleCov formatter. | |
| [Coveralls] Using SimpleCov's default settings. | |
| FF.F..FFFF.F.FFFFFF. | |
| Failures: | |
| 1) Rtesseract::BoxChar bounding box by char | |
| Failure/Error: expect(RTesseract::BoxChar.new(@image_tiff).characters.is_a?(Array)).to eql(true) | |
| Magick::ImageMagickError: | |
| no decode delegate for this image format `TIFF' @ error/constitute.c/ReadImage/501 |
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
| $.ajax({ | |
| type: 'GET', | |
| url: '/topics/savings_easter_egg', | |
| data: { | |
| savings: data[key]['saving'] | |
| } , | |
| success: function(response) { | |
| $(response).dialog({ | |
| height: 840, |
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
| def compute_packages | |
| packages = Packages.all # or however you get all your package | |
| items = get_items #array of items | |
| packages.each do |old_package| | |
| items.each do |item| | |
| old_package << item if old_package #if it has space (true), add the item | |
| items.delete item if old_package #delete item, not sure if you can make this call inside of an iteration block | |
| break if !old_package | |
| 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
| require 'spec_helper' | |
| describe 'CheckPrice', type: :request, js: true do | |
| it "should create a new CheckPrice record when user clicks Check Price on topic page" do | |
| city = create :city, name: "Bilboa", country: create(:country, name: "USA") | |
| partner_restaurant = create :partner_restaurant | |
| restaurant = create :restaurant, name: 'McDonalds', city: city, contact_phone: "123-123-1234" | |
| matched_restaurant = create :matched_restaurant, restaurant: restaurant, partner_restaurant: partner_restaurant | |
| visit '/mcdonalds-bilboa-restaurant' #this link does not have the check prices button |
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
| factory :restaurant do | |
| name { Faker::Name.first_name } | |
| city | |
| end | |
| factory :matched_restaurant do | |
| association :partner_restaurant | |
| association :restaurant | |
| 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
| #strip phone number in partner_restaurant of non-numeric values | |
| formatted_phone = SunspotHelper.sanitize_term(pr.phone).gsub(/\s+/, "") | |
| #When iterating through each restaurant in DB, | |
| #I want to strip all contact_phone of non-numeric values as well before checking against formatted_phone | |
| Restaurant.where(contact_phone: formatted_phone).each do |r| | |
| #irrelevant code | |
| 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
| def new | |
| begin | |
| @slug = params[:slug_text] | |
| @place = Slug.where(name: @slug).first.sluggable | |
| @klass = @place.class | |
| rescue Exception => e | |
| redirect_to :root | |
| end | |
| end |
NewerOlder