Skip to content

Instantly share code, notes, and snippets.

View jsteiner's full-sized avatar

Josh Steiner jsteiner

View GitHub Profile
@jsteiner
jsteiner / database_cleaner.rb
Created January 10, 2014 20:31
Database Cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
@jsteiner
jsteiner / projections.json
Last active November 17, 2017 22:17
Example Rails.vim projections for an Ember.js project.
{
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.coffee",
"template": "App.%S = DS.Model.extend"
},
"app/assets/javascripts/controllers/*_controller.coffee": {
"command": "jcontroller",
"alternate": "spec/javascripts/controllers/%s_spec.coffee",
module ScrollableTabView
exposing
( view
, initialPage
, tabBarActiveTextColor
, tabBarInactiveTextColor
, tabBarUnderlineStyle
, tabBarTextStyle
, tabBarStyle
)
@jsteiner
jsteiner / context.md
Last active October 28, 2016 19:15
On context

Thanks for reading Testing Rails! Here's some quick answers to some of your questions. I'll clean this up later and add a section in the book.

context

I primarily use context for communication around conditionals. Or in other words, to give extra context around what the it will be testing. Since I don't use let or before blocks, I don't use context blocks to group common setup functionality. So, they don't provide any additional

@jsteiner
jsteiner / .vimrc
Last active August 29, 2016 03:15
Example .vimrc projections, including projections for Active Model Serializers, Draper, and FactoryGirl
let g:rails_projections = {
\ "config/projections.json": {
\ "command": "projections"
\ },
\ "spec/features/*_spec.rb": {
\ "command": "feature",
\ "template": "require 'spec_helper'\n\nfeature '%h' do\n\nend",
\ }}
let g:rails_gem_projections = {
@jsteiner
jsteiner / projections.json
Last active June 14, 2016 17:38
Example Rails.vim projections for a Backbone.js project.
{
"app/assets/javascripts/models/*.coffee": {
"command": "jmodel",
"alternate": "spec/javascripts/models/%s_spec.coffee",
"template": "class @AppName.Models.%S extends Backbone.Model"
},
"app/assets/javascripts/collections/*.coffee": {
"command": "jcollection",
@jsteiner
jsteiner / app.css
Last active December 30, 2015 09:49
.wufoo {
background-color: red !important;
}
form.wufoo .info h2 {
color: red !important;
}
let g:rails_projections = {
\ "config/projections.json": {
\ "command": "projections"
\ },
\ "spec/features/*_spec.rb": {
\ "command": "feature",
\ "template": "require 'spec_helper'\n\nfeature '%h' do\n\nend",
\ },
\ "spec/support/*.rb": {
\ "command": "support"
" Edit another file in the same directory as the current file
map <Leader>e :e <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>s :split <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>v :vsplit <C-R>=expand("%:p:h") . '/'<CR>
map <Leader>te :tabe <C-R>=expand("%:p:h") . '/'<CR>
@jsteiner
jsteiner / rails.vim
Created October 11, 2013 14:19
Current Rails.vim projections
let g:rails_projections = {
\ "config/projections.json": {
\ "command": "projections"
\ },
\ "spec/features/*_spec.rb": {
\ "command": "feature",
\ "template": "require 'spec_helper'\n\nfeature '%h' do\n\nend",
\ },
\ "spec/support/*.rb": {
\ "command": "support"