Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

everydayrails/atom-everydayrails-rspec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atom-everydayrails-rspec package

Atom snippets for RSpec, based on the style of Rails testing described in Everyday Rails Testing with RSpec.

Snippets:

  • Expect to:

    exexpect($1).to $2

  • Expect to not:

    exnexpect($1).to_not $2

  • Expect block to:

    exbexpect {\n\t$1\n}.to $2

  • Expect block to not:

    exbnexpect {\n\t$1\n}.to_not $2

  • Let:

    letlet(:$1) { $2 }

  • Feature scenario block:

    scnscenario "$1" do\n\t$2\nend

  • RSpec describe block:

    descdescribe "$1" do\n\t$2\nend

  • RSpec context block:

    cxtcontext "$1" do\n\t$2\nend

  • RSpec before block:

    befbefore do\n\t$1\n\end

  • RSpec it:

    itit "$1" do\n\t$2\nend

  • Visit link:

    visvisit "$1"

  • Within block:

    withinwithin "$1" do\n\t$2\nend

  • Have content:

    hchave_content "$1"

  • Have link:

    hlhave_link "$1"${2:, href: "$3"}

  • Have field:

    hfhave_field "$1"${2:, text: "$3"}

  • Fill in input with value:

    fifill_in "$1", with: "$2"

  • Choose radio input:

    chochoose "$1"

  • Check a checkbox:

    chkcheck "$1"

  • Select from menu:

    selselect "$1", from: "$2"

  • Click button:

    clbclick_button "$1"

  • Click link:

    cllclick_link "$1"

  • FactoryBot.create:

    fbcFactoryBot.create(:$1)

  • FactoryBot.build:

    fbbFactoryBot.build(:$1)

  • FactoryBot.attributes_for:

    fbaFactoryBot.attributes_for(:$1)

  • FactoryGirl.create:

    fgcFactoryGirl.create(:$1)

  • FactoryGirl.build:

    fgbFactoryGirl.build(:$1)

  • FactoryGirl.attributes_for:

    fgaFactoryGirl.attributes_for(:$1)

  • Factory Bot/Factory Girl trait:

    trtrait :$1 do\n\t$2\nend

  • Be truthy:

    btbe_truthy

  • Be falsy:

    bfbe_falsy

  • Be valid:

    bvbe_valid

  • Be empty:

    bebe_empty

  • Have HTTP status:

    hhshave_http_status($1)

  • Be success:

    bsbe_success

  • Route to:

    route_to(\n\tcontroller: "$1",\n\taction: "$2"\n)

  • Save and open page:

    sopsave_and_open_page

Thanks:

  • Thank you Matt Perry @lodestone for documentation!