Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'spec_helper'
- require_relative '../../../../apps/web/controllers/books/create'
- describe Web::Controllers::Books::Create do
- let(:action) { Web::Controllers::Books::Create.new(facebook_adapter: InMemoryFacebookAdapter.new }
- let(:params) { Hash[book: { title: 'Confident Ruby', author: 'Avdi Grimm' }] }
- it 'creates a new book' do
- action.call(params)
- action.book.id.wont_be_nil
- action.book.title.must_equal params[:book][:title]
- end
- it 'redirects the user to the books listing' do
- response = action.call(params)
- response[0].must_equal 302
- response[1]['Location'].must_equal '/books'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement