-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for system test cases (#20)
- Loading branch information
Showing
5 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
local plugin = require("neotest-minitest") | ||
local async = require("nio.tests") | ||
|
||
describe("Rails System Test", function() | ||
assert:set_parameter("TableFormatLevel", -1) | ||
describe("discover_positions SystemTestCase", function() | ||
async.it("should discover the position for the tests", function() | ||
local test_path = vim.loop.cwd() .. "/tests/minitest_examples/system_test_case.rb" | ||
local positions = plugin.discover_positions(test_path):to_list() | ||
local expected_positions = { | ||
{ | ||
id = test_path, | ||
name = "system_test_case.rb", | ||
path = test_path, | ||
range = { 0, 0, 6, 0 }, | ||
type = "file", | ||
}, | ||
{ | ||
{ | ||
id = "./tests/minitest_examples/system_test_case.rb::3", | ||
name = "RailsSystemTest", | ||
path = test_path, | ||
range = { 2, 0, 5, 3 }, | ||
type = "namespace", | ||
}, | ||
{ | ||
{ | ||
id = "./tests/minitest_examples/system_test_case.rb::4", | ||
name = "should pass", | ||
path = test_path, | ||
range = { 3, 2, 4, 5 }, | ||
type = "test", | ||
}, | ||
}, | ||
}, | ||
} | ||
assert.are.same(positions, expected_positions) | ||
end) | ||
end) | ||
|
||
describe("discover_positions ApplicationSystemTestCase", function() | ||
async.it("should discover the position for the tests", function() | ||
local test_path = vim.loop.cwd() .. "/tests/minitest_examples/rails_system_test.rb" | ||
local positions = plugin.discover_positions(test_path):to_list() | ||
local expected_positions = { | ||
{ | ||
id = test_path, | ||
name = "rails_system_test.rb", | ||
path = test_path, | ||
range = { 0, 0, 6, 0 }, | ||
type = "file", | ||
}, | ||
{ | ||
{ | ||
id = "./tests/minitest_examples/rails_system_test.rb::3", | ||
name = "RailsSystemTest", | ||
path = test_path, | ||
range = { 2, 0, 5, 3 }, | ||
type = "namespace", | ||
}, | ||
{ | ||
{ | ||
id = "./tests/minitest_examples/rails_system_test.rb::4", | ||
name = "should pass", | ||
path = test_path, | ||
range = { 3, 2, 4, 5 }, | ||
type = "test", | ||
}, | ||
}, | ||
}, | ||
} | ||
assert.are.same(positions, expected_positions) | ||
end) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'minitest/autorun' | ||
require 'active_support/message_encryptor' | ||
require 'active_support/dependencies/autoload' | ||
require 'active_support/test_case' | ||
require 'action_controller/template_assertions' | ||
require 'action_dispatch/http/mime_type' | ||
require 'action_dispatch/testing/assertions' | ||
require 'action_dispatch/testing/test_process' | ||
require 'action_dispatch/testing/request_encoder' | ||
require 'action_dispatch/routing' | ||
require 'action_dispatch/system_test_case' | ||
|
||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require_relative "../application_system_test_case" | ||
|
||
class RailsSystemTest < ApplicationSystemTestCase | ||
test "should pass" do | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require_relative "../application_system_test_case" | ||
|
||
class RailsSystemTest < ActionDispatch::SystemTestCase | ||
test "should pass" do | ||
end | ||
end |