bradphelan / jasminerice Goto Github PK
View Code? Open in Web Editor NEWPain free coffeescript testing under Rails 3.1
Pain free coffeescript testing under Rails 3.1
When I run
rails g jasminerice:install
I get:
[WARNING] Could not load generator "generators/jasminerice/install_generator". Error: uninitialized constant Jasminerice.
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/jasminerice-0.0.10/lib/generators/jasminerice/install_generator.rb:3:in `<top (required)>'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/generators.rb:300:in `block (2 levels) in lookup'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/generators.rb:296:in `each'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/generators.rb:296:in `block in lookup'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/generators.rb:295:in `each'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/generators.rb:295:in `lookup'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/generators.rb:152:in `find_by_namespace'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/generators.rb:169:in `invoke'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands/generate.rb:12:in `<top (required)>'
/Users/Dom/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands.rb:29:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Could not find generator jasminerice:install.
Im running Ruby 2.0.0 and its a regular rails app.
It would be great to show xit
and xdescribe
when running a suite, so we know what specs we've forgotten about. : ) What do you think?
Any suggestions for how best to run my jasminerice tests from the command line so that I can run them in a jenkins build? I have erb templates in my js files so I need them to be served from rails.
I'm using the guard to compile my coffeescript:
guard 'coffeescript', :input => 'spec/javascripts', :output => 'spec/javascripts/compiled'
I do this so livereload will reload the jasmine tests when I change the JS. I'm also using jasminerice though and when I do this I get the tests included twice. I think this is caused by this line in spec.js.coffee:
I tried changing the spec.js.coffee to just bring in the specs from the folders I want:
Unfortunately when I do that the javascript I'm testing (under /app/assets/javascripts) no longer gets brought in (which surprised me a little).
I'm planning on adding some integration level specs (using rspec/capybara) so we know things will keep working before merging pull requests.
I'm trying to upgrade to the latest capybara and capybara webkit. I've tried upgrading the following gems to the latest version, and even grabbing jasminerice's master branch. Below you'll find the gem versions along with the full stack trace. The tests pass and don't crash with the following:
gem 'capybara-webkit', '~> 0.12.1'
gem 'capybara', '~> 1.1.2'
gem 'jasmine', '~> 1.2.1'
gem 'jasminerice', '~> 0.0.10'
gem 'jasminerice-runner', '~> 0.0.3'
The offending setup:
gem 'capybara-webkit', '~> 0.14.1'
gem "capybara", "~> 2.0.2"
gem 'jasmine', '~> 1.3.1'
gem 'jasminerice', git: 'git://github.com/bradphelan/jasminerice.git'
gem 'jasminerice-runner', '~> 0.0.4'
gem "json", "~> 1.7.6"
And the error:
$ rake jasminerice:run --trace
** Invoke jasminerice:run (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute jasminerice:run
Running jasmine specsrake aborted!
nesting of 101 is too deep
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/json-1.7.6/lib/json/common.rb:155:in `parse'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/json-1.7.6/lib/json/common.rb:155:in `parse'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/capybara-webkit- 0.14.1/lib/capybara/webkit/browser.rb:148:in `evaluate_script'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/capybara-webkit-0.14.1/lib/capybara/webkit/driver.rb:50:in `evaluate_script'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/capybara-2.0.2/lib/capybara/session.rb:292:in `evaluate_script'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/jasminerice-runner-0.0.4/lib/jasminerice-runner/runner.rb:64:in `wait_for_finished'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/jasminerice-runner-0.0.4/lib/jasminerice-runner/runner.rb:18:in `run'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/jasminerice-runner-0.0.4/lib/tasks/jasminerice-runner.rake:8:in `block (2 levels) in <top (required)>'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/noah/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rakegrowl-0.3.1/lib/rakegrowl.rb:33:in `top_level_with_growl'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/bin/rake:19:in `load'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/bin/rake:19:in `<main>'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `eval'
/Users/noah/.rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => jasminerice:run
Any ideas on the cause of this?
Currently getting error:
Could not find gem 'jasminerice (= 0.1.0) ruby' in the gems available on this machine.
even though tagged on github. Can you push the 0.1.0 tag to ruby gems so we won't have to use git in our Gemfile?
Seems like my changes to the fixture are not being reflected, is there a configuration to disable caching of fixtures?
I know this has been an issue before, but it doesn't seem to be solved entirely.
The known issue:
describe "SomeClass", ->
it "fails", ->
,,,,,
http://localhost:8000/jasmine
0 specs, 0 failureshttp://localhost:8000/jasmine?debug_assets=true
ExecJS::ProgramError
The ExecJS error is what I expect to see when I have a syntax error.
From Rails config/environments/test.rb
:
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
config.assets.allow_debugging = true
Is this something we can fix easily? The main reason it's a bother is because I use guard-jasmine
.
Thanks.
Jasminerice doesn't seem to work with the Rails plugin.
rails plugin new mine
cd mine
bundle install
# install the jasminerice
cd tests/dummy
bundle exec rails s
# http://localhost:3000/jasmine -> RoutingError
Is there a way to make it work for the dummy test application?
Trying to run my specs in a CI environment with the following rake task:
Guard::JasmineTask.new do |task|
task.options = '-s thin -p 3000 -u http://localhost:3000/jasmine -e development'
end
Running rake guard:jasmine
results in the following:
Guard::Jasmine starts thin test server on port 3000 in development environment.
Waiting for Jasmine test runner at http://localhost:3000/jasmine
ERROR: Jasmine test runner isn't available: end of file reached
rake aborted!
The spec couldn't be run: exit'
Tasks: TOP => guard:jasmine
(See full trace by running task with --trace)
The specs run without hitch when I bootup the server and hit http://localhost:3000/jasmine after running rackup -p 3000 -s thin -E development
. Thoughts?
I have this structure:
.
├── app
│ ├── assets
│ │ ├── javascripts
│ │ │ └── wizard
│ │ │ ├── wizard.js.coffee
├── spec
│ ├── javascripts
│ │ └── wizard
│ │ └── wizard_object_mother_spec.js.coffee
│ │ └── wizard_spec.js.coffee
Then in the wizard_spec.js.coffee I have:
#= require wizard/wizard
#= require ./wizard_object_mother_spec
describe "Wizard", ->
describe "When a wizard has only one step", ->
beforeEach ->
#@wizardName = "Wizard Name"
#@firstStep = new AlwaysCompleteAndValidStep()
@wizard = new Wizard(@wizardName, null)
...
The problem is the specs in wizard_spec.js.coffee can't see the classes in "wizard.js.coffee" and "wizard_object_mother_spec.js.coffee". I can see that Jasmine is loading in the files but they're not being brought into the Javascript file containing the tests. I'm thus wondering whether I'm doing something wrong or if this is not supported?
Declare your Jasminerice::HelperMethods (perhaps put inside lib/) to make helpers available to jasminerice fixtures
This notification is useless and has been introduced with #32.
It should be mentioned in the documentation that helper methods are possible.
When I use Jasminerice, all the JavaScript files are combined into a single spec.js file. Is it possible to change this behavior to be more like Rails development mode, where the JavaScript files are all served as their original individual files? Is there a setting I am overlooking?
Thanks,
Hello,
not sure whether it is an issue with Jasmine or Jasminerice. I am experementing with the Jasmine specs from the Peepcode screencast on BackboneJS-I, and I am trying to run the following spec:
describe "Album", ->
beforeEach ->
@album = new Tunes.Models.Album(albumData[0])
it "creates from data", ->
expect(@album.get("tracks").length).toEqual 2
describe "isFirstTrack()", ->
it "identifies first track", ->
expect(@album.isFirstTrack(0)).toBeTruthy
In the resulting spec output, I would expect to see a nested block for isFirstTrack(), but instead I only see a spec for "it creates from data"
The non-coffee version would be:
describe("Album", function () {
beforeEach(function () {
this.album = new Album(albumData[0]);
});
it("creates from data", function () {
expect(this.album.get('tracks').length).toEqual(2);
});
describe("...", function() {
it("creates from data", function () {
expect(this.album.get('tracks').length).toEqual(2);
});
})
});
What are your experiences with having "describes" nested in each other?
I am rather new to this.... thanks in any case for your feedback, and hopefully this helpful for you too!
I followed your instructions and wrote a simple failing test in coffeescript. The test fails as expected but i also get an "ReferenceError: jQuery is not defined at [object Object].cleanUp (http://localhost:3000/assets/jasmine-jquery-1.3.1.js?body=1:67:3)" error.
I then put #=require application
in spec.js.coffee (which in fact requires a copy of jQuery for the application itself) and the error disappears. Is this as it should be or did i missed something in requiring jQuery?
I'm moving a project over from another tool (TestTrack, which has been stuck at "Version 0.0.4" for a year now). I have several score spec files named using camelCase rather than underscores. Given the notation in `spec.js.coffee' that
This pulls in all your specs from the javascripts directory into Jasmine:
spec/javascripts/__spec.js.coffee
spec/javascripts/__spec.js
spec/javascripts/*_spec.js.erb
IT IS UNLIKELY THAT YOU WILL NEED TO CHANGE THIS FILE
it's actually necessary that I change that file, and bring in all my files named, e.g., Something/Or/Other/FooBarBazSpec.js.coffee
.
It Would Be Very Nice if there were some configuration option available so that jasminerice
could change its default spec file pattern. I haven't (yet) delved into your code (being scalp-deep in my own), but would that be terribly difficult or burdensome?
I am just trying to get setup with JS testing, but get a blank results page no matter what I try. My setup so far is very simple:
/spec/javascripts/spec.js.coffee
#= require_tree ./
/spec/javascripts/presentation_spec.js.coffee
describe "Presentation", ->
it "is alive", ->
true
That's it. I just get a completely blank results page, whether I try it via Pow or Thin.
The name of this software makes it hard to google for answers!
Currently if one installs the latest jasminerice Ruby gem, they'll be installing dated code.
Since the gem isn't being pushed to rubygems.org all the improvements made since the gem was first published aren't available unless one points to the repo here as the source. But there's a catch - if someone installed the rubygems.org version of the gem (which is a fairly likely scenario), then points to this repo as the source in a Gemfile, for example, they still won't get any updates since the version number remains the same as the cached gem that's likely sitting on their machine.
I'm guessing @bradphelan would need to push the new gem after bumping the gem spec version number up.
I've done the basic install of jasmine rice (with the generator) and get this error every time I run my specs:
ActionView::MissingTemplate - Missing template spec/javascripts/fixtures/example_fixture with {:locale=>[:en], :formats=>[:html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :coffee]}. Searched in:
06:17:54 logs.1 | * "/Users/brandon/Documents/code/chat"
06:17:54 logs.1 | * "/Users/brandon/Documents/code/chat/app/views"
06:17:54 logs.1 | * "/Users/brandon/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/jasminerice-b5370e3cf293/app/views"
06:17:54 logs.1 | * "/Users/brandon/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/devise-fdd47d74dbf2/app/views"
06:17:54 logs.1 | * "/Users/brandon/Documents/code/chat"
06:17:54 logs.1 | * "/"
The tests currently pass with that happening, as I suppose I'm not checking anything in the fixture.
Don't know why it's not looking in the correct spot for the fixture. I haven't changed the .yml
config file, or the fixture location.
I am using Rails 4.
Perhaps it's time for a new release? 0.0.10 was released on October 15, 2012.
There's stuff in the README that is not present in the existing gem version, e.g. loading json fixtures.
I'm using jasminerice 0.0.7 with guard-jasmine 0.7.2. I ran into a problem with guard-jasmine timing out ( guard/guard-jasmine#5 ) and eventually traced it to being caused by a test in which I had a document.write
- example: https://gist.github.com/1322112 .
Then I started checking the test in my browser (Chrome 14.0.835.202) and found that the document.write
was blowing away the entire document body see https://gist.github.com/1322112 .
I have since changed my test to use $('body').append
(jquery), but I thought you should know about it, or at least document it for others.
Jasmine 1.2.0.rc1 is out with pretty cool UI. I would love to see it is available with jasminerice also.
Currently delegation methods ( live
, on
) are not working with toHandle
, this has been implemented on jasmine-jquery.
I've recently been getting the following error:
*** [err :: aws] Unexpected token: operator (<)
*** [err :: aws](in /home/application/application/releases/20111103150947/vendor/bundle/gems/jasminerice-0.0.7/app/assets/javascripts/application.js)
I think it started after upgrading to Rails 3.1.1.
Is it possible that application.js should be renamed to application.js.erb so that it will be preprocessed by ERB?
I wonder if there is any way to run all of the Jasminerice specs through rake on a CI server?
The jasmine:ci
has totally separate configuration and has no access to the Rails assets.
Any suggestions? Or maybe it's already possible?
The Multiple Suites wiki contains configuration for routes.rb that is incorrect. Specifically, the the :suite path variable will not work with the Jasminerice::SpecController#index method:
def index
@specenv = params[:environment].try(:concat, "_spec") || "spec"
end
I'd like to see the continued use of the :suite parameter and change the SpecController method, replacing :environment with :suite.
I am currently on a little project using Rails 4.0.0 (bf095770e561c51cebeb5a556afc03a21d9e603c to be specific).
I wanted to use jasminerice but it turned out that this gem is somehow not compatible.
Even after fixing the errors, that prevent the server to start (see my fork for details, the running of the specs doesn't work (going to /jasmine just puts out a blank page).
It looks like the path to the whole asset pipeline is wrong:
...
<link href="/jasmine/assets/jasmine.css?body=1" media="screen" rel="stylesheet" />
<link href="/jasmine/assets/application.css?body=1" media="screen" rel="stylesheet" />
<link href="/jasmine/assets/spec.css?body=1" media="screen" rel="stylesheet" />
<script src="/jasmine/assets/jasmine.js?body=1"></script>
<script src="/jasmine/assets/jasmine-html.js?body=1"></script>
<script src="/jasmine/assets/jasmine-jquery-1.4.2.js?body=1"></script>
<script src="/jasmine/assets/jasminerice.js?body=1"></script>
<script src="/jasmine/assets/jquery.js?body=1"></script>
<script src="/jasmine/assets/jquery_ujs.js?body=1"></script>
<script src="/jasmine/assets/hello.js?body=1"></script>
<script src="/jasmine/assets/application.js?body=1"></script>
<script src="/jasmine/assets/sanity_spec.js?body=1"></script>
<script src="/jasmine/assets/sanityjs_spec.js?body=1"></script>
<script src="/jasmine/assets/spec.js?body=1"></script>
...
It all starts with /jasmine.
See my example project for details
Please remove application.js and maybe application.css from the gem.
First the application.js is not used anywhere, and contains ERB tags that won't be evaluated because there is no extension. This file conflicts with default Rails files and can only introduce headache in some edge cases.
After running the test examples i got this error:
00:02:14 - INFO - Foo
00:02:14 - INFO - ✘ encountered a declaration exception
00:02:14 - INFO - ➤ ReferenceError: Can't find variable: $ in jasmine-jquery-1.5.2.js on line 146
00:02:14 - INFO - ➤ ReferenceError: Can't find variable: $ in jasmine-jquery-1.5.2.js on line 146
00:02:14 - ERROR - 1 spec, 2 failures
And so on to every test. ps: using rails 4.
I realize that Jasmine is a BDD test framework, but for those of us who haven't jumped on the rspec bandwagon, having coffee/javascript testing alongside our other tests would be wonderful.
Will the test be accessible from the production environment?
I mean, will www.example.com/jasmine
show the tests?
Unfortunately this is currently not working when used in a mountable engine.
dev4:rails vincent$ rails -v
Rails 3.2.2
dev4:rails vincent$ rvm use 1.9.3
Using /Users/vincent/.rvm/gems/ruby-1.9.3-p125
dev4:rails vincent$ rails plugin new gajas --mountable
create
create README.rdoc
create Rakefile
create gajas.gemspec
create MIT-LICENSE
create .gitignore
create Gemfile
create app
create app/controllers/gajas/application_controller.rb
create app/helpers/gajas/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/gajas/application.html.erb
create app/assets/images/gajas
create app/assets/images/gajas/.gitkeep
create config/routes.rb
create lib/gajas.rb
create lib/tasks/gajas_tasks.rake
create lib/gajas/version.rb
create lib/gajas/engine.rb
create app/assets/stylesheets/gajas/application.css
create app/assets/javascripts/gajas/application.js
create script
create script/rails
create test/test_helper.rb
create test/gajas_test.rb
append Rakefile
create test/integration/navigation_test.rb
vendor_app test/dummy
run bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.2.0)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.3)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.32)
Using activerecord (3.2.3)
Using activeresource (3.2.3)
Using bundler (1.0.22)
Using rack-ssl (1.3.2)
Using json (1.6.6)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.3)
Using rails (3.2.3)
Using gajas (0.0.1) from source at /xyz/gajas
Using jquery-rails (2.0.2)
Using sqlite3 (1.3.5)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
now lets go into the engine root cd gaja
dev4:gajas vincent$ cat gajas.gemspec
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "gajas/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "gajas"
s.version = Gajas::VERSION
s.authors = ["TODO: Your name"]
s.email = ["TODO: Your email"]
s.homepage = "TODO"
s.summary = "TODO: Summary of Gajas."
s.description = "TODO: Description of Gajas."
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.2.3"
s.add_dependency "guard-jasmine"
s.add_dependency "jasminerice"
s.add_dependency "jquery-rails"
s.add_development_dependency "sqlite3"
end
lets bundle and generate bundle && guard init jasmine
, now create the necessary files and dirs
mkdir -p spec/javascripts
echo -e "#=require application\n#=require_tree ./" > spec/javascripts/spec.js.coffee
echo -e "/*\n * add css using =require application\n */" > spec/javascripts/spec.css
now lets give it a go test/dummy/script/rails s
,
going to http://localhost:3000/jasmine
and http://localhost:3000/gaja/jasmine
returns No route matches [GET] "/jasmine"
and No route matches [GET] "/gaja/jasmine"
respectively
Guard encounters the following problem:
dev4:gajas vincent$ bundle exec guard
Guard could not detect any of the supported notification libraries.
Guard is now watching at '/xyz/gajas'
ERROR: Jasmine test runner isn't available at http://localhost:8888/jasmine: Connection refused - connect(2)
ERROR: Jasmine test runner isn't available at http://localhost:8888/jasmine: Connection refused - connect(2)
I've followed all the steps from the readme and got this error on the localhost:3000/jasmine
Template is missing
Missing template jasminerice/spec/index, jasminerice/application/index with {:handlers=>[:erb, :builder, :slim], :formats=>[:html], :locale=>[:ru, :ru]}. Searched in: * "/home/whitered/projects/p27/app/views" * "/home/whitered/.rvm/gems/ruby-1.9.2-p180/gems/jasminerice-0.0.6/app/views" * "/home/whitered/.rvm/gems/ruby-1.9.2-p180/gems/devise-1.4.2/app/views"
rake jasmine:ci does not work because it expects javascript files and does run the rails server ( mount the asset pipeline ).
I've had an attempt at it but altering selenium path to localhost:/jasmine just renders a File not found: /jasmine error.
This would be extremely useful for those hoping to run jasmine specs through selenium in a browser (useful when working with WebGL).
From the Readme, it looks like you can establish only one jasmine rice environment:
- CoffeeScript: spec/javascripts/spec.js.coffee
- StyleSheet: spec/javascripts/spec.css
- Goto: http://localhost:3000/jasmine
I'd like to organize my tests into separate suites. Is there a way to establish multiple environments with jasminerice? Something like this in routes.rb:
mount Jasminerice::Engine => "/suite1", :spec => "spec/javascripts/suite1.js.coffee"
mount Jasminerice::Engine => "/suite2", :spec => "spec/javascripts/suite2.js.coffee"
Tx, Andy
I'd like to add some extra elements to the html file my specs are being run in.
Currently, I have to put this custom file in /app/views/jasminerice/spec/index.html.haml
I'd like to be able to just put that in my javascript/spec folder, like you can with CSS. Shall I put together a patch, or is this possible at the moment?
I ran into an issue when testing a backbone.js based app where once I changed the browsers pushState fixtures wouldn't load anymore because the fixturesPaths are all set to relative urls.
Right now my fix is to include the following in my spec_helper:
jasmine.getFixtures().fixturesPath = '/jasmine/fixtures'
jasmine.getStyleFixtures().fixturesPath = '/jasmine/fixtures'
jasmine.getJSONFixtures().fixturesPath = '/jasmine/fixtures/json'
However, would it make sense to just do this by default?
ReferenceError: Can't find variable: jQuery in http://localhost:3000/assets/jasmine-jquery-1.3.1.js?body=1 (line 67)
I got this error when following the instructions in the README for jasminerice 0.0.8. jasminerice-jquery is dependent on jQuery so I added #=require jquery
to the spec.js.coffee file and it solved the problem.
Shouldn't this dependency be met automatically? If thats not the case: maybe update the README with instructions?
For some reasons, my spec is always failed because it could not json fixtures.
data = loadJSONFixtures('places.json')
➤ Error: JSONFixture could not be loaded: spec/javascripts/fixtures/json/places.json (status: error, message: undefined) in jasmine-jquery-1.4.2.js on line 269
We need a rake task
rake jasmine:ci
that will spit out the results of the tests automagically.
I'm trying to follow the compatibility with require.js instructions, but when I set:
jasmine.rice.autoExecute = false
I get an error in the js console when jasmine runs:
Uncaught TypeError: Cannot set property 'autoExecute' of undefined
Any idea what I might be doing wrong here? I'm trying to get require.js support going in my tests, but this seems to be standing in the way.
Something like this:
s.add_dependency( 'haml' , 'coffee-rails')
I can't used gem without 'coffee-rails' in my Gemfile. It's need for compiling .coffee files in jasminerice. For example: jasminerice.js.coffee
I've tried to use loadFixtures function but it does not work. I inspected and find out the following code is used for loading fixture:
jasmine.Fixtures.prototype.createContainer_ = function(html) {
var container = jQuery('
but as far as I know we don't have the body tag at that time yet. So I thought it may be a bug
Hi,
I think it might be worth documenting the fact your bringing in jasmine-jquery.
Ta,
Colin
Some conversation is happening on another related issue #44 (comment), that's closed. Figured it was worth creating a new issue to revive this. While I'm asking for the same thing, the reasoning is different. From the other issue:
Any chance you reconsider this, but for a different reason? Every project that uses jasmine-rice -- which is quite a few, it's good stuff -- end up depending on haml (weighing in at 370k+) whether they use it or not. We no longer use haml (in favor of slim), but haml ends up being installed and loaded anyway. Lots of gems include things that either aren't really critical for the normal operation of the gem (not this case) or they use something for a thin sliver of functionality (this case).
The end result is that a simple rails project bloats up to 50+ gems (directly and transitively), with some deps not really being necessary (because they're there to support obscure features) or they're included to and barely used.
This bloat is giving rails and the rails community a bad rep, which is unfortunate.
As @nick-desteffen mentioned, haml is saving you only a few lines of code in one file. Is that really worth dragging along an extra 370k gem? Thanks.
Hello to the jasminerice team!
First off, thanks for creating a great gem! My team are greatly enjoying being able to write unit tests for the Coffeescript in our Rails project using Coffeescript.
I am having an issue running my tests at [localhost]/jasmine
, however. Without explicit patching, I see errors like this:
Error: Fixture could not be loaded: jasmine/fixtures/kaiso.html (status: error, message: undefined) in http://localhost:3000/assets/jasmine-jquery-1.3.1.js?body=1 (line 105)
([object Object],"error","Not Found ")@http://localhost:3000/assets/jasmine-jquery-1.3.1.js?body=1:105
([object Object],[object Array])@http://localhost:3000/assets/jquery.js?body=1:1076
([object Object],[object Array])@http://localhost:3000/assets/jquery.js?body=1:1194 done(404,"Not Found "...
Firebug shows that the request URL for the errors were coming from the request to get to my fixtures with No route matches [GET] "/jasmine/jasmine/fixtures/kaiso.html"
I was able to get my tests running by hacking line 34 in jasmine-jquery-1.3.1js to look like this.fixturesPath = 'fixtures';
, to remove that extra /jasmine
in the URL.
Has anyone ever seen any behavior like this? Are there perhaps some configurations I am missing?
For the record, here are my routes for Jasmine:
jasminerice /jasmine Jasminerice::Engine
Routes for Jasminerice::Engine:
GET /spec/:spec_id/fixtures/:filename(.:format) jasminerice/spec#fixtures
spec_index GET /spec(.:format) jasminerice/spec#index
/fixtures/:filename(.:format) jasminerice/spec#fixtures
root / jasminerice/spec#index
And the details of my environment:
I have installed jasminerice in my gem file like this:
group :test, :development do
gem 'jasminerice'
My spec/javascripts/spec.js.coffee looks like this
I had to explicitly reference my application. js file while all the examples show the spec.js.coffee looking like this:
My specs all run when I go through the /jasmine route but the application.js and application.css are not being compiled when I run through a non /jasmine route.
It works fine if I remove the jasmine rice gem from the gem file.
Is there anything obvious I am doing wrong? I am running rails 3.2.2.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.