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:
parent
8193b82f5e
commit
1074875d73
4 changed files with 25 additions and 1 deletions
|
@ -2,4 +2,7 @@ class UsersController < ApplicationController
|
|||
def index
|
||||
@user = { id: 1, name: 'k0kubun' }
|
||||
end
|
||||
|
||||
def capture
|
||||
end
|
||||
end
|
||||
|
|
5
spec/rails/app/views/users/capture.html.haml
Normal file
5
spec/rails/app/views/users/capture.html.haml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- html = capture do
|
||||
%span
|
||||
%p Capture
|
||||
|
||||
.capture= html
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue