branch: externals/ruby-end
commit 23c574c4543349ef074d8dbdd3bcfdd1e55218f3
Author: Johan Andersson <[email protected]>
Commit: Johan Andersson <[email protected]>
Add scenario for optional newline.
---
features/ruby-end.feature | 12 ++++++++++++
features/step-definitions/ruby-end-steps.el | 4 ++++
features/support/env.el | 3 +++
3 files changed, 19 insertions(+)
diff --git a/features/ruby-end.feature b/features/ruby-end.feature
index cc7f9ecd2c..06b92d5dd5 100644
--- a/features/ruby-end.feature
+++ b/features/ruby-end.feature
@@ -91,6 +91,18 @@ Feature: Insert end
And I type "condition"
Then I should see "xif condition"
And end should not be insterted
+
+ Scenario: Do not insert newline
+ Given insert newline is turned off
+ When I type "if"
+ And I press "SPC"
+ And I type "condition"
+ Then I should see:
+ """
+ if condition
+ end
+ """
+ And end should not be insterted
# NOTE:
diff --git a/features/step-definitions/ruby-end-steps.el
b/features/step-definitions/ruby-end-steps.el
index 5a44db6124..577ffac8a4 100644
--- a/features/step-definitions/ruby-end-steps.el
+++ b/features/step-definitions/ruby-end-steps.el
@@ -37,3 +37,7 @@
(Given "I enable checking of statement modifiers"
(lambda ()
(setq ruby-end-check-statement-modifiers t)))
+
+(Given "^insert newline is turned off$"
+ (lambda ()
+ (setq ruby-end-insert-newline nil)))
diff --git a/features/support/env.el b/features/support/env.el
index 25fc888336..017d6f8f19 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -8,6 +8,9 @@
(add-to-list 'load-path (expand-file-name "espuds" ruby-end-util-path))
(add-to-list 'load-path (expand-file-name "emacs-lisp" (expand-file-name
"lisp" (expand-file-name "ert" ruby-end-util-path))))
+(Before
+ (setq ruby-end-insert-newline t))
+
(require 'ruby-end)
(require 'espuds)
(require 'ert)