Questions tagged [konacha]

Konacha ([koh-NAH-cha], a type of green tea) is a Rails engine that allows you to test your JavaScript with the Mocha test framework and chai assertion library. It is similar to Jasmine and Evergreen, but does not attempt to be framework agnostic. By sticking with Rails, Konacha can take full advantage of features such as the asset pipeline and engines.

Konacha ([koh-NAH-cha], a type of green tea) is a Rails engine that allows you to test your JavaScript with the Mocha test framework and chai assertion library.

It is similar to Jasmine and Evergreen, but does not attempt to be framework agnostic. By sticking with Rails, Konacha can take full advantage of features such as the asset pipeline and engines.

Read more and/or get Konacha at https://github.com/jfirebaugh/konacha

28 questions
26
votes
5 answers

Simulate Hover in jQuery

Currently, I have some jQuery/Javascript code that toggles the css class 'ui-state-hovered' when a user hovers the mouse over certain elements, and I want to write a test in konacha to test this piece of code. How would I write this function in…
yz10
  • 721
  • 3
  • 8
  • 12
12
votes
2 answers

Testing JavaScript views in Rails

What is the best way to test JavaScript views (test to see if a page works JavaScript wise) in Rails? So lets say I have a page called /users/new that contains a form that does something. I would like to have it so that I submit the form and the…
matsko
  • 21,895
  • 21
  • 102
  • 144
6
votes
1 answer

Ember.js/Rails integration testing with fixtures

I am trying to set up a testing environment for my ember.js rails application, and have decided to use Konacha with mocha and chai. The largest problem I have at the moment is setting up fixtures for my ember models in the testing environment. Would…
Bobby Hazel
  • 145
  • 4
6
votes
1 answer

Sprockets/Rails: Find all files Sprockets knows how to compile

For Konacha, a Rails engine for testing Rails apps, we need a way to find all files that Sprockets can compile to JavaScript. Right now we use something like Dir['spec/javascripts/**/*_spec.*'] but this picks up .bak, .orig, and other backup…
Jo Liss
  • 30,333
  • 19
  • 121
  • 170
4
votes
1 answer

Angular testing, using mocha, unexpected requests

In my angular tests I keep getting a Error: Unexpected request: GET 'some/rails/view.html' I'm using konacha for testing, which uses mocha instead of jasmine. The project is based around a Rails app which is the reason for using konacha. Here's a…
Luke
  • 2,053
  • 1
  • 18
  • 25
3
votes
1 answer

Testing actions in ember.js with sinon and konacha

I have a simple route in my app like this: Dash.PostsNewRoute = Em.Route.extend({ model: function() { return this.store.createRecord('post'); }, actions: { saveForm: function() { this.modelFor('postsNew').save(); } …
ArashM
  • 1,379
  • 13
  • 18
3
votes
1 answer

Why is Poltergeist not registered as a driver for Capybara when used with Guard/Konacha?

I'm having trouble using Poltergeist as the driver for Capybara in Konacha tests run with Guard. I have the following in config/initializers/konacha.rb: Konacha.configure do |config| require 'capybara/poltergeist' config.spec_dir =…
Joseph Siefers
  • 1,282
  • 1
  • 12
  • 23
2
votes
0 answers

ember-auth authentication while testing ember.js app

How does one go about authenticating a user while testing an ember application with ember-auth? I am using Konacha with mocha and chai and following the exact same testing structure as this app.. https://github.com/dgeb/ember_data_example. confused…
2
votes
1 answer

Ember.js Konacha sinon.fakeServer not doing anything

I've got an ember.js app set up, I'm using ember.js 1.0.0-rc4 and ember-data 0.13, I'm trying to get konacha setup with mocha.js similar to this https://github.com/dgeb/ember_data_example. My spec_helper.js //= require konacha_config //=…
user160917
  • 9,211
  • 4
  • 53
  • 63
2
votes
1 answer

Testing click event with Konacha/Poltergeist (and Rails)

I have Konacha running with the Poltergeist driver in my config/initializers/konacha.rb file. I've made sure that I set config.driver :poltergeist in that file. I'm having trouble getting Poltergeist to interact with the page. My test…
nickcoxdotme
  • 6,567
  • 9
  • 46
  • 72
2
votes
0 answers

Testing ember form submission with konacha

We're trying to test behavior of a form in our system using konacha and sinon. In the routes, form submission is handled with the following pattern: save: (object) -> object.one "didCreate", @, -> @transitionTo "nextStep" object.one…
Matt
  • 71
  • 5
2
votes
0 answers

konacha initialized after config.after_initialized had been executed

I am trying to create a Rails application with konacha. $ ruby --version ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux] rails (3.2.11) konacha (2.5.1) The problem is that konacha cannot run tests, though it can find them. I explored the…
2
votes
0 answers

integration testing ember.js with konacha

I am trying to test my ember.js and rails app with Konacha. I want to load my ember app and be able to transition to the root.index route and the app should load into the iframe. I have stripped this down to this code and am simply trying to show…
Rick Moss
  • 926
  • 1
  • 17
  • 34
1
vote
1 answer

Ember.js during testing: The URL '/' did not match any routes

I'm running some integration tests on my Ember app with Konacha. Because of the nature of the tests, the Ember run loop is not disabled. The tests work, but it seems that because I have not disabled the run loop (as outlined in the ember testing…
alt
  • 13,357
  • 19
  • 80
  • 120
1
vote
1 answer

ember-konacha-rails isValid AssertionError

I Am using Ember-konacha-rails to test my ember.js application, Here is the model i am testing: //sales_rep.js App.SalesRep = DS.Model.extend({ firstName: DS.attr('string'), lastName: DS.attr('string'), }); here is the test : #= require…
Mawaheb
  • 822
  • 10
  • 21
1
2