Skip to content

Instantly share code, notes, and snippets.

View dabit's full-sized avatar

David Padilla dabit

View GitHub Profile
@dabit
dabit / shots.feature
Created September 20, 2011 05:29
shots.feature
 @javascript
 Scenario: Add image for different countries
   Given a country exists with name: "Mexico", locale: "en_MX"
   And a country exists with name: "United States", locale: "en_US"
   And an event exists with name: "Huge Sale"
When I go to the edit event page for "Huge Sale"
   And I select "United States" as the country
When I attach the file "spec/support/logo.jpg" to "Image"
And I press "Update"
Then I should see an image
@dabit
dabit / fields_for.html.haml
Created September 20, 2011 05:24
fields_for.html.haml
- i ||= 0
= f.fields_for :options do |ff|
- i += 1
%label Option #{i}
SimpleCov.at_exit do
percent = SimpleCov.result.covered_percent
unless percent == 100.0
puts "Coverage is not at 100% !!!!"
Kernel.exit(1)
end
end
@dabit
dabit / lines.haml
Created September 5, 2011 20:11
HAML.haml
%div
Este es tu nombre de usuario:
= "#{current_user.name}"
Gracias por ser como eres, vales mil
.clear.sizes
- @product.grouped_attributes.each do |attribute,upcs|
= attribute.name
%br
%ul.sizes.details
- attribute.cached_size_values.each do |size|
- if upc = upcs.detect {|u| u.size == size}
%li
= check_box_tag "post[upc_id]", storefront_update_sellers_list_path(upc.id), false, :class => "post_upc_class", :id => upc.id
%a{:href => "#", :class => "chk-select"}
def self.use_certificate(code, cart)
return false if cart.nil?
return cart.set_gift(0, nil) if code.blank?
return false if cart.gift_code == code
certificate = self.certificate(code).first
unless certificate.blank? || certificate.state == 'in_cart'
unless certificate.state == 'empty'
total = cart.total + cart.gift_discount
if certificate.amount < total
%h2
Brands
.brands
-('A'..'Z').each do |letter|
-li_brands=""
[email protected] do |brand|
-if brand.name.slice(0..0).upcase == letter
-li_brands+="<li>#{link_to(brand.name,{:controller=>:brands, :action => :show, :id =>brand.to_param}, :class=>"#{brand.name}")}</li>"
-unless li_brands==""
module Uno
def queue_mode
@queue_mode ||= :single
end
def queue_mode=(value)
@queue_mode = value
end
def enqueue_mode(mode)
@dabit
dabit / validations.yml
Created April 25, 2011 17:37
i18 validations
activerecord:
errors:
messages:
blank: "No puede ser vacio"
@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/[email protected]/components/nsCommandProcessor.js:256:in `unknown'
# [remote server] file:///var/folders/rm/rmL2xLThHji-vMq1vxRgOE+++TI/-Tmp-/webdriver-profile20110412-53543-1jabr95/extensions/[email protected]/components/nsCommandProcessor.js:305:in `unknown'
# [remote server] file:///var/folders/rm/rmL2xLThHji-vMq1vxRgOE+++TI/-Tmp-/webdriver-profile20110412-53543-1jabr95/extensions/[email protected]/components/nsCommandProcessor.js:320:in `unknown'