1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Add test for capture

This commit is contained in:
Takashi Kokubun 2015-03-15 23:40:02 +09:00
parent 8193b82f5e
commit 1074875d73
4 changed files with 25 additions and 1 deletions

View file

@ -2,4 +2,7 @@ class UsersController < ApplicationController
def index
@user = { id: 1, name: 'k0kubun' }
end
def capture
end
end

View file

@ -0,0 +1,5 @@
- html = capture do
%span
%p Capture
.capture= html

View file

@ -1,5 +1,9 @@
Rails.application.routes.draw do
root to: 'application#index'
resources :users, only: :index
resources :users, only: :index do
collection do
get :capture
end
end
end

View file

@ -34,4 +34,16 @@ describe UsersController, type: :request do
expect(response.body).to include('<a href="/">root</a>')
end
end
describe '#capture' do
it 'allows capture method to work' do
get capture_users_path
expect(response.body).to include(<<-HTML.strip_heredoc)
<div class="capture"><span>
<p>Capture</p>
</span>
</div>
HTML
end
end
end