Sha256: fd2652985f185678a09de6bc811fac5ea8979cc8069744611a1b8ec842302d0d
Contents?: true
Size: 1.56 KB
Versions: 11
Compression:
Stored size: 1.56 KB
Contents
require "application_system_test_case" class <%= class_name.pluralize %>Test < ApplicationSystemTestCase setup do @admin_user = sign_in_admin_as(admin_users(:lazaro_nixon)) @<%= singular_table_name %> = <%= fixture_name %>(:one) end test "visiting the index" do visit <%= index_helper(type: :url) %> assert_selector "h1", text: "<%= human_name.pluralize %>" end test "should create <%= human_name.downcase %>" do visit <%= index_helper(type: :url) %> click_on "New <%= human_name.downcase %>" <%- attributes_hash.each do |attr, value| -%> <%- if boolean?(attr) -%> check "<%= attr.humanize %>" if <%= value %> <%- else -%> fill_in "<%= attr.humanize %>", with: <%= value %> <%- end -%> <%- end -%> click_on "Create <%= human_name %>" assert_text "<%= human_name %> was successfully created" end test "should update <%= human_name %>" do visit <%= show_helper(type: :url) %> click_on "Edit <%= human_name.downcase %>", match: :first <%- attributes_hash.each do |attr, value| -%> <%- if boolean?(attr) -%> check "<%= attr.humanize %>" if <%= value %> <%- else -%> fill_in "<%= attr.humanize %>", with: <%= value %> <%- end -%> <%- end -%> click_on "Update <%= human_name %>" assert_text "<%= human_name %> was successfully updated" end test "should destroy <%= human_name %>" do visit <%= show_helper(type: :url) %> page.accept_confirm { click_on "Delete <%= human_name.downcase %>" } assert_text "<%= human_name %> was successfully destroyed" end end
Version data entries
11 entries across 11 versions & 1 rubygems