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

Version Path
administration-zero-1.0.5 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-1.0.4 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-1.0.3 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-1.0.2 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-1.0.1 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-1.0.0 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.18 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.17 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.16 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.15 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.14 lib/generators/admin/scaffold/templates/system_test.rb.tt