Permalink
Browse files

Fix blank submission test

  • Loading branch information...
TiteiKo committed Sep 9, 2016
1 parent a7a7c7b commit a41b6a88a3ea4fbd83a695d190d14fcd92c9901e
Showing with 2 additions and 2 deletions.
  1. +2 −2 test/integration/form_helper_test.rb
@@ -80,15 +80,15 @@
before do
@address = Address.new(street: '5th Ave')
@delivery = Delivery.new(id: 1, customer_id: 23, address: @address)
@params = DeliveryParams.new(delivery: { address: { street: nil } })
@params = DeliveryParams.new(delivery: { address: { street: '' } })
@session = Session.new(_csrf_token: 's14')
@params.valid? # trigger validations

@actual = FullStack::Views::Deliveries::Edit.render(format: :html, delivery: @delivery, params: @params, session: @session)
end

it 'renders the form' do
@actual.must_include %(<form action="/deliveries/#{@delivery.id}" method="POST" accept-charset="utf-8" id="delivery-form" class="form-horizontal">\n<input type="hidden" name="_method" value="PATCH">\n<input type="hidden" name="_csrf_token" value="#{@session[:_csrf_token]}">\n<div class="form-group">\n<label for="delivery-customer">Customer</label>\n<input type="text" name="" id="delivery-customer" value="" class="form-control" placeholder="Customer">\n<input type="hidden" name="delivery[customer_id]" id="delivery-customer-id" value="#{@delivery.customer_id}">\n</div>\n<fieldset>\n<legend>Address</legend>\n<div class="form-group">\n<label for="delivery-address-street">Street</label>\n<input type="text" name="delivery[address][street]" id="delivery-address-street" value="#{@address.street}" class="form-control" placeholder="Street">\n</div>\n</fieldset>\n<button type="submit" class="btn btn-default">Update</button>\n</form>)
@actual.must_include %(<form action="/deliveries/#{@delivery.id}" method="POST" accept-charset="utf-8" id="delivery-form" class="form-horizontal">\n<input type="hidden" name="_method" value="PATCH">\n<input type="hidden" name="_csrf_token" value="#{@session[:_csrf_token]}">\n<div class="form-group">\n<label for="delivery-customer">Customer</label>\n<input type="text" name="" id="delivery-customer" value="" class="form-control" placeholder="Customer">\n<input type="hidden" name="delivery[customer_id]" id="delivery-customer-id" value="#{@delivery.customer_id}">\n</div>\n<fieldset>\n<legend>Address</legend>\n<div class="form-group">\n<label for="delivery-address-street">Street</label>\n<input type="text" name="delivery[address][street]" id="delivery-address-street" value="" class="form-control" placeholder="Street">\n</div>\n</fieldset>\n<button type="submit" class="btn btn-default">Update</button>\n</form>)
end
end
end

0 comments on commit a41b6a8

Please sign in to comment.