##Integration capybara with minitest
Requirements:
- ruby 1.9
- gem capybara
All you have to do is to require file test_helper.rb at the beginning of your test files.
// Bind to backbone attribute (read/write with get/set, subscribe to change:attribute event): | |
// data-text="model.@attribute" | |
// | |
// Bind to output of function (calls the function to get value, subscribes to 'change' event): | |
// data-text="model.computedProperty() | |
// | |
// Bind to attribute (subscribes to 'change' event): | |
// data-text="model.attr" | |
(function(rivets){ |
config.log_tags = [ | |
:remote_ip, | |
->(req){ | |
if user_id = WardenTaggedLogger.extract_user_id_from_request(req) | |
"#" + user_id.to_s | |
else | |
"guest" | |
end | |
} | |
] |
ActiveRecord::Relation.class_eval do | |
def with_association_target(targets) | |
@association_target = (@association_target||{}).merge(targets) | |
self | |
end | |
def load_with_association_targets(*args) | |
load_without_association_targets(*args).tap do | |
@records.each{|record| set_association_targets(record) } | |
end |
#config/initializers/devise.rb | |
config.warden do |manager| | |
manager.strategies.add :token_header_authenticable, TokenHeaderAuthenticable | |
manager.default_strategies(:scope => :user).unshift :token_header_authenticable | |
end |
Enumerable.module_eval do | |
def select_by(attribute_name, value) | |
detect do |item| | |
item.send(attribute_name) == value | |
end | |
end | |
def select_by!(attribute_name, value) | |
select_by(attribute_name, value) \ | |
or raise StandardError.new("can't find item with #{attribute_name} equal to #{value} in #{self.inspect}") |
# Setup: | |
# tddium config:add suite EY_API_TOKEN xxxxxxxx | |
# (take EY_API_TOKEN value from ~/.eyrc) | |
# tddium config:add suite EY_DEPLOY_KEY yyyyyyy | |
# (EY_DEPLOY_KEY value is Base64-encoded content of your ~/.ssh/id_rsa OR any other ssh key authorised for a given EY env) | |
require 'timeout' | |
require 'etc' | |
require 'base64' |
##Integration capybara with minitest
Requirements:
All you have to do is to require file test_helper.rb at the beginning of your test files.
# Code example for http://wojt.eu/post/13496746332/retrieving-gmail-thread-ids-with-ruby | |
def patch_net_imap_response_parser(klass = Net::IMAP::ResponseParser) | |
klass.class_eval do | |
def msg_att | |
match(T_LPAR) | |
attr = {} | |
while true | |
token = lookahead | |
case token.symbol |
function import_calendar( start_date, end_date, cal_name, spreadsheet, sheet_name) { | |
var sheet = spreadsheet.getSheetByName(sheet_name); | |
var cal = CalendarApp.getCalendarsByName(cal_name)[0]; | |
sheet.clear(); | |
events = cal.getEvents( start_date, end_date ); | |
irow = 2; | |
for( i in events ) { | |
evt = events[i]; | |
var date = evt.getStartTime(); |
diff --git a/lib/caboose/acts/paranoid.rb b/lib/caboose/acts/paranoid.rb | |
index 608169d..fc6199b 100644 | |
--- a/lib/caboose/acts/paranoid.rb | |
+++ b/lib/caboose/acts/paranoid.rb | |
@@ -171,6 +171,7 @@ module Caboose #:nodoc: | |
unless new_record? | |
self.class.update_all self.class.send(:sanitize_sql, ["#{self.class.deleted_attribute} = ?", (self.deleted_at = self.class.send(:current_time))]), ["#{self.class.primary_key} = ?", id] | |
end | |
+ @destroyed = true | |
freeze |