Skip to content

Instantly share code, notes, and snippets.

@walidvb
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walidvb/169241e7712bc4b94968 to your computer and use it in GitHub Desktop.
Save walidvb/169241e7712bc4b94968 to your computer and use it in GitHub Desktop.
1) WebReadsController when the book is published and the user is subscribed should display only published chapters
Failure/Error: get :show, id: @book
ActionController::UrlGenerationError:
No route matches {:id=>"slug_32", :controller=>"web_reads", :action=>"show"}
# ./spec/controllers/web_reads_controller_spec.rb:20:in `block (4 levels) in <top (required)>'
resources :books, only: [:show] do
resource :web_read, only: [:show]
end
class WebReadsController < ApplicationController
def show
end
end
require 'spec_helper'
describe WebReadsController do
context "when the book is not published" do
it "should redirect" do
get 'show'
response.should redirect_to(root_url)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment