Sha256: ea5bbf1690d85e6aa41fdfe1b58ccc1f227a4ffb205e15113aefc7ae6500f02b

Contents?: true

Size: 1.56 KB

Versions: 10

Compression:

Stored size: 1.56 KB

Contents

require "application_system_test_case"

class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
  setup do
    @admin_user = admin_sign_in_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

10 entries across 10 versions & 1 rubygems

Version Path
administration-zero-0.0.10 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.9 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.8 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.7 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.6 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.5 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.4 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.3 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.2 lib/generators/admin/scaffold/templates/system_test.rb.tt
administration-zero-0.0.1 lib/generators/admin/scaffold/templates/system_test.rb.tt