Created
August 21, 2015 07:05
-
-
Save sevenseacat/c55a6caaae5a8a03796b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/web/views/books/new_spec.rb | |
require 'spec_helper' | |
require_relative '../../../../apps/web/views/books/new' | |
class NewBookParams < Lotus::Action::Params | |
param :book do | |
param :title, presence: true | |
param :author, presence: true | |
end | |
end | |
describe Web::Views::Books::New do | |
let(:params) { NewBookParams.new({}) } | |
let(:exposures) { Hash[params: params] } | |
let(:template) { Lotus::View::Template.new('apps/web/templates/books/new.html.erb') } | |
let(:view) { Web::Views::Books::New.new(template, exposures) } | |
let(:rendered) { view.render } | |
it 'displays list of errors when params contains errors' do | |
params.valid? # trigger validations | |
rendered.must_include('There was a problem with your submission') | |
rendered.must_include('title is required') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment