GithubHelp home page GithubHelp logo

searls / jasmine-rails Goto Github PK

View Code? Open in Web Editor NEW
378.0 9.0 154.0 402 KB

A Jasmine runner for rails projects that's got you covered in both the terminal and the browser

Home Page: http://rubygems.org/gems/jasmine-rails

License: MIT License

Ruby 34.50% HTML 1.39% JavaScript 63.48% CoffeeScript 0.64%

jasmine-rails's Issues

Running tests in browser is very very slow

On the command line things run pretty fast. In the browser it takes forever and I get the feeling that every source file is being recompiled on each refresh.

Is there a way to see the list of files that are being recompiled on each run to confirm this?

Config file is:

src_dir: "app/assets"
spec_dir: "spec/javascripts"

src_files:
  - "javascripts/application.js"

asset_paths:
 - "lib/assets/javascripts"
 - "vendor/assets/javascripts"

spec_files:
  - "**/*[sS]pec.js.coffee"

helpers:
  - "support/**/*.js.coffee"

spec:javascripts errors in Rails 3.1

Hey @wireframe, can you confirm that the rake task works under Rails 3.1?

I'm testing on 3.1.3, and the browser works fine but under phantom the runner is getting a bizarre error that suggests stylesheet_link_tag("jasmine.css") is actually treating the CSS contents as if they were a filename. Really odd:

(rdb:1) p stylesheet_link_tag(jasmine_css_files[0])
*** Errno::ENAMETOOLONG Exception: File name too long - /Users/justin/tmp/bar/app/assets/images/body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }

#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
#HTMLReporter a { text-decoration: none; }
#HTMLReporter a:hover { text-decoration: underline; }
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
#HTMLReporter .version { color: #aaaaaa; }
#HTMLReporter .banner { margin-top: 14px; }
#HTMLReporter .duration { color: #aaaaaa; float: right; }
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
#HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
#HTMLReporter .runningAlert { background-color: #666666; }
#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
#HTMLReporter .passingAlert { background-color: #a6b779; }
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
#HTMLReporter .failingAlert { background-color: #cf867e; }
#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
#HTMLReporter .results { margin-top: 14px; }
#HTMLReporter #details { display: none; }
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter.showDetails .summary { display: none; }
#HTMLReporter.showDetails #details { display: block; }
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter .summary { margin-top: 14px; }
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
#HTMLReporter .description + .suite { margin-top: 0; }
#HTMLReporter .suite { margin-top: 14px; }
#HTMLReporter .suite a { color: #333333; }
#HTMLReporter #details .specDetail { margin-bottom: 28px; }
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
#HTMLReporter .resultMessage span.result { display: block; }
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }

#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*

RAISED "\xFF" from ASCII-8BIT to UTF-8

I'm getting RAISED "\xFF" from ASCII-8BIT to UTF-8 in my project.

DEBUG   Compiling help.jpg to /Users/mario/Projects/my_app/spec/tmp/assets/help.jpg
ERROR   ERROR: compiling /Users/mario/Projects/my_app/app/assets/javascripts/my_app/templates/profile_information/payment_methods/_form.jst.eco.haml RAISED "\xFF" from ASCII-8BIT to UTF-8
ERROR   Backtrace: /Users/mario/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jasmine-rails-0.4.5/lib/jasmine_rails/offline_asset_paths.rb:28:in `write'

It's get fix by opening the file in binary mode ('wb' instead of 'w') here:
https://github.com/searls/jasmine-rails/blob/master/lib/jasmine_rails/offline_asset_paths.rb#L28

I don't know how to verify my file, I already tried saving the file as UTF-8 but the error is still there.
I tried that because of this post: http://stackoverflow.com/questions/13909812/error-ruby-on-rails-encodingundefinedconversionerror-in-coursescontrollerat

Deprecation warning: Rails 4 compatibility

When I run rake spec:javascript within a Rails 4 app, I get the following deprecation warnings:

DEPRECATION WARNING: ActionController::Integration is deprecated and will be removed, use ActionDispatch::Integration instead. (called from call at /Users/aziz/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:236)
DEPRECATION WARNING: ActionController::IntegrationTest is deprecated and will be removed, use ActionDispatch::IntegrationTest instead. (called from call at /Users/aziz/.rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/task.rb:236)

rake spec:javascript - Phantom integration error in windows

Hi,

Apologies if this has been tackled already.

I've installed this jasmine-rails gems for rails in windows. If I define a route for the runner - as defined in the readme - and go to http://localhost:3000/specs I can see the jasmine test output with no problem.

But when I try to run it from the command line with rake spec:javascript I got the following error from phantomjs

Running `phantomjs "c:/ruby193/lib/ruby/gems/1.9.1/gems/jasmine-rails-0.4.8/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "file://c:/Dev/app/spec/tmp/runner.html?spec="`
Running: file://c:/Dev/app/spec/tmp/runner.html?spec=
can't load the address!

The problem here is the second argument passed to phantomjs which has file:// at the beginning.

If I go to the source code of the gem and remove that bit it works.

I don't know exactly if this is a problem with phantomjs, my enviroment or this gem.
Any idea?

Thanks in advance!

Asier

Changelog request

Please add a changelog to the repository to make it easier to track what changes have been made from version to version. Either a text file using Markdown or a wiki page are sufficient.

More conforming implementation of Function.prototype.bind

I had a hard time debugging why my specs were passing on the browser but failing on console, until I found the PhantomJS #10522 issue, and later found out that jasmine-rails already provides a bind shim (thus rendering my application's shim useless).

jasmine-rails' current shim might work for some cases (like #68), but it totally breaks my application. I tested MDN's first and simplest example, and it didn't work:

var x = 9; 
var module = {
  x: 81,
  getX: function() { return this.x; }
};

module.getX(); // 81

var getX = module.getX;
getX(); // 9, because in this case, "this" refers to the global object

// create a new function with 'this' bound to module
var boundGetX = getX.bind(module);
boundGetX(); // should be 81

Could we change the default shim to the one provided on MDN's page? I don't know if this will break @islandr's specs, but it seems to be a more conforming version. Here it is:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind

Failing test results in an error message from phantomjs

If all my specs pass then I don't get an error. If I have a failure then I get this error. Any thoughts? Only thing I could think of is perhaps on line 28 of the jasmine-rails_tasks.rake file phantomjs is upset about the missing spec_filter?

Rails 3.2.14
Ruby 2.0.0-p247
OS X 10.8.4
PhantomJS 1.9.0.

Thanks!
Jon

± RAILS_ENV=test bundle exec rake spec:javascript                 ruby-2.0.0-p247@bolstr
$ phantomjs "/Users/jon/.rvm/gems/ruby-2.0.0-p247@bolstr/gems/jasmine-rails-0.4.5/lib/tasks/runner.js" "file:///Users/jon/Sites/rails/bolstr/bolstr/spec/tmp/runner.html?spec="
Running: file:///Users/jon/Sites/rails/bolstr/bolstr/spec/tmp/runner.html?spec=
Starting...
Foo : does something else
  Expected 5 to be 3.

Finished
-----------------
2 specs, 1 failure in 0.005s.

ConsoleReporter finished
rake aborted!
Error executing command: phantomjs "/Users/jon/.rvm/gems/ruby-2.0.0-p247@bolstr/gems/jasmine-rails-0.4.5/lib/tasks/runner.js" "file:///Users/jon/Sites/rails/bolstr/bolstr/spec/tmp/runner.html?spec="
/Users/jon/.rvm/gems/ruby-2.0.0-p247@bolstr/gems/jasmine-rails-0.4.5/lib/tasks/jasmine-rails_tasks.rake:5:in `run_cmd'
/Users/jon/.rvm/gems/ruby-2.0.0-p247@bolstr/gems/jasmine-rails-0.4.5/lib/tasks/jasmine-rails_tasks.rake:28:in `block (2 levels) in <top (required)>'
/Users/jon/.rvm/gems/ruby-2.0.0-p247@bolstr/bin/ruby_noexec_wrapper:14:in `eval'
/Users/jon/.rvm/gems/ruby-2.0.0-p247@bolstr/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => spec:javascript
(See full trace by running task with --trace)

Rakefile seems wack

I tried to run the tests, but you accidentally copy/pasted something into your Rakefile.

I'm not sure what the Rakefile was supposed to be doing - I was going to try and fix it - but I failed.

Use erb within a spec

We have a rails initializer that adds a to_fraction to ruby float for getting rational numbers out of floats. We've recently been tasked with writing the same functionality in javascript/coffee. I was attempting to write a test that compared the javascript values to the results of the ruby values. I could write something that generated a spec based on the results of ruby but if the rules ever change I'd have to regenerate the test. Is there any possible way to execute the spec within the erb scope like naming it fraction_spec.coffee.erb or similar so that I could compare my coffee against <%= 1.25.to_fraction %> ?

Add --no-color flag

Colorized results are great, but they add unnecessary characters to console output in some cases (as in case where you're running test suite in Jenkins and looking at console output).

Adding ability to pass --no-color flag to the spec:javascript rake task would be very helpful.

jasmine-rails compiles C-Extension for QT, after gem has loaded even though QT is not being used

Well, that was a long issue title. My guess is the app is lazily looking for QT, to avoid 'sploding the gem. Problem is, I was never using QT (just running specs in Chrome, with the app mounted in the routes file).

It'd be good if this only happens when QT / headless is attempted to be used.

It'd be even better if the QT-related stuff were simply moved into a Gem. If you want QT/headless webkit, you need to install the gem.


$ puma
Puma 1.6.3 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:9292
Use Ctrl-C to stop
No runner found, attempting to compile...
make: *** No rule to make target `clean'.  Stop.
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.2/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/include -I. -F/usr/local/Cellar/qt/4.8.2/lib -o Page.o Page.cpp
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.2/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/include -I. -F/usr/local/Cellar/qt/4.8.2/lib -o Runner.o Runner.cpp
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.2/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/include -I. -F/usr/local/Cellar/qt/4.8.2/lib -o specrunner.o specrunner.cpp
/usr/local/Cellar/qt/4.8.2/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.2/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/include -I. -F/usr/local/Cellar/qt/4.8.2/lib -D__APPLE__ -D__GNUC__ Page.h -o moc_Page.cpp
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.2/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/include -I. -F/usr/local/Cellar/qt/4.8.2/lib -o moc_Page.o moc_Page.cpp
/usr/local/Cellar/qt/4.8.2/bin/moc -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.2/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/include -I. -F/usr/local/Cellar/qt/4.8.2/lib -D__APPLE__ -D__GNUC__ Runner.h -o moc_Runner.cpp
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.2/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/lib/QtWebKit.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.2/include -I. -F/usr/local/Cellar/qt/4.8.2/lib -o moc_Runner.o moc_Runner.cpp
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o jasmine-webkit-specrunner Page.o Runner.o specrunner.o moc_Page.o moc_Runner.o   -F/usr/local/Cellar/qt/4.8.2/lib -L/usr/local/Cellar/qt/4.8.2/lib -framework QtWebKit -framework QtGui -L/usr/local/Cellar/qt/4.8.2/lib -F/usr/local/Cellar/qt/4.8.2/lib -framework QtCore -framework QtNetwork 
127.0.0.1 - - [01/Oct/2012 13:09:07] "GET / HTTP/1.1" 200 - 19.4355
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /jasmine.css?body=1 HTTP/1.1" 200 6444 0.0088
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /application.js?body=1 HTTP/1.1" 200 585 0.0118
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /helpers/SpecHelper.js?body=1 HTTP/1.1" 200 - 0.0604
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /jquery_ujs.js?body=1 HTTP/1.1" 200 17894 0.0619
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /jasmine.js?body=1 HTTP/1.1" 200 68641 0.0085
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /app/dummy_spec.js?body=1 HTTP/1.1" 200 109 0.0305
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /jasmine-html.js?body=1 HTTP/1.1" 200 19065 0.0222
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET /jquery.js?body=1 HTTP/1.1" 200 266883 0.1098
127.0.0.1 - - [01/Oct/2012 13:09:08] "GET %2Ffavicon.ico HTTP/1.1" 200 - 0.0011

.js.coffee extentions

Hi,

When I write specs with .js.coffee extention they are not added to runner.html

Is it a bug ?

Thanks.

Rails.application.assets nil

Hi,

I have worked with jasmine-rails before without much problems.
However, I now want have added it into a newer project, using rails 3.2 and it didnt worked out of the box for me.

Rails.application.assets seems to be nil in sprockets.rb, which causes an error as soon as I load my (test) environment in for example rspec.

Am I forgetting something?

I haven't looked too deep into the code, but changing Rails.application.assets to Rails.application.config.assets (a method call I've used myself before) actually enables me to load my environment (and running the 0 tests I currently have)

jasmine-spec.js.erb should not minify test-only JS

This is coming from angular/angular.js#3534 - not sure if this is a reasonable request, but some external code that is supposed to be used only for testing may not have all the anti-minifying strategies implemented, thus breaking jasmine spec runs.

This can be prevented by config.assets.compress = false in test env (mind #53), but what if you want to run the unit tests with your app JS code minified?

phantomjs runner executes my tests twice

I'm on Rails 3.2.13 and using the asset pipeline. My jasmine.yml looks like this:

spec_files:
  - "**/*[Ss]pec.{js,coffee}"

I am testing an Angular controller that looks like this:

//= require angular
//= require angular-mocks
//= require application/app
//= require application/controllers/nav_ctrl

describe("NavCtrl", function() {
  // ... snip ...
})

(the reason for the 'application' directory inside 'javascripts/assets' is because there are more than one Angular apps in the Rails app)

When I run rake spec:javascript the phantomjs runner executes my "NavCtrl" tests twice.

I noticed that the generated spec/tmp/runner.html has a script tag for each of my dependencies and my spec files and it also includes a jasmine-specs.js file which appears to be all of the dependencies and spec files concatenated into a single file.

When I visit /specs in my app everything works okay (runs once) and the included jasmine-specs.js file is empty.

Any ideas what could be going on?

Thanks!

Testing two separate JS apps

Hello, just a question, not an issue.

I have two pages in my rails project. Those pages serve two different JS applications. Those JS application include different sets of javascripts. For example, one includes jQuery while the other Angular.js.

Is there a way to setup the testing so it has two separate 'profiles' for each of my javascript apps? I would like to separate those two JS apps in tests, so the included files from them do not conflict. Currently I am including all JS files in jasmine.yml.

src_files:
 - "application_one.{js,coffee}"
 - "application_two.{js,coffee}"

As you see - it includes all files from both apps and it can leads to conflicts. Is there a way to separate app1 and app2 in tests?

Thank you

Function.prototype.bind undefined for command line / phantomjs

I have a few dependencies that rely on function.bind and this prevents me from running my tests on the command line / ci service.

Ariya has made it clear they aren't going to patch this (https://groups.google.com/forum/#!msg/phantomjs/r0hPOmnCUpc/uxusqsl2LNoJ). Supposedly it won't be an issue for 2.0.

In the meantime it would be nice if we could include a simple polyfill like the one below.

// taken from https://gist.github.com/rxgx/1597825

/**
 * Function.bind Polyfill for ECMAScript 5 Support
 * Kangax's bind with Broofa's arg optimization.
 * http://www.broofa.com/Tools/JSLitmus/tests/PrototypeBind.html
 */
if (typeof Function.prototype.bind !== "function") {
    Function.prototype.bind = function() {
        var slice = Array.prototype.slice;
        return function(context) {
            var fn = this,
                args = slice.call(arguments, 1);
            if (args.length) {
                return function() {
                    return arguments.length
                        ? fn.apply(context, args.concat(slice.call(arguments)))
                        : fn.apply(context, args);
                };
            }
            return function() {
                return arguments.length
                    ? fn.apply(context, arguments)
                    : fn.call(context);
            };
        };
    };
}

Unable to complete "bundle install"

Is anyone else having this issue?

I'm seeing this issue with both v1.9.3 and v2.0.0 and bundler versions 1.3.5 and 1.4.0.rc.1.

ruby-2.0.0-p247@jasmine-rails ~/projects/jasmine-rails (master) ∴ bundle
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies.........
Retrying source fetch due to error (2/3): Bundler could not find compatible versions for gem "mime-types":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      mime-types (~> 1.16) ruby

    poltergeist (>= 0) ruby depends on
      mime-types (2.0)

Bundler could not find compatible versions for gem "sprockets":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      sprockets (~> 2.0.0) ruby

    jasmine-rails (>= 0) ruby depends on
      sprockets (2.10.0)

Bundler could not find compatible versions for gem "sprockets-rails":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      sprockets-rails (~> 2.0.0) ruby

    jasmine-rails (>= 0) ruby depends on
      sprockets-rails (0.0.0)


Resolving dependencies......
Retrying source fetch due to error (3/3): Bundler could not find compatible versions for gem "mime-types":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      mime-types (~> 1.16) ruby

    poltergeist (>= 0) ruby depends on
      mime-types (2.0)

Bundler could not find compatible versions for gem "sprockets":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      sprockets (~> 2.0.0) ruby

    jasmine-rails (>= 0) ruby depends on
      sprockets (2.10.0)

Bundler could not find compatible versions for gem "sprockets-rails":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      sprockets-rails (~> 2.0.0) ruby

    jasmine-rails (>= 0) ruby depends on
      sprockets-rails (0.0.0)


Resolving dependencies......
Bundler could not find compatible versions for gem "mime-types":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      mime-types (~> 1.16) ruby

    poltergeist (>= 0) ruby depends on
      mime-types (2.0)

Bundler could not find compatible versions for gem "sprockets":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      sprockets (~> 2.0.0) ruby

    jasmine-rails (>= 0) ruby depends on
      sprockets (2.10.0)

Bundler could not find compatible versions for gem "sprockets-rails":
  In Gemfile:
    jasmine-rails (>= 0) ruby depends on
      sprockets-rails (~> 2.0.0) ruby

    jasmine-rails (>= 0) ruby depends on
      sprockets-rails (0.0.0)

Upgrade to jasmine-core (~> 1.3.1) config error

Updating bundle with jasmine-rails as a dependency updates jasmine-core to the latest version. This has led to this error:

rvm/gems/ruby-1.9.3-p0@waldorf/gems/jasmine-rails-0.2.2/config/initializers/sprockets.rb:6:in `<top (required)>': uninitialized constant Jasmine::Config (NameError)

Any idea what needs to be done to allow jasmine-rails to play nice with 1.3.1?

Jasmine and force_ssl

We have config.force_ssl=true, and would like to keep it on if possible. If left on jasmine fails with a 301 since rails sees the request and attempts to redirect it to https. We've gotten around it temporarily by just setting force_ssl=false in env/test.rb.

Would there be any way to turn that off only for jasmine tests and not for all of the test environment?

browser not loading specs / assets

See also #4 (comment)

I'm running rails-3.2.6 and trying to use jasmine rails to run specs in the browser, but none of the javascript assets (specs or actual source code) are being loaded by the in browser spec_runner.

everything works fine from the command line

here's my jasmine.yml

# src_files
#
# Return an array of filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# src_files:
#   - lib/source1.js
#   - lib/source2.js
#   - dist/**/*.js
#
src_files:
  - "vendor/assets/**/*.{js,coffee}"
  - "lib/assets/**/*.{js,coffee}"
  - "app/assets/**/*.{js,js.coffee}"

# stylesheets
#
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# stylesheets:
#   - css/style.css
#   - stylesheets/*.css
#
stylesheets:
  - "vendor/assets/**/*.{css,styl}"
  - "lib/assets/**/*.{css,styl}"
  - "app/assets/**/*.{css,styl}"

# helpers
#
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
# Default: ["helpers/**/*.js"]
#
# EXAMPLE:
#
# helpers:
#   - helpers/**/*.js
#
helpers:
  - "helpers/**/*.{js,coffee}"

# spec_files
#
# Return an array of filepaths relative to spec_dir to include.
# Default: ["**/*[sS]pec.js"]
#
# EXAMPLE:
#
# spec_files:
#   - **/*[sS]pec.js
#
spec_files:
  - "./**/*[sS]pec.{js,js.coffee}"

# src_dir
#
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
# Default: project root
#
# EXAMPLE:
#
# src_dir: public
#
src_dir:

# spec_dir
#
# Spec directory path. Your spec_files must be returned relative to this path.
# Default: spec/javascripts
#
# EXAMPLE:
#
# spec_dir: spec/javascripts
#
spec_dir: spec/javascripts

I'll keep digging and submit a fix if I can...

Jasmine runner at '/specs' returned a 500 error

Full trace below:

rake spec:javascript --trace 
** Invoke spec:javascript (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute spec:javascript
rake aborted!
Jasmine runner at '/specs' returned a 500 error: Internal Server Error
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/jasmine-rails-0.4.5/lib/tasks/jasmine-rails_tasks.rake:23:in `block (2 levels) in <top (required)>'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/chrisnicola/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
./bin/rake:4:in `<main>'

Incorrect asset path in Rails 4 beta

I'm not sure if this expected behavior or if there's something I'm missing, but when I open the spec runner mounted at /specs in my application, none of my assets are loading. When I inspect the source, the assets are being referenced as <script src="/specs/assets/jasmine.js?body=1"></script> instead of <script src="/assets/jasmine.js?body=1"></script>. specs/ is being prepended to the asset path. I've been digging through the jasmine-rails source and the rails docs and I can't seem to resolve this issue. My specs do run in the console with jasmine-headless-webkit. Is it normal behavior for rails to namespace the asset path in an engine?

jasmine_rails/application.js won't compile because of missing prototype.js

When trying to load http://localhost:3000/specs as per instructions in the README, I get this in my Rails server log:

2011-Dec-18 17:46:49 +0100 []: Error compiling asset jasmine_rails/application.js:

2011-Dec-18 17:46:49 +0100 []: Sprockets::FileOutsidePaths: {{local app path}}/public/javascripts/prototype.js isn't in paths: {{complete sprocket search path}}

I could fix this by adding the prototype-rails gem (which makes prototype.js (amongst other files) available in the search path)) inside my test+development group of my gemfile, . But I guess I shouldn't need to.

I currently have zero Jasmine tests, so I can't really say if everything is working, but the base UI at http://localhost:3000/specs now loads up fine.

Interesting thing is that the log says jasmine_rails/application.js was compiled (sucessfully?) before.
All log messages generated by the request follow:

2011-Dec-18 17:46:48 +0100 []: Started GET "/specs" for 127.0.0.1 at 2011-12-18 17:46:48 +0100
2011-Dec-18 17:46:48 +0100 [action_controller]: Processing by JasmineRails::SpecRunnerController#index as HTML
2011-Dec-18 17:46:48 +0100 [action_view]: Rendered /Users/meryn/.rvm/gems/ruby-1.9.2-p290/gems/jasmine-rails-0.0.2/app/views/jasmine_rails/spec_runner/index.html.erb within layouts/jasmine_rails/spec_runner (0.3ms)

2011-Dec-18 17:46:48 +0100 []: Compiled jasmine_rails/application.css  (3ms)  (pid 3280)

2011-Dec-18 17:46:48 +0100 []: Compiled jasmine.css  (0ms)  (pid 3280)

2011-Dec-18 17:46:48 +0100 []: Compiled jasmine_rails/application.js  (12ms)  (pid 3280)

2011-Dec-18 17:46:48 +0100 []: Compiled jasmine.js  (0ms)  (pid 3280)

2011-Dec-18 17:46:48 +0100 []: Compiled jasmine-html.js  (0ms)  (pid 3280)

2011-Dec-18 17:46:48 +0100 []: Compiled json2.js  (2ms)  (pid 3280)
2011-Dec-18 17:46:48 +0100 [action_controller]: Completed 200 OK in 91ms (Views: 78.6ms | ActiveRecord: 0.0ms)

2011-Dec-18 17:46:49 +0100 []: Started GET "/assets/jasmine_rails/application.css?body=1" for 127.0.0.1 at 2011-12-18 17:46:49 +0100

2011-Dec-18 17:46:49 +0100 []: Served asset /jasmine_rails/application.css - 200 OK (0ms)

2011-Dec-18 17:46:49 +0100 []: Started GET "/assets/jasmine.css?body=1" for 127.0.0.1 at 2011-12-18 17:46:49 +0100

2011-Dec-18 17:46:49 +0100 []: Compiled jasmine.css  (0ms)  (pid 3280)

2011-Dec-18 17:46:49 +0100 []: Served asset /jasmine.css - 200 OK (46ms)

2011-Dec-18 17:46:49 +0100 []: Started GET "/assets/jasmine_rails/application.js" for 127.0.0.1 at 2011-12-18 17:46:49 +0100

2011-Dec-18 17:46:49 +0100 []: Compiled jasmine_rails/application.js  (12ms)  (pid 3280)

2011-Dec-18 17:46:49 +0100 []: Error compiling asset jasmine_rails/application.js:

2011-Dec-18 17:46:49 +0100 []: Sprockets::FileOutsidePaths: {{local app path}}/public/javascripts/prototype.js isn't in paths: {{complete sprocket search path}}

2011-Dec-18 17:46:49 +0100 []: Served asset /jasmine_rails/application.js - 500 Internal Server Error

testbed gemfiles always conflict

I don't have a good answer to this other than to replicate @searls's vagrant setup, but the local gemfiles always conflict on remote.

Posting this in case someone has a clever work around.

diff --git a/gemfiles/rails-3.1.lock b/gemfiles/rails-3.1.lock
index a343eca..b9bad33 100644
--- a/gemfiles/rails-3.1.lock
+++ b/gemfiles/rails-3.1.lock
@@ -1,5 +1,5 @@
 PATH
-  remote: /vagrant/projects/ruby/jasmine-rails
+  remote: /Users/zmoazeni/projects/jasmine-rails
   specs:
     jasmine-rails (0.4.7)
       jasmine-core (~> 1.3)
diff --git a/gemfiles/rails-3.2.lock b/gemfiles/rails-3.2.lock
index 15c20c5..3232035 100644
--- a/gemfiles/rails-3.2.lock
+++ b/gemfiles/rails-3.2.lock
@@ -1,5 +1,5 @@
 PATH
-  remote: /vagrant/projects/ruby/jasmine-rails
+  remote: /Users/zmoazeni/projects/jasmine-rails
   specs:
     jasmine-rails (0.4.7)
       jasmine-core (~> 1.3)
diff --git a/gemfiles/rails-4.0.lock b/gemfiles/rails-4.0.lock
index 7f01529..960a9a5 100644
--- a/gemfiles/rails-4.0.lock
+++ b/gemfiles/rails-4.0.lock
@@ -1,5 +1,5 @@
 PATH
-  remote: /vagrant/projects/ruby/jasmine-rails
+  remote: /Users/zmoazeni/projects/jasmine-rails
   specs:
     jasmine-rails (0.4.7)
       jasmine-core (~> 1.3)

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Erroneous jasmine.rake warning

I am getting a warning that tells me I can delete jasmine.rake (leftover from jasmine init), but when I do delete it, the task is no longer present.

jasmine-rails is in our :development and :test groups

margolis$ grep -C 2 jasmine Gemfile

group :development, :test do
  gem "jasmine-rails"
end

The jasmine.rake task file exists:

margolis$ ls lib/tasks/ | grep jasmine
jasmine.rake

So when I run rake jasmine:ci, I get the warning

margolis$ bundle exec rake jasmine:ci

            You no longer need to have jasmine.rake in your project, as it is now automatically loaded
            from the Jasmine gem. To silence this warning, set "USE_JASMINE_RAKE=true" in your environment
            or remove jasmine.rake.

/Users/margolis/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec /Users/margolis/.rvm/gems/ruby-1.9.3-p0/gems/jasmine-1.2.0/lib/jasmine/runner.rb --colour --format progress
Waiting for jasmine server on 60945...
Waiting for jasmine server on 60945...
Waiting for jasmine server on 60945...

[snip]

When I remove the file, the task is missing, so the prior warning must be wrong.

margolis$ rm lib/tasks/jasmine.rake 
margolis$ bundle exec rake jasmine:ci
rake aborted!
Don't know how to build task 'jasmine:ci'

(See full trace by running task with --trace)

Error: Sprockets::FileOutsidePaths

Hello,

After setting the src_dir in in jasmine.yml, it shows the following error in browsers (/specs). The tests work fine from command line: bundle exec jasmine-headless-webkit. How can I make it work from both command line and browser?

jasmine.yml

src_files:
  - "mobile_application.js"
...
src_dir: app/assets/javascripts

Error in browser:

Error: Sprockets::FileOutsidePaths: /home/evgeny/web/digitalsafe/mobile_application.js isn't in paths: /home/evgeny/web/digitalsafe/spec/javascripts, /home/evgeny/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/jasmine-core-1.1.0/lib/jasmine-core, /home/evgeny/web/digitalsafe/app/assets/images, /home/evgeny/web/digitalsafe/app/assets/javascripts, /home/evgeny/web/digitalsafe/app/assets/stylesheets, /home/evgeny/web/digitalsafe/vendor/assets/stylesheets, /home/evgeny/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/jasmine-rails-0.0.3/app/assets/javascripts, /home/evgeny/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/jasmine-rails-0.0.3/app/assets/stylesheets, /home/evgeny/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/jquery-rails-1.0.19/vendor/assets/javascripts, /home/evgeny/web/digitalsafe/app/assets/javascripts [http://localhost:3000/assets/jasmine_rails/application.js:1]
ReferenceError: jasmine is not defined [http://localhost:3000/specs:15]

Can't find variable jsApiReporter

I have installed the jasmine-rails gem, and installed phantomJS with homebrew (I'm running OSX 10.8.4) and my jasmine.yml was working fine with the plain jasmine gem. Now when I run

bundle exec rake spec:javascript

I get the following error:

$ phantomjs "/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/jasmine-rails-0.4.5/lib/tasks/runner.js" "file:///Users/user/workspace/bacon/spec/tmp/runner.html?spec=BFApp.Views.ActivityFeedTab"
Running: file:///Users/user/workspace/bacon/spec/tmp/runner.html?spec=BFApp.Views.ActivityFeedTab
ERROR: ReferenceError: Can't find variable: jsApiReporter
TRACE:
-> phantomjs://webpage.evaluate(): 3
rake aborted!
Error executing command: phantomjs "/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/jasmine-rails-0.4.5/lib/tasks/runner.js" "file:///Users/user/workspace/bacon/spec/tmp/runner.html?spec=BFApp.Views.ActivityFeedTab"
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/jasmine-rails-0.4.5/lib/tasks/jasmine-rails_tasks.rake:5:in run_cmd' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/jasmine-rails-0.4.5/lib/tasks/jasmine-rails_tasks.rake:28:inblock (2 levels) in <top (required)>'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/task.rb:246:in call' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/task.rb:246:inblock in execute'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/task.rb:241:in each' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/task.rb:241:inexecute'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/task.rb:184:in block in invoke_with_call_chain' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/task.rb:177:ininvoke_with_call_chain'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/task.rb:170:in invoke' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:143:ininvoke_task'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:101:in block (2 levels) in top_level' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:101:ineach'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:101:in block in top_level' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:110:inrun_with_threads'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:95:in top_level' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:73:inblock in run'
/Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:160:in standard_exception_handling' /Users/user/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.4/lib/rake/application.rb:70:inrun'
/Users/user/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in eval' /Users/user/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in

'

Runner fails with error if there is a describe block with no it block inside

This actually be a Jasmine issue, but I'm not sure. If I have a spec file with a describe block/function but no it block, it fails with the following error:

$ phantomjs "/Users/aziz/.rvm/gems/ruby-2.0.0-p247@rails_fisheye/gems/jasmine-rails-0.4.5/lib/tasks/runner.js" "file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/runner.html?spec="
Running: file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/runner.html?spec=
Starting...
ERROR: TypeError: 'undefined' is not an object (evaluating 'reporterView.suiteComplete')
TRACE:
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine-html.js: 92
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 1788
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2475
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2522
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2106
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2049
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2523
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2096
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2049
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 2145
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine.js: 802
 -> file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/assets/jasmine-boot.js: 19 (in function "execJasmine")
rake aborted!
Error executing command: phantomjs "/Users/aziz/.rvm/gems/ruby-2.0.0-p247@rails_fisheye/gems/jasmine-rails-0.4.5/lib/tasks/runner.js" "file:///Users/aziz/Sandbox/ruby/rails/fisheye/spec/tmp/runner.html?spec="
/Users/aziz/.rvm/gems/ruby-2.0.0-p247@rails_fisheye/gems/jasmine-rails-0.4.5/lib/tasks/jasmine-rails_tasks.rake:5:in `run_cmd'
/Users/aziz/.rvm/gems/ruby-2.0.0-p247@rails_fisheye/gems/jasmine-rails-0.4.5/lib/tasks/jasmine-rails_tasks.rake:28:in `block (2 levels) in <top (required)>'
/Users/aziz/.rvm/gems/ruby-2.0.0-p247@rails_fisheye/bin/ruby_noexec_wrapper:14:in `eval'
/Users/aziz/.rvm/gems/ruby-2.0.0-p247@rails_fisheye/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => spec:javascript
(See full trace by running task with --trace)

Not sure why, or if this is normal...

src_files is silently ignored

In jasmine-rails 0.5.4, files listed in src_files are silently ignored. Viewing source in the browser shows they simply aren't requested, but no warnings or errors are raised.

Similarly in CI mode, they aren't loaded.

I have rolled back to 0.4.5 and that works fine. Haven't tried versions in between yet.

My jasmine.yml is identical to the freshly generated one besides adding a few files to src_files.

wrong constant name JasmineRails/specRunnerController when running under Rails 3.1.12

Hi,

I'm on a project with Rails 3.1 as the version and I am getting the error below when trying to navigate to /specs. I'm using 0.5.4 of jasmine-rails.

I define the mount at the top of routes.rb:

Project31::Application.routes.draw do

  mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)

And receive this error:

wrong constant name JasmineRails/specRunnerController
/Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/inflector/methods.rb:124:in const_defined?' /Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/inflector/methods.rb:124:inblock in constantize'
/Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/inflector/methods.rb:123:in each' /Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/inflector/methods.rb:123:inconstantize'
/Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:528:in block in initialize' /Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:550:inyield'
/Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:550:in []' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/routing/route_set.rb:67:incontroller_reference'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/routing/route_set.rb:52:in controller' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/routing/route_set.rb:31:incall'
/Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in block in call' /Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:inblock in recognize'
/Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:68:in optimized_each' /Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:inrecognize'
/Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in call' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/routing/route_set.rb:538:incall'
/Users/kevinold/project31/.gems/gems/railties-3.1.12/lib/rails/engine.rb:456:in call' /Users/kevinold/project31/.gems/gems/railties-3.1.12/lib/rails/railtie/configurable.rb:30:inmethod_missing'
/Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/prefix.rb:26:in call' /Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:inblock in call'
/Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in block in recognize' /Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:75:inoptimized_each'
/Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in recognize' /Users/kevinold/project31/.gems/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:incall'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/routing/route_set.rb:538:in call' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/best_standards_support.rb:17:incall'
/Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/etag.rb:23:in call' /Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/conditionalget.rb:25:incall'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/head.rb:14:in call' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/params_parser.rb:21:incall'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/flash.rb:243:in call' /Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/session/abstract/id.rb:195:incontext'
/Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/session/abstract/id.rb:190:in call' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/cookies.rb:331:incall'
/Users/kevinold/project31/.gems/gems/activerecord-3.1.12/lib/active_record/query_cache.rb:64:in call' /Users/kevinold/project31/.gems/gems/activerecord-3.1.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:477:incall'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/callbacks.rb:29:in block in call' /Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/callbacks.rb:392:in_run_call_callbacks'
/Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/callbacks.rb:81:in run_callbacks' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/callbacks.rb:28:incall'
/Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/sendfile.rb:101:in call' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/remote_ip.rb:48:incall'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/show_exceptions.rb:47:in call' /Users/kevinold/project31/.gems/gems/railties-3.1.12/lib/rails/rack/logger.rb:13:incall'
/Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/methodoverride.rb:24:in call' /Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/runtime.rb:17:incall'
/Users/kevinold/project31/.gems/gems/activesupport-3.1.12/lib/active_support/cache/strategy/local_cache.rb:72:in call' /Users/kevinold/project31/.gems/gems/rack-1.3.10/lib/rack/lock.rb:15:incall'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/middleware/static.rb:61:in call' /Users/kevinold/project31/.gems/gems/airbrake-3.1.2/lib/airbrake/rack.rb:42:incall'
/Users/kevinold/project31/.gems/gems/airbrake-3.1.2/lib/airbrake/user_informer.rb:12:in call' /Users/kevinold/project31/.gems/gems/railties-3.1.12/lib/rails/engine.rb:456:incall'
/Users/kevinold/project31/.gems/gems/railties-3.1.12/lib/rails/application.rb:143:in call' /Users/kevinold/project31/.gems/gems/rack-test-0.6.2/lib/rack/mock_session.rb:30:inrequest'
/Users/kevinold/project31/.gems/gems/rack-test-0.6.2/lib/rack/test.rb:230:in process_request' /Users/kevinold/project31/.gems/gems/rack-test-0.6.2/lib/rack/test.rb:123:inrequest'
/Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/testing/integration.rb:297:in process' /Users/kevinold/project31/.gems/gems/actionpack-3.1.12/lib/action_dispatch/testing/integration.rb:33:inget'
/Users/kevinold/project31/.gems/gems/jasmine-rails-0.5.4/lib/jasmine_rails/runner.rb:56:in get_spec_runner' /Users/kevinold/project31/.gems/gems/jasmine-rails-0.5.4/lib/jasmine_rails/runner.rb:13:inblock in run'
/Users/kevinold/project31/.gems/gems/jasmine-rails-0.5.4/lib/jasmine_rails/runner.rb:46:in override_rails_config' /Users/kevinold/project31/.gems/gems/jasmine-rails-0.5.4/lib/jasmine_rails/runner.rb:9:inrun'
/Users/kevinold/project31/.gems/gems/jasmine-rails-0.5.4/lib/tasks/jasmine-rails_tasks.rake:7:in `block (2 levels) in <top (required)>'
Tasks: TOP => spec:javascript

I have not been able to find a solution. Any help would be appreciated.

Jasmine runner at '/specs' returned a 404 error: Not Found

I bundled/installed jasmine-rails and rspec-rails at the same time, and installed rspec. The folder structure is now:

specs->javascript->support, and both specs and support have their respective helpers.

In routes, I have:

mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)
//JasmineRails exists and can be accessed in the console

In the jasmine.yml:

spec_files:

  • "*/[Ss]pec.{js,coffee}"
    //because I am using the asset pipeline

When I run

bundle exec rake spec:javascript

I get:

Jasmine runner at '/specs' returned a 404 error: Not Found

I am not sure why. I am new to Jasmine, maybe there is some Jasmine set up that I have not done?

Rails 3.2.11, jasmine-rails 0.4.2, rspec-rails 2.6.0

Jasmine runner at '/specs' returned a 302 error: Found

I'm using jasmine-rails-0.4.5 and devise-2.2.3 in a standard rails-3.2 app. When I run bundle exec rake spec:javascript, in order to run the jasmine specs, I'm getting the following message: "Jasmine runner at '/specs' returned a 302 error: Found"

Since I'm using devise any request against the server that is not authenticated yet, it's being redirected to the log-in page. So far so good, that is the expected behavior from devise, but jasmine-rails need to access the /specs url in order to run the tests, so when it tries to access this it, it's getting this error: "Jasmine runner at '/specs' returned a 302 error: Found"

In my routes.rb file I added this line: "mount JasmineRails::Engine => "/my_specs" if defined?(JasmineRails)"

Jasmine includes sprocket files twice.

Steps to reproduce:

  • create new rails 3.2.* app
  • add jasmine-rails gem
  • set src_files to application.js in jasmine.yml
  • mount jasmine engine in the route file
  • go to path specified in the previous step
  • see this:
<head>
    <!--- some html here --->
    <link href="/assets/jasmine.css?body=1" media="screen" rel="stylesheet" type="text/css">
    <script src="/assets/jasmine.js?body=1" type="text/javascript"></script><style type="text/css"></style>
    <script src="/assets/jasmine-html.js?body=1" type="text/javascript"></script>
    <script src="/assets/jquery.js?body=1" type="text/javascript"></script>
    <script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
    <script src="/assets/jquery.js?body=1" type="text/javascript"></script>
    <script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
    <script src="/assets/application.js?body=1" type="text/javascript"></script>
    <!--- some other stuff here --->
</head>

JasmineRails::JhwAdapter.new.js_files returns this:

[
  ".../gems/1.9.1/gems/jasmine-core-1.2.0/lib/jasmine-core/jasmine.js",
  ".../gems/1.9.1/gems/jasmine-core-1.2.0/lib/jasmine-core/jasmine-html.js",
  ".../gems/1.9.1/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery.js",
  ".../gems/1.9.1/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery_ujs.js",
  ".../my-app/app/assets/javascripts/application.js"
]

Basically, it expands sprocket require calls from application.js file and then include the file itself. Rails javascript_include_tag includes all sprockets requires manually and then tries to include applications.js, sees sprocket require calls in it, expands them and includes jquery and jquery_ujs again.

Expected behavior here would be just stupidly include application.js and let rails handle the rest.

rake spec:javascript ran in the wrong rails environment

This might be a special case but it's a issue nonetheless. The rake spec:javascript command runs the specs in the wrong environment; that is, not in the test environment. I am using SSL in my app, which I've disabled in the test environment and I redirect all non-HTTPS traffic to their HTTPS equivalent (again, disabled in the test environment). When I ran rake spec:javascript I got the following error:

Jasmine runner at '/specs' returned a 301 error: Moved Permanently

This error is logical in my case, but I think that the rake task should run in the test environment anyway.

I managed to avoid the error using the following command:

RAILS_ENV=test rake spec:javascript

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.