Sha256: eece7b1c73fd5aa2f650483850c5c979b7095f0592b14234298496c7ffd472c9
Contents?: true
Size: 1.56 KB
Versions: 3
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 "h2", 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
3 entries across 3 versions & 1 rubygems