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
26
votes
2 answers

angular mock `module` resulting in '[Object object] is not a function'

I'm trying to create some unit tests in Angular using Jasmine being run through Teaspoon. The tests are running, however I have a simple test just to test the existence of a controller that is failing. I have the following test setup. //= require…
PaReeOhNos
  • 4,338
  • 3
  • 30
  • 41
6
votes
2 answers

rails teaspoon Testing in engine Not loading *_spec.js

i'm working on an engine (gem) that has some js code to be tested but seems i can't get it working. I've followed the wiki article and set a basic example, but i'm only getting 0 examples, 0 failures. Steps done: Added s.add_development_dependency…
ngelx
  • 494
  • 4
  • 12
4
votes
0 answers

How do I access Rails fixtures from javascript unit tests?

We have done a lot of work testing on the rails side of our application now and are starting to try out unit testing on the javascript side using Teaspoon/Mocha/Sinon/Expectjs. Now that we are digging deeper we are trying to find the right way to…
user44484
3
votes
1 answer

How to include script tag in teaspoon-Jasmine testing

How do I get the stripe script loaded so Stripe is defined during my Teaspoon-Jasmine testing. Error: Failure/Error: ReferenceError: Stripe is not defined Teaspoon Tests: describe("Stripe", function() { var paymentElement ; …
user2012677
  • 5,465
  • 6
  • 51
  • 113
3
votes
2 answers

Testing DOM Ready with Teaspoon and Jasmine

I'm writing tests using Teaspoon and Jasmine for my Rails app. I understand, for the most part, how to test standalone js modules but I'm not sure how to go about testing a module that binds to a DOM ready event like with JQuery's…
rewolf
  • 5,561
  • 4
  • 40
  • 51
3
votes
1 answer

Visit pages using PhantomJS directly when writing specs with TeaSpoon - Jasmine

I'm trying to write a Javascript spec for my Rails 3.2 application using Teaspoon (the Jasmine version). I'm trying to write a spec that does something like this describe("Fun", function() { var page = require('webpage').create() //ERROR …
Ingo
  • 802
  • 9
  • 21
3
votes
1 answer

Which gem should be used for testing javascript with rails jasminerice or jasmine-rails or teaspoon?

I'm getting in to testing javascript in rails 4, but it seems there are two options. The jasminerice gem, which looks like it's been round for a while but maybe not so up to date and the jasmine-rails gem which looks like it's being released more…
rainkinz
  • 10,082
  • 5
  • 45
  • 73
2
votes
1 answer

Teaspoon fails hard after Rails update 4.2.9 to 4.2.10

Teaspoon has broken after update Rails from 4.2.9 to 4.2.10. Nothing else has changed with project. Here's the failure when test suite hits teaspoon: Starting the Teaspoon server... [33337] Puma starting in cluster mode... [33337] * Version 3.10.0…
Meltemi
  • 37,979
  • 50
  • 195
  • 293
2
votes
1 answer

How do I check if element exists with Mocha Chai Sinon?

I would like to know how can I check if an element on the UI exists by id or class. I'm using teaspoon-mocha, Sinon, and chai. I tried next but it doesn't work: expect($('my-id')).to.be.true;
Jakub
  • 2,367
  • 6
  • 31
  • 82
2
votes
0 answers

Error running teaspoon : rake teaspoon failed

I just installed 'teaspoon' as follows: group :development, :test do gem "teaspoon-jasmine" end Then I used this command : rails generate teaspoon:install Then I run: bundle exec teaspoon And I get following error: rake teaspoon Starting the…
Sandip Subedi
  • 1,039
  • 1
  • 14
  • 34
2
votes
1 answer

Teaspoon: "Can't find variable " (Rails)

So this seems like a weird error, i've just started using teaspoon and im trying to get it set up on a rails project. I have a very simple function im trying it out on: export function add(value,value2) { return value+value2; } Simple right? and…
msmith1114
  • 2,717
  • 3
  • 33
  • 84
2
votes
0 answers

Testing AngularJS with teaspoon

I am trying to use teaspoon with Jasmine suite to test my AngularJS scripts in Ruby on Rails. While running "rake teaspoon", I am getting the below error - Starting the Teaspoon server... Teaspoon running default suite at…
2
votes
1 answer

"Listening" to AJAX calls from Capybara / Selenium - Rails

I have an app which makes AJAX calls on certain events (e.g. .click). Is there a way to "listen" to real AJAX requests from feature specswith Capybara / Selenium? I tried the Teaspoon gem, but apparently its only allowing accessing fixture URLs (as…
dimitry_n
  • 2,939
  • 1
  • 30
  • 53
2
votes
0 answers

Testing CoffeeScript class with Rails teaspoon gem

I have a really basic class Seat that looks like this: class Seat constructor: (params) -> @x = params.x @y = params.y @seat_number = params.seat_number @table_number = params.table_number @radius = params.radius if radius? …
ThomYorkkke
  • 2,061
  • 3
  • 18
  • 26
2
votes
0 answers

Stubbing $.get function using teaspoon

I have a javascript function like the one below function_name: function(){ var self = this; $.get('something',{ target : 'something', param1 : 'somevalue', }) } I need to stub $.get function using teaspoon. could I get…
Lohith
  • 891
  • 1
  • 6
  • 5
1
2 3 4