Sha256: 0085cfa485296d13975ac874e77da92d3378aaf1c3ac12c74af955df35220302

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

require 'rails_helper'

RSpec.describe BooksController do
  include_context 'books with authors'

  describe "GET #index" do
    let!(:books) { [book_a, book_b_first] }
    it "assigns author's books as @books" do
      get :index, params: { author_id: first_author.to_param }
      expect(assigns(:books)).to eq(books)
    end
  end

  describe "GET #show" do
    let!(:book) { book_b_first }
    it "assigns the requested book as @book" do
      get :show, params: {
        author_id: first_author.to_param, id: book_b_first.to_param
      }
      expect(assigns(:book)).to eq(book)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
friendly_id-method_scopes-0.3.7 spec/controllers/books_controller_spec.rb