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 "link_with" do | |
let (:mirror) {create(:relation_kind, label: 'mirror')} | |
let (:rorrim) {create(:relation_kind, label: 'rorrim')} | |
it 'link relation kind both ways' do | |
mirror.link_with(rorrim) | |
expect(mirror.mirror_relation_kind).to eql rorrim | |
expect(rorrim.mirror_relation_kind).to eql mirror | |
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 OpenObject::Partner | |
include OpenObjectModel | |
set_open_object_model 'res.partner' | |
## Where user context is the trinity : {uid: Int , dbname: String , pwd: String} | |
def my_custom_method(user_context) | |
OpenObject.rescue_xmlrpc_fault do | |
response = self.class.connection(user_context).execute(self.class.open_object_model, 'remoteOpenObjectMethod', self.id.to_i) | |
OpenObject::BackendResponse.new(success: true, content: response) | |
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 'spec_helper' | |
describe Documents::PaymentSummaryPresenter do | |
describe 'deal_paid_deposits' do | |
let(:deal) {double()} | |
let(:deposit) {double()} | |
let(:presenter) { Documents::PaymentSummaryPresenter.new(deal) } | |
before(:each) do | |
deal.stub_chain(:deposits, :paid) {[deposit]} | |
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
".opacify".on({ | |
mouseover: function(e){ | |
e.target.morph({opacity: '1'}) | |
}, | |
mouseout: function(e){ | |
e.target.morph({opacity: '0.7'}) | |
} | |
}); |
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 integrity | |
if time_credit? | |
errors.add(:base, I18n.t(:establishment_cost_empty, :scope => [:models, :destinations, :integrity])) unless establishment_cost? | |
elsif establishment_cost? | |
errors.add(:base, I18n.t(:time_credit_empty, :scope => [:models, :destinations, :integrity])) unless time_credit? | |
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
def integrity | |
dependent_attributes = %w(time_credit establishment_cost) | |
nullity_proc = lambda{|attr| send(attr.to_sym).nil? || send(attr.to_sym).zero?} | |
dependent_attributes.each_index do |i| | |
if nullity_proc.call(dependent_attributes[i]) && !nullity_proc.call(dependent_attributes[i-1]) | |
errors.add(dependent_attributes[i].to_sym, I18n.t("#{dependent_attributes[i]}_empty", :scope => [:models, :destinations, :integrity])) | |
end | |
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
destination_number = cdr.called_number | |
prefixes_array = Array.new | |
destination_number.each_char do |char| | |
prefixes_array << (destination_number[-1] or '' ) + char | |
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
@files = ARGV | |
@files.each_with_index do |file, index| | |
pid = fork { | |
require 'stomp' | |
client = Stomp::Client.open("", "", "localhost", 61613) | |
def send_message(server, message, queue) | |
server.send("/cdr/cdr#{queue}", message, {}) | |
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
def self.resolve(cdr) | |
prefixes_array = Array.new | |
cdr.called_number.each_char do |char| | |
prefixes_array << (prefixes_array[-1] or '') + char | |
end | |
prefixes_array.reverse! | |
best_match = Proc.new do |destinations, prefixes| |
OlderNewer