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
# Mongoid association matchers for RSpec 2.x and 1.x | |
# | |
# Save this file to your spec/support directory | |
# | |
# Usage: | |
# | |
# describe User do | |
# it { should reference_one :profile } | |
# end | |
# |
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
(posted at http://groups.google.com/group/cukes/browse_thread/thread/4e01cc6e1a7071d4) | |
Hi Guys, | |
I'm the author of pickle, and despite this I broadly agree with Jonas' point of view. | |
The power of capybara is best realised when you do away with web_steps.rb, and start writing your own steps using capybara's dsl. | |
In my opinion, pickle is likewise. pickle_steps.rb is a general set of steps to both introduce the dev to the dsl, and enable rapid cuke writing in the early stages of a project. | |
I agree with Nick - the main point of pickle is to provide a general way of storing models for the lifetime of a scenario, and also to provide a general way of referring to them, so that you don't have to have step defs littered with variable names |
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
#!/usr/bin/env bash | |
sudo apt-get install sed grep tar curl | |
sudo apt-get install zlibc zlib1g zlib1g-dev zlib-bin ssh perl openssl subversion libcurl3 expat | |
sudo apt-get install git libxml2 libxml2-dev ruby-dev libxslt1-dev | |
sudo apt-get install mysql-server libmysqlclient-dev imagemagick librmagick-ruby libmagick++3 libgraphicsmagick3 libgraphicsmagick1-dev libmagick++-3 libpng3 | |
sudo apt-get install libopenssl-ruby libssl-dev libssl0.9.8 | |
sudo apt-get install libreadline5-dev |
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
# Add this to more_web_steps.rb | |
# Selenium docs: http://code.google.com/p/selenium/wiki/RubyBindings#Javascript_Alert/Confirm today! | |
When /^I (accept|dismiss) the "([^"]*)" alert$/ do |action, text| | |
alert = page.driver.browser.switch_to.alert | |
alert.text.should eq(text) | |
alert.send(action) | |
end |
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
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
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
class Foo < ActiveRecord::Base | |
include Models::Scopes::Order | |
default_scope recently_updated # didn't realize you could do this | |
end |
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
# In spec/support/callback_disabler.rb | |
module CallbackDisabler | |
def self.store_callbacks(model, filters) | |
model = constantize(model) | |
filters.each do |filter| | |
model.send("_#{filter}_callbacks").each do |callback| | |
stored_callbacks[model] << { | |
filter: filter, kind: callback.kind, raw_filter: callback.raw_filter | |
} |
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
# use instead of rails console | |
pry -r ./config/environment.rb | |
# for debugging in code put this anywhere: | |
binding.pry | |
# then check your console (rails server window) and type: | |
help | |
# win |
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 = node[:rails][:app] | |
rails_base app[:name] do | |
ruby_ver app[:ruby_ver] | |
gemset app[:gemset] | |
end | |
%w{config log pids cached-copy bundle system}.each do |dir| | |
directory "#{app[:app_root]}/shared/#{dir}" do | |
owner app[:deploy_user] |
OlderNewer