On Dec 21, 2007 9:19 PM, Michael Schuerig <[EMAIL PROTECTED]> wrote:
>
> On Friday 21 December 2007, Nicolás Sanguinetti wrote:
> > For those of you who happen to also use ruby, and particularly rspec,
> > I've been playing with a clone of rspec in javascript :)
> > I suck at naming stuff, so it's called js-spec, and depends on Proto
> > 1.6.
> >
> > http://code.google.com/p/js-spec/
>
> > To Do:
> > - code an HTML report :)
>
> Did you have a look at JSSpec?

I only dad a brief look into it.

> http://jania.pe.kr/aw/moin.cgi/JSSpec
>
> The UI looks nice, but I like your syntax better.

:)

> > Feedback is much appreciated ;-)
>
> I've tried this simplistic spec
>
> var C = Class.create({
>   m: function() { return 'Hello'; }
> });
>
> with (Spec) {
>   describe('A new C', function() { with (this) {
>     before('each', function() {
>       this.c = new C();
>     });
>     it('should respond to m', function() {
>       this.c.should(respondTo('m')); //'this' is apparently needed
>     });
>     it('should greet me', function() {
>       this.c.should(be('Hello'));
>     });
>   }});
> }
> Spec.run();

You can avoid this if you want, but then you have to also avoid it in
the before("each"). I did it so every context runs sandboxed in a new,
clean object, so you avoid name clashes.

> I've run it in Firefox 2.0.0.11 using Prototype 1.6.0.1. The output I
> get is this
>
> [FAIL] should respond to m with: undefined
> [FAIL] should greet me with: undefined

Yeah, it would have worked if you used 'return this.c.should...'. I
know it's stupid, it was a quick way out to have it working yesterday.
I'll commit in a little while the changes which include the HTML
reporter and stop requiring 'return' in every test, among other things
:)

Thanks for testing it out :)

> I've stepped through it in Firebug, however not very systematically. At
> least for the second test, apparently at some point the string 'Hello'
> is converted into an array ['H', 'e', 'l', 'l', 'o'].
>
> Michael
>
> --
> Michael Schuerig
> mailto:[EMAIL PROTECTED]
> http://www.schuerig.de/michael/

-Nicolas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to