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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
# run me with ruby >= 2.0 | |
module A | |
def x(arg) | |
"hi #{arg}" | |
end | |
end | |
module B | |
def x(arg) |
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 'factory_girl' | |
require 'faker' #if needed | |
Dir[Rails.root.to_s + '/spec/factories/**/*.rb'].each {|file| require file } |
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
#!/bin/sh | |
WORK_DIR=/Users/tomi/rails_apps/myapp/; | |
RETURN_DIR=/Users/tomi/my_bash_scripts/; #optional | |
if [ -r $WORK_DIR ]; then | |
cd $WORK_DIR |
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
= form_for [@user, @task], :html => { :class => 'form-inline' } do |f| | |
-if @task.errors.any? | |
#error_explanation | |
%h2= "#{pluralize(@task.errors.count, "error")} prohibited this task from being saved:" | |
%ul |
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
# place this file in config/initializers/simple_form.rb | |
# | |
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
# Wrappers are used by the form builder to generate a | |
# complete input. You can remove any component from the | |
# wrapper, change the order or even add your own to the | |
# stack. The options given below are used to wrap the | |
# whole input. | |
config.wrappers :default, :class => :input, |
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
source 'https://rubygems.org' | |
gem 'bundler' | |
gem 'rb-readline' |
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
# just speed test for http://stackoverflow.com/questions/11502629/how-to-do-number-to-string-suffix/11502715#11502715 | |
1.9.3p194 :019 > def shot | |
1.9.3p194 :020?> a=Time.now | |
1.9.3p194 :021?> 1000000.times do | |
1.9.3p194 :022 > "5".ljust(3, "0") | |
1.9.3p194 :023?> end | |
1.9.3p194 :024?> b =Time.now |
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
-#app/views/my_gem/foo.html.haml | |
= f.input :address_country_id_eq, :as => :country_search, label: 'Country' |
OlderNewer