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: Allocating bucket activities | |
As a user | |
I want to allocate activity paddocks in the bucket season to real seasons | |
So that costs are accounted properly | |
Background: | |
Given there is a farmer | |
And the farmer has a bucket season | |
And the farmer has a season called Winter | |
And the farmer has a season called Summer |
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
require "rubygems" | |
require "awesome_print" | |
unless IRB.version.include?('DietRB') | |
IRB::Irb.class_eval do | |
def output_value | |
ap @context.last_value | |
end | |
end | |
else # MacRuby |
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 process_params_sort_key | |
# Remove the sort if someone is trying to forge it... | |
if params[:sort] && params[:sort].match(/(drop|=|--|;|'|")/) | |
debugger | |
send_exceptional(StandardError.new("Angelina Jolie in the house..."), "Params hacking detected") | |
params.delete(:sort) | |
end | |
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
class Invoice | |
attr_accessor :a, :b, :c, :name | |
def to_s | |
name | |
end | |
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
require File.dirname(__FILE__) + "/acceptance_helper" | |
describe "Creating an article" do | |
let(:user) { Factory(:user) } | |
context "as a user" do | |
before do | |
login_user(user) |
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
# Integration testing | |
gem "capybara", "~> 1.0.0" | |
gem "steak", "~> 1.1.0" | |
gem "launchy", "~> 0.4.0" | |
gem "database_cleaner" |
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 contact_details=(contacts) | |
return if contacts.nil? | |
contacts = contacts.values if contacts.kind_of? Hash | |
self.class.transaction do | |
phone_numbers.destroy_all | |
email_addresses.destroy_all | |
contacts.each do |contact| |
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
<a class="add_fields" href="#" onclick="add_fields(this, "bookings", "booking", "<div class=\'booking remove_fields_target\'>\n<div class=\'booking_header\'>\n<span class=\'title\'>Trip <\/span>\n<\/div>\n\n<input id=\"booking_group_bookings_attributes_new_bookings_site_id\" name=\"booking_group[bookings_attributes][new_bookings][site_id]\" type=\"hidden\" value=\"100024\" />\n<input id=\"booking_group_bookings_attributes_new_bookings_created_by\" name=\"booking_group[bookings_attributes][new_bookings][created_by]\" type=\"hidden\" value=\"100513\" />\n<input id=\"booking_group_bookings_attributes_new_bookings_created_with_new_booking_group_centric_form\" name=\"booking_group[bookings_attributes][new_bookings][created_with_new_booking_group_centric_form]\" type=\"hidden\" value=\"1\" />\n<input id=\"booking_grou |
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
From Ubuntu | |
:~$ curl -v https://api.xero.com/api.xro/2.0/Contacts | |
* About to connect() to api.xero.com port 443 (#0) | |
* Trying 174.143.224.225... connected | |
* Connected to api.xero.com (174.143.224.225) port 443 (#0) | |
* successfully set certificate verify locations: | |
* CAfile: none | |
CApath: /etc/ssl/certs | |
* SSLv3, TLS handshake, Client hello (1): |
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 self.up | |
function_string = 'CREATE OR REPLACE FUNCTION searchable_number(v_input text) | |
RETURNS numeric AS $$ | |
DECLARE v_numeric_value numeric DEFAULT NULL; | |
BEGIN | |
BEGIN | |
v_numeric_value := v_input::NUMERIC; | |
EXCEPTION WHEN OTHERS THEN | |
RAISE NOTICE \'Invalid numeric value: "%". Returning NULL.\', v_input; | |
RETURN NULL; |