Sha256: 96908d59c13767af7d81163ad7c07f0dd1bd96d89d99dbd188dc78677e2d4187

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

require 'spec_helper'

describe BooksController do
  describe 'GET index (having an optional parameter)' do
    context 'without page parameter' do
      before { get :index }
      its(:response) { should be_success }
    end

    context 'with page parameter' do
      before { get :index, page: 3 }
      its(:response) { should be_success }
    end
  end

  describe 'GET show' do
    let(:rhg) { Book.create! title: 'RHG' }
    before { get :show, :id => rhg.id }
    subject { assigns :book }
    it { should == rhg }
  end

  describe 'POST create' do
    let(:rhg) { Book.create! title: 'RHG' }
    it { expect { post :create, :book => {title: 'AWDwR', price: 24} }.to change(Book, :count).by(1) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
action_args-1.0.1 spec/controllers/action_args_controller_spec.rb