Commit 66574bd0 authored by marcheing's avatar marcheing Committed by Diego de Araújo Martinez Camarinha

Add responsible fields test file

parent 71960a8c
#= require spec_helper
#= require profiles/responsible_fields
describe 'responsible_fields', ->
describe 'when the user is younger than 18', ->
before ->
@age = 15
@profile_year_input = sinon.stub()
@fields = sinon.stub()
@responsible_name = sinon.stub()
@responsible_id = sinon.stub()
@profile_year_input.val = sinon.stub().returns(@age)
@jquery_stub = sinon.stub(window, '$')
@jquery_stub.withArgs('#profile_year').returns(@profile_year_input)
@jquery_stub.withArgs('#responsible_fields').returns(@fields)
@jquery_stub.withArgs('#user-responsible-name').returns(@responsible_name)
@jquery_stub.withArgs('#user-responsible-id-number').returns(@responsible_id)
it 'shows the responsible fields', ->
@css_spy_mock = sinon.spy(@fields, 'css')
@name_prop_mock = sinon.spy(@responsible_name, 'prop')
@id_prop_mock = sinon.spy(@responsible_id, 'prop')
responsible_fields()
assert(@css_spy_mock.calledWith('display', 'block'))
assert(@name_prop_mock.calledWith('required', true))
assert(@id_prop_mock.calledWith('required', true))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment