Snippets for Ruby testing assertions don't generate correctly
Reported by Stuart Ellis | March 11th, 2010 @ 01:50 PM
Snippets for Ruby assertions don't create substitution sections correctly. Other snippets for Ruby tests work correctly.
Observed on Windows XP SP3 with Redcar 0.3.4.
To reproduce:
- Open a text file with a .rb extension
- Choose Bundles > Ruby > Tests
- Choose assert_equal
The following appears in the text file:
assert_equalsnippet_paren.rb
expected,
actualsnippet_paren.rb end
assert_instance_of, assert_match etc. have the same behavior, as does flunk.
Comments and changes to this ticket
-
Daniel Lucraft March 13th, 2010 @ 12:05 PM
- State changed from new to open
Yep. This is a tricky one. That snippet_paren.rb thing means run this Ruby script and substitute in the result.
We're not planning to support the running of arbitrary shell code, because it's a big pain to make it cross platform. So we're going to have to replace this snippet (and others like it) with something that does something similar inside the Redcar application.
I suppose something like:
assert_equal`Ruby::SnippetSupport.snippet_paren`expected, actual`Ruby::SnippetSupport.snippet_paren`
and a corresponding class that Redcar makes available in the snippet context:
class Ruby::SnippetSupport def self.snippet_paren # port the snippet_paren.rb code to here... end end
... would do the job.
-
Mat Schaffer January 23rd, 2011 @ 05:37 AM
- Tag changed from snippets ruby test to snippet
Like the backticks for ruby idea. But I'm not sure I like the idea of code like that going into redcar proper.
What do you think about putting a redcar_support.rb file into the Snippets folders that need it? Then Redcar can require that when loading the Snippets and that'll define whatever needs to happen to make the snippets work in ruby land.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A programmer's text editor for Gnome.