mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-16 02:14:17 +00:00
first commit of a million rails snippets, conditions missing, command implementation missing...
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: cla
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: Create functional test class
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
|
||||
class ${1:Model}ControllerTest < ActionController::TestCase
|
||||
deft$0
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: art
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_redirected_to
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_redirected_to ${2::action => "${1:index}"}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: asre
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_response
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_response :${1:success}, @response.body$0
|
||||
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: asg
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert(var = assigns(:var))
|
||||
## condition: "source.ruby"
|
||||
# --
|
||||
assert(${1:var} = assigns(:$1), "Cannot find @$1")
|
||||
$0
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: artnpp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_redirected_to (nested path plural)
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_redirected_to ${10:${2:parent}_${3:child}_path(${4:@}${5:$2})}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: artnp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_redirected_to (nested path)
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_redirected_to ${2:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: artpp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_redirected_to (path plural)
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_redirected_to ${10:${2:model}s_path}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: artp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_redirected_to (path)
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_redirected_to ${2:${12:model}_path(${13:@}${14:$12})}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: asrj
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_rjs
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_rjs :${1:replace}, ${2:"${3:dom id}"}
|
||||
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: ass
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: assert_select
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
assert_select '${1:path}'${2:, :${3:text} => ${4:'${5:inner_html}'}}${6: do
|
||||
$0
|
||||
end}
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: deftg
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: def test_should_get_action
|
||||
## condition: "meta.rails.functional_test"
|
||||
# --
|
||||
def test_should_get_${1:action}
|
||||
${2:@${3:model} = ${4:$3s}(:${5:fixture_name})
|
||||
}get :${1}${6:, :id => @$3.to_param}
|
||||
assert_response :success
|
||||
$0
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: deftp
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: def test_should_post_action
|
||||
## condition: "meta.rails.functional_test"
|
||||
# --
|
||||
def test_should_post_${1:action}
|
||||
${3:@$2 = ${4:$2s}(:${5:fixture_name})
|
||||
}post :${1}${6:, :id => @$2.to_param}, :${2:model} => { $0 }
|
||||
assert_response :redirect
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user