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
Then /^I should see the following output$/ do |xml_output| | |
response = Hash.from_xml(page.body) | |
expected = Hash.from_xml(xml_output) | |
expected.diff(response).should == {} | |
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
#step | |
Then /^(?:|I )should see JSON:$/ do |expected_json| | |
require 'json' | |
expected = JSON.parse(expected_json) | |
actual = JSON.parse(page.body) | |
expected.should == actual | |
end | |
#in the feature | |
Then I should see JSON: |
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
#From rspec-rails readme on github | |
describe "widgets resource" do | |
describe "GET index" do | |
it "contains the widgets header" do | |
get "/widgets/index" | |
response.should have_selector("h1", :content => "Widgets") | |
end | |
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
<script type="text/javascript" charset="utf-8"> | |
$(function() { | |
{% if item.root? %} | |
$.jStorage.flush(); | |
{% endif %} | |
$('#nav').columnview({ | |
preview: function(element) { | |
$.jStorage.flush(); | |
if($.browser.msie) { |
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
Profile.all({:username => /\s/}).each do |p| | |
old_username = p.username | |
p.set(:username => p.username.gsub(/\s+/, "")) | |
p.reload | |
msg = "Notify: #{p.full_name} <#{p.email}>" | |
msg << " - Old username: \"#{old_username}\"" | |
msg << " => New username: \"#{p.username}\"" | |
puts msg |
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
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc # --> Read /etc/bashrc, if present. | |
fi | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/mongodb/bin:$PATH" | |
export RUBYLIB=".:test:$RUBYLIB" |
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 OpeningHours | |
include MongoMapper::EmbeddedDocument | |
[:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday].each do |weekday| | |
class_eval <<-KEYS_AND_ACCESSORS | |
key :#{weekday}_opening, :default => "CLOSED" | |
key :#{weekday}_closing | |
def #{weekday} | |
#{weekday}_opening == "CLOSED" ? #{weekday}_opening : \"\#\{#{weekday}_opening\} - \#\{#{weekday}_closing\}\" |
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
-- open terminal sessions | |
tell application "iTerm 2" | |
activate | |
set myterm to (make new terminal) | |
tell myterm | |
-- start mongo | |
launch session "Default" |
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
namespace :god do | |
namespace :restart do | |
task :default, :roles => :app, :except => { :no_release => true } do | |
run "rvmsudo #{bin_god} restart #{application}" | |
end | |
desc "|capistrano-recipes| Restarts the app server" | |
task :app, :roles => :app, :except => { :no_release => true } do | |
run "rvmsudo #{bin_god} restart #{application}-#{app_server.to_s.downcase}" | |
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
#If you don't have Postgres installed yet: | |
# https://github.com/tsaleh/tammer-saleh/blob/master/views/posts/installing-postgresql-for-rails-3-1-on-lion.html.textil | |
#1. Install postgis 1.5.3. Latest is 2.0.0, so using url old formula on github | |
brew install https://raw.github.com/mxcl/homebrew/8a04a43763906e6a9bef68881acf997f3a6f6687/Library/Formula/postgis.rb | |
#2. Create a template to be used on creating GIS-enabled databases | |
createdb template_postgis | |
#3. Import Postgis Data |