Re: How to add files from the app server into my tests

53 views
Skip to first unread message

Vojta Jína

unread,
Jul 24, 2012, 9:38:43 PM7/24/12
to testa...@googlegroups.com
Hey Daniel,

you don't have application.js in the config file, so the file is not loaded.
So add "../*.js" or something into your config file.

Did you know, you can let testacular watch the files and automatically
run, when anything change ?
autoWatch = true;

It can autostart browsers as well, so that you don't have to do it:
browsers = ['Chrome', 'PhantomJS'];

V.

On Tue, Jul 24, 2012 at 5:56 PM, <dnei...@squareup.com> wrote:
> Hi Guys,
>
> This is my first post. I'm having some issues getting setup in my rails
> application for testsing with testacular. I've setup a grunt to compile my
> coffee script tests, and setup a test file etc.
>
> You can see my setup on https://gist.github.com/3172672
>
> I can get the specs to run, and update which is great, but so far I haven't
> been able to get it load my file at
> http://localhost:3000/assets/application.js
>
> Can anyone shed light on what I've missed?
>
> Cheers
> Daniel
>
> --
> You received this message because you are subscribed to the Google Groups
> "testacular" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/testacular/-/pccbgJyAzlYJ.
> To post to this group, send email to testa...@googlegroups.com.
> To unsubscribe from this group, send email to
> testacular+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testacular?hl=en.

Vojta Jína

unread,
Jul 24, 2012, 11:25:46 PM7/24/12
to testa...@googlegroups.com
Hey Daniel,

it's better if you let testacular to serve it - it takes advantage of
heavy caching and reloading only files that has actually changed.
And you don't wanna start rails server in order to do JS unit testing...

My advice is to separate the JS stuff generated by rails, into a
single file + have static version of it (mock) to enable quick unit
testing.
Then, all you have to do in order to unit test, is just executing
"testacular config.js" and start editing your files (it can capture
browser in the background and run tests whenever you change any file)
- that's what you want !

Anyway, you can serve urls as well, just add into the config:
'http://localhost:3000/js/application.js'


Btw your msgs get moderated, I guess that's because you are not member
of this mailing list ?
You can join the group and select, no email - than, you should be fine
posting...

V.

On Tue, Jul 24, 2012 at 7:25 PM, <dnei...@squareup.com> wrote:
> Hi
>
> Thanks. I started using grunt to setup watches and compiling from coffee
> script, I didn't know about the autoWatch option.
>
> The application.js file is part of a rails application and should be served
> by the rails server (it gets pumped through the asset pipeline etc) Is there
> anyway to include a URL rather than a relative file?
>
> Cheers
> Daniel
> https://groups.google.com/d/msg/testacular/-/sVHNJ0GU5wUJ.

Daniel N

unread,
Jul 27, 2012, 7:50:47 PM7/27/12
to testa...@googlegroups.com
Hi

I've moved over to my mailing list email so hopefully it shouldn't get moderated.

I've added this as a test to my config file, but it doesn't seem to be working :(

files = [
  JASMINE,
  JASMINE_ADAPTER,
  '*_spec.js',
  '*/*_spec.js'
];

The browser tries to load

/absolutehttp://........

Is the testacular service supposed to proxy /absolute requests?

Cheers
Daniel

Vojta Jína

unread,
Jul 28, 2012, 1:03:39 PM7/28/12
to testa...@googlegroups.com
Dan, this was bug in 0.0.15 or something, can update ?
npm -g update testacular

V.
Reply all
Reply to author
Forward
0 new messages