Giter Club home page Giter Club logo

jasmine-jquery-rails's Introduction

jasmine-jquery for Rails

jasmine-jquery via asset pipeline

Installation

Add this line to your application's Gemfile:

gem 'jasmine-jquery-rails'

And then execute:

$ bundle

Assuming you're using the jasmine gem, in your jasmine.yml have:

src_files: - ... - assets/jasmine-jquery.js

Or directly include at /assets/jasmine-jquery.js

Usage

Read about jasmine-jquery here

Contributing

jasmine-jquery-rails and jasmine-jquery are maintained by Travis Jeffery

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

jasmine-jquery-rails's People

Contributors

hugolnx avatar travisjeffery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jasmine-jquery-rails's Issues

Version 1.4.2 doesn't load fixture

Hi, we run into an issue with latest 1.4.2 release.

  it 'should load fixture', ->
    loadFixtures('menu.html')
    console.log(jasmine.getFixtures())

Above test produces the following result

jsDump: {
  "containerId": "jasmine-fixtures",
  "fixturesCache_": {
    "menu.html": undefined
  },
  "fixturesPath": "spec/javascripts/fixtures"
}

1.3.1 loads the fixture just fine

jsDump: {
  "containerId": "jasmine-fixtures",
  "fixturesCache_": {
    "menu.html": "<div class='wizard-container'></div>"
  },
  "fixturesPath": "spec/javascripts/fixtures"
}

menu.html resides under spec/javascripts/fixtures with a simple content

<div class='wizard-container'></div>

Any idea what might be wrong?

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.

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

There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.

How did I find you?

I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well

Fixtures not loading properly?

I'm trying to get fixtures working, but having issues.

In my gemfile (in the development & test group):

gem 'jasmine-rails'
gem 'jasmine-jquery-rails'

I have the following folder structure:

My fixture: /spec/javascripts/fixtures/order_form.html

Jasmine Spec Helper: /spec/javascripts/helpers/spec_helper.coffee

in my spec_helper.coffee

#=require jquery
#=require jasmine-jquery

Things seem to be loading

screen shot 2013-09-03 at 10 46 55 pm

But the test fails with a 404 fixture file now found.

jasmine_fixture_failure

If I go into the error I am presented with the following error on the 404 itself:

<h1>Routing Error</h1>
<p><pre>No route matches [GET] &quot;/spec/javascripts/fixtures/order_form.html&quot;</pre></p>
<p>
  Try running <code>rake routes</code> for more information on available routes.
</p>

I've also tried adding this to my spec_helper.coffee (though I'm not sure why this would be required).

jasmine.getFixtures().fixturesPath = 'assets/fixtures'

And while it made the 404 go away, the spec doesn't pass like it should because I still don't think the fixture is being loaded properly. I say this because it's un-modified code from Railscasts that I know should pass. I'm just trying to test to make sure everything is wired up properly!

My spec/javascripts/support/jasmine.yml file is very minimal per the suggestion of https://github.com/searls/jasmine-rails#asset-pipeline-support

# minimalist jasmine.yml configuration when leveraging asset pipeline
spec_files:
  - "**/*[Ss]pec.{js,coffee}"

Any help would be greatly appreciated!

jasmine.addMatchers not working - because of Jasmine 2?

This project looks awesome. Would love to use it in my app, but can't seem to work out how to include it. It seems to be saying jasmine isn't defined:

Failure/Error: TypeError: 'undefined' is not a function (evaluating 'jasmine.addMatchers') in http://127.0.0.1:60587/assets/jasmine-jquery.js?body=1 (line 717)

Using: Rails 3.2, Teaspoon, Jasmine 2, Jasmine-Rails.

Not even loading if including it in the jasmine.yml file, but if it goes into the spec_helper.js.coffee file as an asset-pipeline include, it loads the file, but then the errors appear - because jasmine isn't a globally defined object. Is this because of Jasmine 2 working differently?

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.