GithubHelp home page GithubHelp logo

codeword / jasmine-fixtures Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mavenlink/jasmine-fixtures

0.0 0.0 0.0 131 KB

Fixture loader for Jasmine

License: MIT License

Ruby 71.62% JavaScript 28.38%

jasmine-fixtures's Introduction

FORK INFO

This is a work in progress fork for Rails 3.

Get started by running

rails generate jasmine_fixtures

Rails 2.3 README follows.

jasmine-fixtures

Jasmine Fixtures is an add-on for the behavior-driven development framework, Jasmine. If you’re using Jasmine to test the JavaScript in your Ruby projects and you want to test your DOM and bindings, you can use Jasmine Fixtures.

The gem includes 3 major pieces:

1) The helpers required to loadFixture() within your Jasmine specs

2) JQuery-based matchers to make your life easier

3) RSpec-based methods for creating DOM fixtures

Installing

We’re assuming you’re on Rails 2.3.10, you’ve installed rspec, and you’ve installed the jasmine gem and run “script/generate jasmine”.

gem install jasmine-fixtures

script/generate jasmine_fixtures

If you want to use the fixture generator, you need to load jasmine_fixture_generator_methods.rb. If you load everything in your support directory in your spec_helper.rb already, you’re good to go. Otherwise, make sure it’s required with the rest of your requires in spec_helper.rb.

Once you run the generator, take a look at the added files to see how to generate and use the fixtures, especially

spec/controllers/jasmine_fixture_creators.rb

and

spec/javascripts/example-users-spec.js

Assumptions

You haven’t messed with the default Jasmine configuration to load everything in the helpers directory. If you have, make sure you get the jasmine-fixture-*.js files loaded.

All your fixtures should be in /tmp/js_dom_fixtures/FIXTURE_NAME.fixture.html.erb

You can roll your own fixtures and use the above path/naming convention. Also, be sure to wrap all fixtures in a wrapping <div>{Your content goes here}</div> that we ignore.

Alternatively, if you use our RSpec-based methods to generate fixtures (the better way), you need RSpec!

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010. See LICENSE for details.

jasmine-fixtures's People

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.