LoginSignup
2
2

More than 5 years have passed since last update.

RSpec用のスニペット

Posted at

neocomplcache-snippets-completeで使うRSpec用のスニペット。
こちらを参考に作成

まだ実戦投入してないので使い勝手は不明。

snippet     desc
abbr        describe '' do end
prev_word   '^'
    describe '${1:target}' do
        ${2:example}
    end

snippet     cont
abbr        context '' do end
prev_word   '^'
    context '${1:target}' do
        ${2:example}
    end

snippet     bef
abbr        before {}
prev_word   '^'
    before (:${1:each}) { ${2:proc} }

snippet     sub
abbr        subject.method
    subject.${1:method}

snippet     subj
abbr        subject {}
prev_word   '^'
    subject { ${1:expression} }

snippet     it
abbr        it {}
prev_word   '^'
    it { ${1:expression} }


snippet     itl
abbr        it { ->{} }
prev_word   '^'
    it { ->{ ${1:lambda} } }.should ${2:change}

snippet     its
abbr        its(:hoge) {}
prev_word   '^'
    its(:${1:method}) { ${2:expression} }

snippet     let
abbr        let(:hoge) {}
prev_word   '^'
    let${1:!}(:${2:name}) { ${3:expression} }

snippet     cha
abbr        change(Hoge, :fuga)
    change(${1:target}, :${2:method})

snippet     changeby
abbr        change(Hoge, :fuga).by(1)
    change(${1:target}, :${2:method}).by(${3:increment})

snippet     changeto
abbr        change(Hoge, :fuga).from(old).to(new)
    change(${1:target}, :${2:method}).from(${3:old_value}).to(${4:new_value})

snippet     sho
abbr        should
    should be_${1:value}

snippet     shon
abbr        should_not
    should_not be_${1:value}
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2