Rails-and-rspec-snippets README
Extension with a snippet package for Ruby on Rails and rspec development.
Features
Snippet |
Renders |
def |
Function block |
each |
Each block |
if |
Create structure 'if' |
elseif |
Create structure 'elseif' |
find_e |
Create structure 'find_each' |
case |
Create structure 'case' |
class |
Create structure class with initialize |
loop |
Create structure 'loop' |
while |
Create structure 'while' |
times |
Create structure 'times' |
let |
Create structure 'let' inline |
let do |
Create structure 'let' in block |
context |
Create structure 'context' at the rpec |
describe |
Create structure 'describe' at the rpec |
it |
Create structure 'it' at the rpec |
def - Bloco de função
def hello_world
puts 'Hello world!!!'
end
each - Each block
number.each do |n|
puts n
end
if - Create structure 'if'
if 1 > 2
puts 'yes!!!'
end
elseif - Create structure 'elseif'
if 1 > 2
puts '1 is greater than 2'
elsif 1 == 0
puts 'noo!'
end
find_e - Create structure 'find_each'
numbers.find_each do |number|
puts number
end
case - Create structure 'case'
case number
when number > 0
puts "greater than 0"
else
puts "less than 0 or equal to 0"
end
class - Create structure class with initialize
class Test
def initialize()
puts "Hello World"
end
end
loop - Create structure 'loop'
loop do
puts "hello"
break if count >= 10
end
while - Create structure 'while'
while number >= 10 do
puts number
end
let - Create structure 'let' inline
let(:object) { { property: 'value' } }
let do - Create structure 'let' in block
let(:object) do
{
"name" => "John",
"age" => 30,
}
end
context - Create structure 'context' at the rpec
context 'when number is' do
# logic
end
describe - Create structure 'describe' at the rpec
describe 'when value is number' do
it 'is equal zero' do
# logic
end
end
it - Create structure 'it' at the rpec
it 'number equal zero' do
# logic
end