Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alejandrodevs/shoulda_routing
A simple DSL to test rails routes.
https://github.com/alejandrodevs/shoulda_routing
Last synced: about 1 month ago
JSON representation
A simple DSL to test rails routes.
- Host: GitHub
- URL: https://github.com/alejandrodevs/shoulda_routing
- Owner: alejandrodevs
- License: mit
- Created: 2013-08-23T03:33:14.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-14T16:53:13.000Z (over 7 years ago)
- Last Synced: 2024-09-18T19:29:51.345Z (about 2 months ago)
- Language: Ruby
- Size: 83 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ShouldaRouting
This gem aims to provide a simple DSL that looks like the rails routes DSL that is used in the routes.rb file.
This requires the [RSpec](https://github.com/rspec/rspec-rails) testing framework.## Important
This gem is deprecated because this was created by me when I didn't know
what and how to test applications. It's not longer maintained and I
recommend you not to use it.## Installation
Add this line to your application's Gemfile:
gem 'shoulda_routing'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install shoulda_routing
## Basic usage
In your routes.rb file:
```ruby
YourApp::Application.routes.draw do
namespace :admin do
resources :users
resources :posts, only: [:index, :show]namespace :mobile do
resources :users
resources :parents, controller: :users
end
endresources :users, except: :destroy do
resources :posts, :comments
end
end
```In your routing_spec.rb file:
```ruby
require 'spec_helper'describe "Routes" do
namespace :admin do
resources :users
resources :posts, only: [:index, :show]namespace :mobile do
resources :users
resources :parents, controller: :users
end
endresources :users, except: :destroy do
resources :posts, :comments
end
end
```
This will generate the necessary tests for all rails routes above.## TO-DO
* Support member and collection routes.
* Support single resources (get, post, put, delete) actions.## Testing
To run the test suite you should run the default rake task:
$ bundle exec rake
To run the unit tests:
$ bundle exec rake spec:unit
To run the integration tests:
$ bundle exec cucumber
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request