Skip to content

Instantly share code, notes, and snippets.

@starrychloe
Created May 10, 2014 03:42
Show Gist options
  • Save starrychloe/1d79d9925f9b79ae5c01 to your computer and use it in GitHub Desktop.
Save starrychloe/1d79d9925f9b79ae5c01 to your computer and use it in GitHub Desktop.
require 'spec_helper'
require 'refinery/books/books_controller'
require 'refinery/role'
describe Refinery::Books::BooksController do
render_views
before do
login_user # in spec/support/controller_macros.rb
FactoryGirl.create(:book_full)
shift = FactoryGirl.create(:book_open_edition)
end
describe "GET /books" do
it "responds with 200 success code" do
get :index # refinery.books_books_path doesn't recognize refinery. var.
expect(response).to be_success, response.body
expect(response.status).to eq(200)
expect(response).to render_template("refinery/books/books/index")
end
end
describe "GET /books/title/shift" do
it "responds with 200 success" do
get :show, {"id"=>"shift", "locale"=>:en}
expect(response).to be_success
expect(response).to render_template("refinery/books/books/show")
end
end
describe "GET /books?category=change-methods" do
it "succeeds" do
get "/books?category=change-methods"
expect(response).to be_success
expect(response).to render_template("refinery/books/books/show")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment