Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- feature "Manage todos" do
- scenario "create a new todo" do
- visit root_path
- fill_in 'Email address', with: 'junk@snap2web.com'
- click_button 'Sign in'
- click_link('Add a new todo')
- fill_in 'Description', with: 'Buy some milk'
- click_button 'Create todo'
- expect(page).to have_css 'li.todo', text: 'Buy some Milk'
- end
- end
- 1) Manage todos create a new todo
- Failure/Error: click_button 'Create todo'
- ActionController::RoutingError:
- No route matches [POST] "/todos/new"
- Todos::Application.routes.draw do
- root 'high_voltage/pages#show', id: 'homepage'
- resource :session, only: [:create]
- resources :todos
- end
- Prefix Verb URI Pattern Controller#Action
- root GET / high_voltage/pages#show {:id=>"homepage"}
- session POST /session(.:format) sessions#create
- todos GET /todos(.:format) todos#index
- POST /todos(.:format) todos#create
- new_todo GET /todos/new(.:format) todos#new
- edit_todo GET /todos/:id/edit(.:format) todos#edit
- todo GET /todos/:id(.:format) todos#show
- PATCH /todos/:id(.:format) todos#update
- PUT /todos/:id(.:format) todos#update
- DELETE /todos/:id(.:format) todos#destroy
- page GET /pages/*id high_voltage/pages#show
- $ cat app/controllers/todos_controller.rb
- class TodosController < ApplicationController
- def index
- end
- def new
- end
- end
- $ cat app/views/todos/new.html.erb
- Add a new todo
- <%= form_for :todo do |f| %>
- <%= f.label :description %>
- <%= f.text_field :description %>
- <%= f.submit 'Create todo' %>
- <% end %>
- <%= form_for Todo.new do |f| %>
- <div class="col-sm-8 contact-form">
- <form id="contact" method="post" class="form" role="form">
- <div class="row">
- <%= form_for @contact, url: contacts_path do |f| %>
- <%= form_for :todo do, url: todos_path |f| %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement