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
| attachments: parent_id, asset_id | |
| domain_names: organisation_id | |
| event_memberships: user_id, event_id | |
| events: editor_id | |
| group_actions: user_id, group_id | |
| groups: user_id | |
| icons: parent_id | |
| invitations: sender_id | |
| legacy_actions: item_upon_id | |
| news_items: author_id |
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
| module Mustache | |
| class << self | |
| import com.github.mustachejava.DefaultMustacheFactory | |
| import com.github.mustachejava.jruby.JRubyObjectHandler | |
| def template_dir | |
| Rails.root.join('app', 'templates') | |
| end | |
| def factory |
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 'faker' | |
| require 'factory_girl' | |
| require 'test/factories' | |
| require 'message' | |
| Message.collection.drop | |
| Message.create_indexes | |
| Contact.collection.drop | |
| Contact.create_indexes |
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
| start_time = Time.utc(2011, 07, 04, 12, 18) | |
| mps = MessagePart.where(:timestamp.gt => start_time).collect do |mp| | |
| account_msisdn = Subscriber.find(mp.subscriber_id).account.msisdn | |
| attributes = mp.attributes.slice("content", "total_parts", "message_id", "part", "contact_msisdn", "sent") | |
| %{ | |
| MessagePart.create!(#{attributes.inspect}.merge( | |
| :subscriber_id => Account.find_by_msisdn(#{account_msisdn.inspect}).subscriber.id, | |
| :timestamp => Time.parse(#{mp.timestamp.to_s.inspect}) | |
| )) |
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 [[ -a Gemfile ]]; then | |
| bundle exec rake $* | |
| else | |
| command rake $* | |
| fi |
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 Event < Node | |
| 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
| module Mongo | |
| module Instrumentation | |
| def self.instrument(clazz, *methods) | |
| clazz.module_eval do | |
| methods.each do |m| | |
| class_eval %{def #{m}_with_instrumentation(*args, &block) | |
| ActiveSupport::Notifications.instrumenter.instrument "mongo.mongo", :name => "#{m}" do | |
| #{m}_without_instrumentation(*args, &block) | |
| end | |
| 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
| module Mongoid | |
| class LogSubscriber < ActiveSupport::LogSubscriber | |
| def self.runtime=(value) | |
| Thread.current["mongoid_mongo_runtime"] = value | |
| end | |
| def self.runtime | |
| Thread.current["mongoid_mongo_runtime"] ||= 0 | |
| 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
| context "when logged in" do | |
| setup do | |
| @account = Factory(:provisioned_account) | |
| sign_in @account | |
| end | |
| context "GET index" do | |
| setup do | |
| @messages = 5.times.map { message(:subscriber => @account.subscriber, :favourite => true) } | |
| 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
| module UserHelper | |
| attr_accessor :current_user | |
| class Credentials < Struct.new(:email, :password) | |
| def self.parse(arg) | |
| return arg if arg.is_a?(Credentials) | |
| new(arg) | |
| end | |
| def initialize(credentials) |
NewerOlder