Skip to content

Instantly share code, notes, and snippets.

RSpec Around All

Provides around(:all) hooks for RSpec.

Usage

In your Gemfile:

gem 'rspec_around_all', git: 'git://gist.github.com/2005175.git'

About Git Flow

Git Flow is an extension to Git that provides extra functionality and simple commands that force you into a structured and proper branching model. Git Flow is not required and in fact all commands ran by Git Flow can be done using standard Git commands. Git Flow just makes everything easier. Git Flow only needs to be installed on the developer's machine (or wherever development happens) and not on any production server.

Installing on Windows

Git Flow can be installed alongside TortoiseGit without issue, but there are some steps needed.

  1. Download/Install msysGit
  2. Download this file: bin.zip

Create an .htaccess file in the webroot:

AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user

Create a .htpasswd file:

htpasswd -c /app/www/.htpasswd [username]

## Get FFMpeg working on heroku by building binaries using vulcan
gem install vulcan
vulcan create foo
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
require "timeout"
module WaitSteps
extend RSpec::Matchers::DSL
matcher :become_true do
match do |block|
begin
Timeout.timeout(Capybara.default_wait_time) do
sleep(0.1) until value = block.call
module Retriable
# This will catch any exception and retry twice (three tries total):
# with_retries { ... }
#
# This will catch any exception and retry four times (five tries total):
# with_retries(:limit => 5) { ... }
#
# This will catch a specific exception and retry once (two tries total):
# with_retries(Some::Error, :limit => 2) { ... }
#
<script>
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();
Then /^I should( not)? see the following table rows( in any order)?:?$/ do |negate, unordered, expected_table|
extend TableStepsHelper
document = Nokogiri::HTML(page.body)
table = document.xpath('//table//tr').collect { |row| row.xpath('.//th|td') }
expected_table = parse_table(expected_table)
if negate
table.should not_contain_table(expected_table)
else
#!/bin/bash
wget http://download.jetbrains.com/ruby/RubyMine-5.4.3.tar.gz -O /tmp/rubymine
sudo tar -xzvf /tmp/rubymine -C /opt
sudo mv /opt/RubyMine-5.4.3.2.1 /opt/RubyMine
sudo cat >/usr/share/applications/jetbrains-rubymine.desktop <<EOF
[Desktop Entry]
Name=RubyMine
Comment=Integrated Development Environment
TryExec=/opt/RubyMine/bin/rubymine.sh