Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 289 lines (217 sloc) 5.022 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
snippet aft
    after(${1::each}) do
     ${2}
    end

snippet annot
    any_number_of_times

snippet anr
    and_return(${1:value})

snippet anra
    and_raise(${1:exception})

snippet anrb
    and_return { ${1} }

snippet ant
    and_throw(${1:sym})

snippet any
    and_yield(${1:values})

snippet atl
    at_least(${1:n}).times

snippet atm
    at_most(${1:n}).times

snippet bef
    before(${1::each}) do
     ${2}
    end

snippet conn
    controller_name :${1:controller}

snippet des
    describe "${1:subject}" do
     ${2}
    end

snippet desc
    require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
    
    describe ${1:controller} do
     ${2}
    end

snippet desrc
    describe ${1:controller}, "${2:GET|POST|PUT|DELETE} ${3:/some/path}${4}" do
     ${5}
    end

snippet dest
    describe ${1:Type} do
     ${2}
    end

snippet dests
    describe ${1:Type}, "${2:description}" do
     ${3}
    end

snippet ex
    exactly(${1:n}).times

snippet it
    it '${1}' do
     ${2}
    end

snippet its
    it "should ${1:do something}" do${2}

snippet mat
    class ${1:ReverseTo}
     def initialize(${2:param})
     @$2 = $2
     end
    
     def matches?(actual)
     @actual = actual
     # Satisfy expectation here. Return false or raise an error if it's not met.
     ${3:@actual.reverse.should == @$2}
     true
     end
    
     def failure_message
     "expected #{@actual.inspect} to ${4} #{@$2.inspect}, but it didn't"
     end
    
     def negative_failure_message
     "expected #{@actual.inspect} not to ${5} #{@$2.inspect}, but it did"
     end
    end
    
    def ${6:reverse_to}(${7:expected})
     ${8}.new($7)
    end

snippet mm
    mock_model(${1:model})${2}

snippet moc
    ${1:var} = mock("${2:mock_name}"${3:, :null_object => true})
    ${4}

snippet mocw
    Spec::Runner.configure do |config|
     config.mock_with :${1:mocha|flexmock|rr}
    end

snippet on
    once

snippet resh
    require File.dirname(__FILE__) + '/../spec_helper'

snippet sh
    ${1:target}.should == ${2:value}
    ${3}

snippet shb
    ${1:target}.should be(${2:result})
    ${3}

snippet shbc
    ${1:target}.should be_close(${2:result}, ${3:tolerance})
    ${4}

snippet shbio
    ${1:target}.should be_instance_of(${2:class})
    ${3}

snippet shbko
    ${1:target}.should be_a_kind_of(${2:class})
    ${3}

snippet shbr
    response.should be_redirect
    ${1}

snippet shbs
    response.should be_success
    ${1}

snippet shc
    lambda do
     ${1}
    end.should change(${2:target}, :${3:method}).from(${4:old_value}).to(${5:new_value}).by(${6:change})

snippet shdm
    ${1:target}.should match(/${2:regexp}/)
    ${3}

snippet she
    ${1:target}.should eql(${2:value})
    ${3}

snippet sheq
    ${1:target}.should equal(${2:value})
    ${3}

snippet shh
    ${1:target}.should have(${2:num}).${3:things}
    ${4}

snippet shhal
    ${1:target}.should have_at_least(${2:num}).${3:things}
    ${4}

snippet shham
    ${1:target}.should have_at_most(${2:num}).${3:things}
    ${4}

snippet shhr
    ${1:target}.should have(${2:n}).records
    ${3}

snippet shn
    ${1:target}.should_not == ${2:value}
    ${3}

snippet shnb
    ${1:target}.should_not be(${2:result})
    ${3}

snippet shnbc
    ${1:target}.should_not be_close(${2:result}, ${3:tolerance})
    ${4}

snippet shnbio
    ${1:target}.should_not be_instance_of(${2:klass})
    ${3}

snippet shnbko
    ${1:target}.should_not be_a_kind_of(${2:klass})
    ${3}

snippet shnbr
    response.should_not be_redirect
    ${1}

snippet shnbs
    response.should_not be_success
    ${1}

snippet shnc
    lambda do
     ${1}
    end.should_not change(${2:target}, :${3:method})

snippet shne
    ${1:target}.should_not eql(${2:value})
    ${3}

snippet shneq
     ${1:target}.should_not equal(${2:value})
     ${3}

snippet shnm
    ${1:target}.should_not match(/${2:regexp}/)
    ${3}

snippet shnp
    ${1:target}.should_not be_${2:predicate}

snippet shnr
    ${1:mock}.should_not_receive(:${2:message})${3}
    ${4}

snippet shnre
    ${1:target}.should_not raise_error(${2:error})
    ${3}

snippet shnredt
    response.should_not redirect_to(${1:url})
    ${2}

snippet shnrt
    ${1:target}.should_not respond_to(:${2:sym})
    ${3}

snippet shns
    ${1:target}.should_not satisfy { |${2:obj}| ${3} }
    ${4}

snippet shnt
    lambda { ${1} }.should_not throw_symbol(:${2:symbol})
    ${3}

snippet shp
    ${1:target}.should be_${2:predicate}

snippet shr
    ${1:mock}.should_receive(:${2:message})${3}
    ${4}

snippet shre
    ${1:target}.should raise_error(${2:error})
    ${3}

snippet shredt
    response.should redirect_to(${1:url})
    ${2}

snippet shrt
    ${1:target}.should respond_to(:${2:sym})
    ${3}

snippet shs
    ${1:target}.should satisfy { |${2:obj}| ${3} }
    ${4}

snippet sht
    ${1:target}.should throw_symble(:${2:symbol})
    ${3}

snippet shtemp
    response.should render_template(:${1:template})
    ${2}

snippet tw
    twice

snippet wia
    with(${1:args})
    ${2}
Something went wrong with that request. Please try again.