Atom snippets for RSpec, based on the style of Rails testing described in Everyday Rails Testing with RSpec.
-
Expect to:
ex→expect($1).to $2 -
Expect to not:
exn→expect($1).to_not $2 -
Expect block to:
exb→expect {\n\t$1\n}.to $2 -
Expect block to not:
exbn→expect {\n\t$1\n}.to_not $2 -
Let:
let→let(:$1) { $2 } -
Feature scenario block:
scn→scenario "$1" do\n\t$2\nend -
RSpec describe block:
desc→describe "$1" do\n\t$2\nend -
RSpec context block:
cxt→context "$1" do\n\t$2\nend -
RSpec before block:
bef→before do\n\t$1\n\end -
RSpec it:
it→it "$1" do\n\t$2\nend -
Visit link:
vis→visit "$1" -
Within block:
within→within "$1" do\n\t$2\nend -
Have content:
hc→have_content "$1" -
Have link:
hl→have_link "$1"${2:, href: "$3"} -
Have field:
hf→have_field "$1"${2:, text: "$3"} -
Fill in input with value:
fi→fill_in "$1", with: "$2" -
Choose radio input:
cho→choose "$1" -
Check a checkbox:
chk→check "$1" -
Select from menu:
sel→select "$1", from: "$2" -
Click button:
clb→click_button "$1" -
Click link:
cll→click_link "$1" -
FactoryBot.create:
fbc→FactoryBot.create(:$1) -
FactoryBot.build:
fbb→FactoryBot.build(:$1) -
FactoryBot.attributes_for:
fba→FactoryBot.attributes_for(:$1) -
FactoryGirl.create:
fgc→FactoryGirl.create(:$1) -
FactoryGirl.build:
fgb→FactoryGirl.build(:$1) -
FactoryGirl.attributes_for:
fga→FactoryGirl.attributes_for(:$1) -
Factory Bot/Factory Girl trait:
tr→trait :$1 do\n\t$2\nend -
Be truthy:
bt→be_truthy -
Be falsy:
bf→be_falsy -
Be valid:
bv→be_valid -
Be empty:
be→be_empty -
Have HTTP status:
hhs→have_http_status($1) -
Be success:
bs→be_success -
Route to:
route_to(\n\tcontroller: "$1",\n\taction: "$2"\n) -
Save and open page:
sop→save_and_open_page
- Thank you Matt Perry @lodestone for documentation!