Skip to content

Instantly share code, notes, and snippets.

View dabit's full-sized avatar

David Padilla dabit

View GitHub Profile
@dabit
dabit / Testing
Created September 13, 2010 22:11
Testing
$ cucumber
Using the default profile...
F---F
Failing Scenarios:
cucumber features/autocomplete.feature:7 # Scenario: Autocomplete
1 scenario (1 failed)
3 steps (3 skipped)
0m0.006s
%ul{:class => "sizes #{product_attribute.name.downcase}"}
-if product_attribute.name == "Width"
-values= product_attribute.values.sort{|x,y| x.id <=> y.id}
-attname='Shoe Witdh'
-objname="product[value_ids][#{product_attribute.solr_name}][]"
-elsif product_attribute.name == "Youth Shoe Sizes"
-values= Value.shoe_sizes
-attname='Shoe Sizes'
-objname="product[value_ids][shoe_sizes][]"
%b
<?php
require_once( 'core.php' );
$t_core_path = config_get( 'core_path' );
require_once( $t_core_path . 'filter_api.php' );
require_once( $t_core_path . 'csv_api.php' );
require_once( $t_core_path . 'columns_api.php' );
?>
<?php auth_attempt_script_login('$MANTIS_USER', '$MANTIS_PASSWORD') ?>
/*
* Unobtrusive autocomplete
*
* To use it, you just have to include the HTML attribute autocomplete
* with the autocomplete URL as the value
*
* Example:
* <input type="text" data-autocomplete="/url/to/autocomplete">
*
* Optionally, you can use a jQuery selector to specify a field that can
@dabit
dabit / mf.rb
Created December 2, 2010 00:01
magic form
def magic_form(*resources)
options = resources.extract_options!
resource = resources.last
attributes = resource.attribute_names - [:created_at, :updated_at]
form_for(resource) do |f|
attributes.each do |attribute|
concat(f.label(attribute, (options[attribute.to_sym] || attribute)))
concat(f.text_field(attribute))
end
@dabit
dabit / ac_for_two_fields.rb
Created February 22, 2011 01:09
autocomplete for two fields
# let's say you have an Account model with first name and last name as its fields.
#
# I would put a method that returns both names like so:
#
class Account < ActiveRecord::Base
def full_name
"#{self.first_name} #{self.last_name}"
end
end
@dabit
dabit / spec_helper.rb
Created April 5, 2011 20:10
Put this on your spec_helper, be happy reading test.log
RSpec.configure do |config|
config.before :each do
Rails.logger.info "======= START #{self.example.metadata[:full_description]}"
end
config.after :each do
Rails.logger.info "======= END #{self.example.metadata[:full_description]}"
end
end
@dabit
dabit / error.rb
Created April 12, 2011 23:55
error
Failures:
1) Story Comments Add a comment
Failure/Error: fill_in 'comment_comment', with: comment_attributes[:comment]
Selenium::WebDriver::Error::ElementNotDisplayedError:
Element is not currently visible and so may not be interacted with
# [remote server] resource://fxdriver/modules/atoms.js:9366:in `unknown'
# [remote server] file:///var/folders/rm/rmL2xLThHji-vMq1vxRgOE+++TI/-Tmp-/webdriver-profile20110412-53543-1jabr95/extensions/fxdriver@googlecode.com/components/nsCommandProcessor.js:256:in `unknown'
# [remote server] file:///var/folders/rm/rmL2xLThHji-vMq1vxRgOE+++TI/-Tmp-/webdriver-profile20110412-53543-1jabr95/extensions/fxdriver@googlecode.com/components/nsCommandProcessor.js:305:in `unknown'
# [remote server] file:///var/folders/rm/rmL2xLThHji-vMq1vxRgOE+++TI/-Tmp-/webdriver-profile20110412-53543-1jabr95/extensions/fxdriver@googlecode.com/components/nsCommandProcessor.js:320:in `unknown'
@dabit
dabit / validations.yml
Created April 25, 2011 17:37
i18 validations
activerecord:
errors:
messages:
blank: "No puede ser vacio"