Skip to content

Instantly share code, notes, and snippets.

@danielmorrison
danielmorrison / spec_helper.rb
Created January 31, 2014 20:46
put inside spec/spec_helper.rb inside the RSpec.configure block
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
DatabaseCleaner.start
example.run
DatabaseCleaner.clean
end

Keybase proof

I hereby claim:

  • I am danielmorrison on github.
  • I am danielmorrison (https://keybase.io/danielmorrison) on keybase.
  • I have a public key whose fingerprint is 44D2 A17B 5B7B DD20 FD60 F6DF A1C6 359B 1FAF 4A90

To claim this, I am signing this object:

http://🐷🍉🎮💣🍟🍍🐊🍎.🍕💩.ws
<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<%= stylesheet_link_tag 'boilerplate', 'main' %>
</head>
<body>
<div id="main">
<header>
<h1>
# just add a gem dependency for Timecop or require it yourself
Given 'the time is $time' do |time|
Timecop.freeze Time.parse(time)
end
When '$time pass' do |time|
Timecop.travel future_time(time)
Given 'delayed jobs are run' # we use delayed jobs and have some that get scheduled in the future.
end
When /I see wtf is going on/i do
save_and_open_page
end
When /I want to debug/i do
debugger
true # never put debugger at the end of a method
end
<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<%= stylesheet_link_tag 'boilerplate', 'main' %>
<%= javascript_include_tag :defaults %>
<!--[if IE]>
<%= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js' %>
<![endif]-->
</head>
require 'test/unit'
require 'book'
class BookTest < Test::Unit::TestCase
def setup
@book = Book.new
end
def test_should_capitalize_the_first_letter
<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<%= csrf_meta_tag %>
<%= stylesheet_link_tag 'application', :media => "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
@danielmorrison
danielmorrison / gist:671304
Last active September 24, 2015 04:57
put inside auctions/new.html.erb
<% if form.object.errors.any? %>
<div id="error_explanation">
<h2>The following errors prohibited this form from being saved:</h2>
<ul>
<% form.object.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>