This file contains 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 Driver | |
.... | |
after_destroy :set_new_current_driver_to_insurance_detail | |
protected | |
def set_new_current_driver_to_insurance_detail | |
@insurance_detail = self.insurance_detail | |
@insurance_detail.update_attribute(:current_driver, @insurance_detail.drivers.first) if @insurance_detail.drivers.any? and @insurance_detail.current_driver_id == self.id |
This file contains 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
when 'dui_charges' | |
@object.insurance_detail.drivers.each do |d| | |
@object.insurance_detail.dui_charges.build({:driver_id => d.id}) unless @object.insurance_detail.dui_charges.map{ |dc| dc.driver_id }.include?(d.id) | |
end | |
when 'dui_old_charges' | |
@object.insurance_detail.drivers.each do |d| | |
@object.insurance_detail.dui_old_charges.build({:driver_id => d.id}) unless @object.insurance_detail.dui_old_charges.map{ |doc| doc.driver_id }.include?(d.id) | |
end | |
when 'lost_licences' | |
@object.insurance_detail.drivers.each do |d| |
This file contains 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 generate_pdf | |
cmd = "/usr/bin/env wkhtmltopdf -O #{options[:layout]} -s #{options[:page_size]} -q --disable-smart-shrinking" | |
cmd << " -B 0mm -L 0mm -R 0mm -T 0mm" | |
cmd << " #{html_path} #{pdf_path}" | |
puts "About to run: #{cmd}" | |
`#{cmd}` | |
end |
This file contains 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
Feature: An user can see live stats depending on the app version | |
Scenario: App version is Pro and venue has live stats | |
Given I am using the Pro version of Got | |
And I am on the profile of a venue which has live stats | |
When I tap Right Now | |
Then I should see Live Stats of the Venue | |
Scenario: App version is Pro but venue does not have live stats | |
Given I am using the Pro version of Got |
This file contains 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 @Venue extends Spine.Model | |
@configure 'Venue', 'address', 'advertUrl', 'email', 'logo', 'latitude', 'longitude', 'name', | |
'phoneNumber', 'website', 'shortDescription', 'longDescription', | |
'openingHours', 'capacity', 'distance' | |
@extend Spine.Model.Local | |
@belongsTo 'venueType', 'VenueType' |
This file contains 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
describe 'Venue', -> | |
describe '#findByIds', -> | |
beforeEach => | |
@venue1 = Factory.create 'Venue', attributes: -> {id: 1} | |
@venue2 = Factory.create 'Venue', attributes: -> {id: 2} | |
@venue3 = Factory.create 'Venue', attributes: -> {id: 3} | |
afterEach => | |
Venue.destroyAll() |
This file contains 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 name_of_the_drink ingredients | |
case ingredients | |
when 'cachaca + lime + ice + sugar' | |
return 'Caipirinha' | |
when 'voda + lime + ice + sugar' | |
return 'Caipiroska' | |
when 'lime + ice + sugar' | |
return 'Lemon Juice' | |
when 'ice + sugar' | |
return 'Sweet water' |
This file contains 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 GotApp.VenueIndexController extends tfg.BackPanel | |
title: I18n.t 'title' | |
className: 'screen-venues' | |
day: (new Date).strftime('%A').toLowerCase() | |
elements: | |
'.venues-index-venue' : 'listOfVenues' |
This file contains 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
# Note: I'm using Timecop | |
jukebox_room.reload.expires_at | |
Thu, 31 Jan 2013 12:16:39 WST +08:00 | |
24.hours.from_now | |
Thu, 31 Jan 2013 12:16:39 WST +08:00 | |
jukebox_room.reload.expires_at == 24.hours.from_now | |
false |
This file contains 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
###### MODEL | |
class JukeboxRoom < ActiveRecord::Base | |
#..code here | |
scope :expired, where{ expires_at <= Time.now } | |
#..code here | |
end | |
###### SPEC | |
require 'spec_helper' |
OlderNewer