Hello–
On Nov 8, 2008, at 7:42 AM, Pau C. wrote:
One way I did that with Ruby was learning BDD with RSpec. So here’s
Which
frameworks, books, screencasts, etc?
Wise of you to ask. I’ll be curious to hear what others are using.
I’ve settled on jsspec for right now. It’s not perfect, and it’s not
at all integrated into the Rails test tasks, but it’s pretty natural
when you are using rSpec for your Ruby code to use something with
similar syntactic sugar. You may want to have a read of this thread
re: screw.unit:
http://www.nabble.com/RSpec-vs-Screw.Unit-td20022203.html
My personal sense is that jsspec is just fine for what I’m using it to
accomplish, but that Screw.Unit is a more developed framework. That’s
from reading, not side-by-side testing.
In terms of learning how, there is no way that’s more correct than how
you learned rSpec. You probably looked at a lot of blog posts, some
better than others, maybe looked at the Peepcode, and got going. Now,
you know how to describe the behaviors. All you are doing is
translating it into a slightly different syntax. So, you might wind up
with something like this js (some functions of a simple UBB parser):
describe(‘replaceLinks in embeddeded URL case’, {
‘should replace UBB embedded link with HTML link without protocol’:
function() {
testString = ‘[url=www.foo.com]’;
value_of(replaceLinks(testString)).should_be(‘www.foo.com’);
},
‘should replace UBB embedded link with HTML link with protocol’:
function() {
testString = ‘[url=http://www.foo.com]’;
value_of(replaceLinks(testString)).should_be(‘www.foo.com’);
},
‘should replace UBB typical link without protocol’: function() {
testString = ‘click here’;
value_of(replaceLinks(testString)).should_be(‘click here’);
},
‘should replace UBB typical link without protocol’: function() {
testString = ‘click here’;
value_of(replaceLinks(testString)).should_be(‘click here’);
}
});
Granted, the readability is not as good as rSpec’s, but Javascript
ain’t Ruby. I’m not certain how this would map to Screw.Unit, but it
didn’t look like the mapping was too difficult.
HTH