branch: externals/ruby-end
commit 9ac13296f0279be8013ecf71f83aae838762369d
Author: Roman Sokolov <sokolov....@gmail.com>
Commit: Roman Sokolov <sokolov....@gmail.com>

    tests for statement modifiers
---
 features/ruby-end.feature                   | 52 +++++++++++++++++++++++++++++
 features/step-definitions/ruby-end-steps.el |  4 +++
 2 files changed, 56 insertions(+)

diff --git a/features/ruby-end.feature b/features/ruby-end.feature
index 7625203a91..cc7f9ecd2c 100644
--- a/features/ruby-end.feature
+++ b/features/ruby-end.feature
@@ -112,3 +112,55 @@ Feature: Insert end
     And I press "SPC"
     And I type "condition"
     Then end should not be insterted
+
+  Scenario: Statement modifier with modifier checking
+    Given I enable checking of statement modifiers
+    When I type "return value if"
+    And I press "SPC"
+    And I type "condition"
+    Then I should see:
+      """
+      return value if condition
+      """
+    But I should not see:
+      """
+      return values if condition
+
+      end
+      """
+  
+  Scenario: Keyword at beginning of line with modifier checking
+    Given I enable checking of statement modifiers
+    When I type "if"
+    And I press "SPC"
+    And I type "condition"
+    Then I should see:
+      """
+      if condition
+        
+      end
+      """
+
+  Scenario: Whitespace before keyword with modifier checking
+    Given I enable checking of statement modifiers
+    When I type "  "
+    When I type "if"
+    And I press "SPC"
+    And I type "condition"
+    Then I should see:
+      """
+        if condition
+          
+        end
+      """
+
+  Scenario: Block with modifier checking
+    Given I enable checking of statement modifiers
+    When I type "collection.each do"
+    And I press "SPC"
+    Then I should see:
+      """
+      collection.each do 
+        
+      end
+      """
diff --git a/features/step-definitions/ruby-end-steps.el 
b/features/step-definitions/ruby-end-steps.el
index b73e9d9c7d..5a44db6124 100644
--- a/features/step-definitions/ruby-end-steps.el
+++ b/features/step-definitions/ruby-end-steps.el
@@ -33,3 +33,7 @@
 (When "^I go to the beginning of the line$"
       (lambda ()
         (call-interactively 'beginning-of-line)))
+
+(Given "I enable checking of statement modifiers"
+   (lambda ()
+     (setq  ruby-end-check-statement-modifiers t)))

Reply via email to