Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.64 KB | None | 0 0
  1. require 'spec_helper'
  2. require_relative '../../../../apps/web/controllers/books/create'
  3.  
  4. describe Web::Controllers::Books::Create do
  5.   let(:action) { Web::Controllers::Books::Create.new(facebook_adapter: InMemoryFacebookAdapter.new }
  6.   let(:params) { Hash[book: { title: 'Confident Ruby', author: 'Avdi Grimm' }] }
  7.  
  8.   it 'creates a new book' do
  9.     action.call(params)
  10.  
  11.     action.book.id.wont_be_nil
  12.     action.book.title.must_equal params[:book][:title]
  13.   end
  14.  
  15.   it 'redirects the user to the books listing' do
  16.     response = action.call(params)
  17.  
  18.     response[0].must_equal 302
  19.     response[1]['Location'].must_equal '/books'
  20.   end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement