summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-04-21 09:23:07 +0100
committerGitHub <noreply@github.com>2018-04-21 09:23:07 +0100
commit20241c87ef9f033e2ac2f44f5bb99af358ab44b2 (patch)
tree537bc0e0174af27d4ab415708b24ae437a86ebf1 /test
parent63bbb38c0ce9237b17acbfc29f192a0656c62677 (diff)
parent1e6651e0a0039185d63ebe4f26f04937e82207fb (diff)
downloadale-20241c87ef9f033e2ac2f44f5bb99af358ab44b2.zip
Merge pull request #1511 from elebow/add-cucumber-checker
Add `cucumber` checker for Cucumber files
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_cucumber_command_callback.vader25
-rw-r--r--test/cucumber_fixtures/features/cuke.feature0
-rw-r--r--test/cucumber_fixtures/features/step_definitions/base_steps.rb0
-rw-r--r--test/handler/test_cucumber_handler.vader18
4 files changed, 43 insertions, 0 deletions
diff --git a/test/command_callback/test_cucumber_command_callback.vader b/test/command_callback/test_cucumber_command_callback.vader
new file mode 100644
index 00000000..d09a5712
--- /dev/null
+++ b/test/command_callback/test_cucumber_command_callback.vader
@@ -0,0 +1,25 @@
+Before:
+ runtime ale_linters/ruby/rubocop.vim
+ call ale#test#SetDirectory('/testplugin/test/')
+
+After:
+ Restore
+
+ call ale#linter#Reset()
+ call ale#test#RestoreDirectory()
+
+Execute(Should require the nearest features dir, if one is found):
+ call ale#test#SetFilename('cucumber_fixtures/features/cuke.feature')
+
+ AssertEqual
+ \ 'cucumber --dry-run --quiet --strict --format=json '
+ \ . '-r ' . ale#Escape(ale#path#Simplify(g:dir . '/cucumber_fixtures/features/')) . ' %t',
+ \ ale_linters#cucumber#cucumber#GetCommand(bufnr(''))
+
+Execute(Should require nothing if no features dir is found):
+ call ale#test#SetFilename('something/without/a/features/dir')
+
+ AssertEqual
+ \ 'cucumber --dry-run --quiet --strict --format=json '
+ \ . ' %t',
+ \ ale_linters#cucumber#cucumber#GetCommand(bufnr(''))
diff --git a/test/cucumber_fixtures/features/cuke.feature b/test/cucumber_fixtures/features/cuke.feature
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/cucumber_fixtures/features/cuke.feature
diff --git a/test/cucumber_fixtures/features/step_definitions/base_steps.rb b/test/cucumber_fixtures/features/step_definitions/base_steps.rb
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/cucumber_fixtures/features/step_definitions/base_steps.rb
diff --git a/test/handler/test_cucumber_handler.vader b/test/handler/test_cucumber_handler.vader
new file mode 100644
index 00000000..2b69a784
--- /dev/null
+++ b/test/handler/test_cucumber_handler.vader
@@ -0,0 +1,18 @@
+Before:
+ runtime ale_linters/cucumber/cucumber.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The cucumber handler parses JSON correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 13,
+ \ 'code': 'E',
+ \ 'text': 'Undefined step'
+ \ }
+ \ ],
+ \ ale_linters#cucumber#cucumber#Handle(bufnr(''), [
+ \ '[{"elements": [{"steps": [{"result": {"status": "undefined"},"match": {"location": "features/cuke.feature:13"},"line": 13,"name": "Something undefined","keyword": "Given "},{"result": {"status": "skipped"},"match": {"location": "/var/lib/gems/2.3.0/gems/cucumber-3.1.0/lib/cucumber/step_match.rb:103"},"line": 14,"name": "I visit the profile page for Alice","keyword": "When "}],"type": "scenario","line": 12,"description": "","name": "Another scenario","keyword": "Scenario","id": "a-user-can-view-another-users-profile;another-scenario"}],"line": 1,"description": "","name": "A user can view another users profile","keyword": "Feature","id": "a-user-can-view-another-users-profile","uri": "features/cuke.feature"}]'
+ \ ])