Skip to content

Instantly share code, notes, and snippets.

@sebastjan-hribar
Last active September 8, 2015 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastjan-hribar/b98b01c55a16287109da to your computer and use it in GitHub Desktop.
Save sebastjan-hribar/b98b01c55a16287109da to your computer and use it in GitHub Desktop.
lotus template
require 'features_helper'
describe 'Projects' do
after do
ProjectRepository.clear
end
it 'can create a new project' do
visit '/projects/new'
save_and_open_page
within 'form#project-form' do
fill_in 'Name', with: 'Project ABC'
fill_in 'Customer', with: 'Customer 1'
fill_in 'project_creation_date', with: '22. 10. 2015'
click_button 'Create'
end
current_path.must_equal('/projects')
assert page.has_content?('Project ABC')
assert page.has_content?('Customer 1')
end
end
<!doctype HTML>
<html>
<head>
<title>myTMS</title>
</head>
<body>
<h2>Create new project</h2>
<form action="/projects" method="POST" accept-charset="utf-8" id="project-form">
<div class="input">
<label for="project-name">Name</label>
<input type="text" name="project[name]" id="project-name" value="">
</div>
<div class="input">
<label for="project[project-creation-date]">Project Creation Date</label>
<input type="text" name="project[project_creation_date]" id="project-project-creation-date" value="">
</div>
<div class="input">
<label for="project-customer">Customer</label>
<input type="text" name="project[customer]" id="project-customer" value="">
</div>
<div class="controls">
<button type="submit">Create project</button>
</div>
</form>
</body>
</html>
<h2>Create new project</h2>
<%=
form_for :project, '/projects' do
div class: 'input' do
label :name
text_field :name
end
div class: 'input' do
label 'Project creation date'
text_field :project_creation_date
end
div class: 'input' do
label :customer
text_field :customer
end
div class: 'controls' do
submit 'Create project'
end
end
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment