Questions tagged [teaspoon]

A JavaScript test runner for Rails. Can run tests both in the browser as well as headless.

Teaspoon is a JavaScript test runner that can run the tests either in the browser or headless tests using PhantomJS or Selenium WebDriver. It ships with support for Jasmine, Mocha, QUnit and AngularJS. The project is being run on github.

46 questions
0
votes
1 answer

Trying to get angular mock to work with teaspoon-jasmine

So i'm working in ruby on rails, and I've using it with AngularJS 1 for the first time, and therefore am setting up the unit testing for angularjs inside rails for the first time. I can test rails with rspec no problem, but i've been struggling to…
Jerrod
  • 115
  • 12
0
votes
0 answers

How to write a hash to work with a two parameter splat

I am trying to pass some additional options to a Selenium web driver for running JavaScript tests using Teaspoon. I am unable to get it to recognize the opts. My config code: client = Selenium::WebDriver::Remote::Http::Default.new client.timeout…
Julie
  • 1,941
  • 3
  • 17
  • 30
0
votes
1 answer

How to test angular directive that use templateUrl with angular-rails-templates

I'm using teaspoon as the test runner, which load all template files (using angular-rails-templates), which populate the templates module with stuff like this: angular.module("templates").run(["$templateCache", function($templateCache) { …
Phương Nguyễn
  • 8,747
  • 15
  • 62
  • 96
0
votes
2 answers

Unit test for window.location.href within an AJAX request using mocha/chai

I need to test whether or not window.location.href = data.redirect_path ever happens. How would I mock this in Sinon without it redirecting me away from my test runner? I'm using chai/mocha.js with teaspoon as my test runner. $.ajax({ type:…
Joshua Baker
  • 188
  • 1
  • 4
0
votes
1 answer

Uninitialized constant Teaspoon::Framework

Upgraded teaspoon 0.9.1 to teaspoon-jasmine 2.3.4. After running rails generate teaspoon:install getting "Error: uninitialized constant Teaspoon::Framework." error [WARNING] Could not load generator…
0
votes
1 answer

Accurately testing a JavaScript analytics delivery system in Rails

I work on a large Rails app. We have a JavaScript feature which acts as a general analytics data delivery system. It announces general analytics data based on various page interaction events (clicks, page views, etc) but is framework agnostic, in…
meowsus
  • 13
  • 5
0
votes
1 answer

Teaspoon error while testing simple script

I am testing below code logic: handleOnMediaPlaying: function(event){ // body... if(isAd){ if(event.data.percentComplete >= 25 && !firstQuartileFlag){ firstQuartileFlag = true; } if(event.data.percentComplete >= 50 &&…
0
votes
0 answers

Is it possible to use 'fs' (filesystem) module inside page executed by PhantomJS?

I want to have access to filesystem on a page that is rendering by PhantomJS headless browser. I catch an error when JS code is trying to interact with filesystem var fs = require('fs'); ... ReferenceError: Can't find variable: require Is there…
petRUShka
  • 9,812
  • 12
  • 61
  • 95
0
votes
1 answer

Fail run Teaspoon CLI but success in browser

I have difficulties to run JS test suite CLI. Although tests pass in a web browser. $ rake teaspoon Starting the Teaspoon server... Teaspoon running default suite at http://127.0.0.1:56362/teaspoon/default FFFFFFFFFFFFFFFFFFF Failures: 1) …
mpugach
  • 591
  • 5
  • 15
0
votes
0 answers

"not a valid identifier" error when running Teaspoon

When running teaspoon, I'm getting the following errors: rake teaspoon Starting the Teaspoon server... Teaspoon running default suite at http://127.0.0.1:64790/teaspoon/default sh: line 25: `BASH_FUNC_set_shell_label%%': not a valid…
rainslg
  • 415
  • 5
  • 11
0
votes
1 answer

Ruby Teaspoon Unknown default suite

I run in my rails project rake teaspoon and error output is Teaspoon::UnknownSuite: Unknown suite "default\" can any one explain me what this problem means?
baxri
  • 307
  • 1
  • 10
0
votes
1 answer

Teaspoon + Mocha + Istanbul Coverage

Teaspoon is working showing my tests with Mocha in: localhost:3000/teaspoon/default I read that I can use Istanbul with Teaspoon for code coverage reports. I installed with npm istanbul, but I don't know how to run it with teaspoon. I would like to…
0
votes
0 answers

Teaspoon unit test ember notify message with promise

I am testing this code, the syntax is in coffee script. functionName: -> a = @get('content') a.on('didUpdate', => @get("controllers.application").notify title: "Success!" message: "Updated!" type:…
user2751691
  • 401
  • 2
  • 10
  • 32
0
votes
1 answer

Is it possible to use factory_girl.js with teaspoon?

As part of my trying to learn web development, I have reached a point were I have some coffeescript classes I would like to test inside my rails environment. I have a rails 4.03 app that I have been working on (it is based off the rails…
nPn
  • 16,254
  • 9
  • 35
  • 58
0
votes
1 answer

Invalidating an Ember Simple Auth session while testing

Typically, when you invalidate an Ember Simple Auth session, it'll reload the application. This is great for security in production, but while testing, it can be a headache. I'm running my tests using Teaspoon, and any time I logout a test user,…
nullnullnull
  • 8,039
  • 12
  • 55
  • 107