2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-27 16:48:24 -04:00
|
|
|
require "generators/generators_test_helper"
|
|
|
|
require "rails/generators/rails/system_test/system_test_generator"
|
|
|
|
|
|
|
|
class SystemTestGeneratorTest < Rails::Generators::TestCase
|
|
|
|
include GeneratorsTestHelper
|
|
|
|
arguments %w(user)
|
|
|
|
|
|
|
|
def test_system_test_skeleton_is_created
|
|
|
|
run_generator
|
2017-02-19 11:50:42 -05:00
|
|
|
assert_file "test/system/users_test.rb", /class UsersTest < ApplicationSystemTestCase/
|
2016-08-27 16:48:24 -04:00
|
|
|
end
|
2017-05-27 20:09:10 -04:00
|
|
|
|
|
|
|
def test_namespaced_system_test_skeleton_is_created
|
|
|
|
run_generator %w(admin/user)
|
|
|
|
assert_file "test/system/admin/users_test.rb", /class Admin::UsersTest < ApplicationSystemTestCase/
|
|
|
|
end
|
2018-12-11 18:09:16 -05:00
|
|
|
|
|
|
|
def test_test_name_is_pluralized
|
|
|
|
run_generator %w(user)
|
|
|
|
|
|
|
|
assert_no_file "test/system/user_test.rb"
|
|
|
|
assert_file "test/system/users_test.rb"
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_test_suffix_is_not_duplicated
|
|
|
|
run_generator %w(users_test)
|
|
|
|
|
|
|
|
assert_no_file "test/system/users_test_test.rb"
|
|
|
|
assert_file "test/system/users_test.rb"
|
|
|
|
end
|
2016-08-27 16:48:24 -04:00
|
|
|
end
|