Sha256: b5f5becc7a80ae6f16221ba370ff9f7ae51b1b30eeee22ce39d8c6169699c0ff
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' describe 'Fill in user form' do before(:all) { load_translations } it 'finds and fills text fields' do visit 'user_form' form = Formulaic::Form.new(:user, name: 'George') form.fill expect(input(:user, :name).value).to eq 'George' end it 'finds and fills a password field' do visit 'user_form' form = Formulaic::Form.new(:user, password: 'supersecr3t') form.fill expect(input(:user, :password).value).to eq 'supersecr3t' end it 'finds and fills a textarea' do visit 'user_form' form = Formulaic::Form.new(:user, bio: 'blah blah blah') form.fill expect(input(:user, :bio).value).to eq 'blah blah blah' end it 'finds and fills a date field' do visit 'user_form' form = Formulaic::Form.new(:user, date_of_birth: Date.new(1980, 1, 2)) form.fill expect(page.find('#user_date_of_birth_1i').value).to eq('1980') expect(page.find('#user_date_of_birth_2i').value).to eq('1') expect(page.find('#user_date_of_birth_3i').value).to eq('2') end it 'finds and checks a boolean field' do visit 'user_form' form = Formulaic::Form.new(:user, terms_of_service: true) form.fill expect(input(:user, :terms_of_service)).to be_checked end it 'selects a string if there is no input' do visit 'user_form' form = Formulaic::Form.new(:user, awesome: 'Yes') form.fill expect(page).to have_select('user_awesome', selected: 'Yes') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
formulaic-0.0.3 | spec/features/fill_in_user_form_spec.rb |