Sha256: 48b78f67f1e10f8d0e43a615e135d22cbc6cfd8cf191a7ba96e0784f9efc52c9
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
# jquery_mockjax_rails [![Build Status](https://travis-ci.org/chautoni/jquery_mockjax_rails.png?branch=master)](https://travis-ci.org/chautoni/jquery_mockjax_rails) This gem provides: * [jQuery Mockjax 1.5.2](https://github.com/appendto/jquery-mockjax) * Ajax mocking helper in your Rspec integration tests ## Requirements * Rails 3.1 or later * Assets pipeline enabled * jQuery * Rspec/Capybara integration tests ## Installation Add the `jquery_mockjax_rails` gem to your Gemfile ```ruby group :test do gem 'jquery_mockjax_rails' end ``` And run `bundle install` ## Getting Started Stub the ajax request in a `before` block ```ruby describe 'My integration spec', js: true do before do stub_ajax url: '/api/path', responseText: { message: 'message' } end end ``` Once the browser has been lauched, open the JS console and test the mocked response ```coffeescript $.getJSON('/api/path', function(data) { console.log(data.message) }); # => message ``` ## Acknowledgements The original idea has come from [ejholmes](https://github.com/ejholmes/mockjax), however, the gem has been deprecated and does not work with current Rails 3 application using rspec/capybara integration test, so I've decided to re-write the gem from scratch. Most of the core code pieces have been emerged from [ejholmes](https://github.com/ejholmes/mockjax)'s work. ## Contributing Pull requests are more than welcome. Before submitting pull requests, please make sure your changes are covered with tests. For testing purpose, please create a dummy `test.sqlite3` when running tests for the first time ```sh mkdir spec/dummy/db touch spec/dummy/db/test.sqlite3 ```
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jquery_mockjax_rails-0.0.1 | README.md |