Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor Ecukes features.

  • Loading branch information...
commit e19a0a2e4f1563951be1c39105bd9a357af0bbe9 1 parent e0a3021
@rejeep authored
View
29 features/drag-stuff.feature
@@ -4,18 +4,14 @@ Feature: Drag Stuff
I want to drag them
Scenario: Global mode
- When I open temp file "global"
+ When I turn on drag-stuff globaly
+ And I open temp file "global"
And I insert:
"""
line 1
line 2
"""
- And I load the following:
- """
- (drag-stuff-global-mode t)
- """
- And I go to line "1"
- And I press "<M-down>"
+ When I drag line "1" down
Then I should see:
"""
line 2
@@ -23,26 +19,17 @@ Feature: Drag Stuff
"""
Scenario: Global mode except
- When I load the following:
- """
- (setq drag-stuff-except-modes '(text-mode))
- (drag-stuff-global-mode t)
- """
- And major mode is text-mode
- When I insert:
+ When I turn on drag-stuff globaly
+ And I add "text-mode" as an except mode
+ And I turn on text-mode
+ And I insert:
"""
line 1
line 2
"""
- And I go to line "1"
- And I press "<M-down>"
+ And I drag line "1" down
Then I should see:
"""
line 1
line 2
"""
- And I should not see:
- """
- line 2
- line 1
- """
View
14 features/line.feature
@@ -9,11 +9,10 @@ Feature: Drag line
line 1
line 2
"""
- And I enable drag-stuff
+ And I turn on drag-stuff
Scenario: Drag line up
- When I go to line "2"
- And I press "<M-up>"
+ When I drag line "2" up
Then I should see:
"""
line 2
@@ -21,8 +20,7 @@ Feature: Drag line
"""
Scenario: Drag line down
- When I go to line "1"
- And I press "<M-down>"
+ When I drag line "1" down
Then I should see:
"""
line 2
@@ -30,8 +28,7 @@ Feature: Drag line
"""
Scenario: Drag line down out of scope
- When I go to line "2"
- And I press "<M-down>"
+ When I drag line "2" down
Then I should see:
"""
line 1
@@ -40,8 +37,7 @@ Feature: Drag line
And I should see message "Can not move line further down"
Scenario: Drag line up out of scope
- When I go to line "1"
- And I press "<M-up>"
+ When I drag line "1" up
Then I should see:
"""
line 1
View
38 features/lines.feature
@@ -10,13 +10,10 @@ Feature: Drag lines
line 2
line 3
"""
- And I enable drag-stuff
+ And I turn on drag-stuff
Scenario: Drag lines up
- When I go to point "10"
- And I set the mark
- And I go to point "17"
- When I press "<M-up>"
+ When I drag lines "2" to "3" up
Then I should see:
"""
line 2
@@ -25,15 +22,12 @@ Feature: Drag lines
"""
And the region should be:
"""
- ne 2
- li
+ line 2
+
"""
Scenario: Drag lines down
- When I go to point "3"
- And I set the mark
- And I go to point "10"
- When I press "<M-down>"
+ When I drag lines "1" to "2" down
Then I should see:
"""
line 3
@@ -42,15 +36,12 @@ Feature: Drag lines
"""
And the region should be:
"""
- ne 1
- li
+ line 1
+
"""
Scenario: Drag lines up out of scope
- When I go to point "3"
- And I set the mark
- And I go to point "10"
- When I press "<M-up>"
+ When I drag lines "1" to "2" up
Then I should see:
"""
line 1
@@ -60,15 +51,12 @@ Feature: Drag lines
And I should see message "Can not move lines further up"
And the region should be:
"""
- ne 1
- li
+ line 1
+
"""
Scenario: Drag lines down out of scope
- When I go to point "10"
- And I set the mark
- And I go to point "17"
- When I press "<M-down>"
+ When I drag lines "2" to "3" down
Then I should see:
"""
line 1
@@ -78,6 +66,6 @@ Feature: Drag lines
And I should see message "Can not move lines further down"
And the region should be:
"""
- ne 2
- li
+ line 2
+
"""
View
14 features/region.feature
@@ -5,30 +5,26 @@ Feature: Drag region
Background:
Given I insert "beforeREGIONafter"
- And I enable drag-stuff
+ And I turn on drag-stuff
Scenario: Drag region left
- When I select "REGION"
- And I press "<M-left>"
+ When I drag region "REGION" left
Then I should see "beforREGIONeafter"
And the region should be "REGION"
Scenario: Drag region right
- When I select "REGION"
- And I press "<M-right>"
+ When I drag region "REGION" right
Then I should see "beforeaREGIONfter"
And the region should be "REGION"
Scenario: Drag word left out of scope
- When I select "before"
- And I press "<M-left>"
+ When I drag region "before" left
Then I should see "beforeREGIONafter"
And I should see message "Can not move region further to the left"
And the region should be "before"
Scenario: Drag word right out of scope
- When I select "after"
- And I press "<M-right>"
+ When I drag region "after" right
Then I should see "beforeREGIONafter"
And I should see message "Can not move region further to the right"
And the region should be "after"
View
46 features/step-definitions/drag-stuff-steps.el
@@ -1,22 +1,46 @@
-(Given "^I \\(enable\\|disable\\) drag-stuff$"
- (lambda (status)
- (if (string= status "enable")
- (drag-stuff-mode 1)
- (drag-stuff-mode -1))))
+(Given "^I turn on drag-stuff globaly$"
+ (lambda ()
+ (drag-stuff-global-mode 1)))
-(Given "^I enable drag-stuff$"
+(Given "^I turn on drag-stuff$"
(lambda ()
(drag-stuff-mode 1)))
-(Given "^I disable drag-stuff$"
+(Given "^I turn off drag-stuff$"
(lambda ()
(drag-stuff-mode -1)))
-(Given "^major mode is text-mode$"
- (lambda ()
- (text-mode)))
+(When "^I add \"\\(.+\\)\" as an except mode$"
+ (lambda (mode)
+ (add-to-list 'drag-stuff-except-modes (intern mode))))
(When "I place cursor on word \"\\(.+\\)\""
(lambda (word)
(When "I go to word \"%s\"" word)
- (forward-char (/ (length word) 2))))
+ (When "I press \"%s\"" "C-f")))
+
+(When "^I drag line \"\\(.+\\)\" \\(up\\|down\\)$"
+ (lambda (line direction)
+ (When "I go to line \"%s\"" line)
+ (And "I drag line %s" direction)))
+
+(When "^I drag lines \"\\(.+\\)\" to \"\\(.+\\)\" \\(up\\|down\\)$"
+ (lambda (min-line max-line direction)
+ (When "I go to line \"%s\"" min-line)
+ (And "I set the mark")
+ (And "I go to line \"%s\"" max-line)
+ (And "I drag lines %s" direction)))
+
+(When "^I drag word \"\\(.+\\)\" \\(right\\|left\\)$"
+ (lambda (word direction)
+ (When "I place cursor on word \"%s\"" word)
+ (And "I drag word %s" direction)))
+
+(When "^I drag region \"\\(.+\\)\" \\(left\\|right\\)$"
+ (lambda (region direction)
+ (When "I select \"%s\"" region)
+ (And "I drag region %s" direction)))
+
+(When "^I drag \\(?:lines?\\|word\\|region\\) \\(up\\|down\\|left\\|right\\)$"
+ (lambda (direction)
+ (When "I press \"%s\"" (format "<M-%s>" direction))))
View
14 features/word.feature
@@ -5,26 +5,22 @@ Feature: Drag word
Background:
Given I insert "word1 word2 word3"
- And I enable drag-stuff
+ And I turn on drag-stuff
Scenario: Drag word left
- When I place cursor on word "word3"
- And I press "<M-left>"
+ When I drag word "word3" left
Then I should see "word1 word3 word2"
Scenario: Drag word right
- When I place cursor on word "word1"
- And I press "<M-right>"
+ When I drag word "word1" right
Then I should see "word2 word1 word3"
Scenario: Drag word left out of scope
- When I place cursor on word "word1"
- And I press "<M-left>"
+ When I drag word "word1" left
Then I should see "word1 word2 word3"
And I should see message "Can not move word further to the left"
Scenario: Drag word right out of scope
- When I place cursor on word "word3"
- And I press "<M-right>"
+ When I drag word "word3" right
Then I should see "word1 word2 word3"
And I should see message "Can not move word further to the right"
Please sign in to comment.
Something went wrong with that request. Please try again.