Permalink
Browse files

No need to change the face in the tests.

  • Loading branch information...
1 parent 80bb9d4 commit a980c4b186c6135b0b4febc04ebe26831704b035 @rejeep committed Apr 6, 2012
@@ -1,45 +1,3 @@
-;; NOTE:
-;; There is a reason for adding text properties in a few steps. This
-;; is because when Emacs run in batch-mode, text properties are not
-;; set correctly. Not sure why...
-
(Then "^ruby-tools-mode should be active$"
(lambda ()
(assert ruby-tools-mode nil "Expected `ruby-tools-mode' to be started, but was not.")))
-
-(When "^I place the cursor on the symbol \"\\(.+\\)\"$"
- (lambda (symbol)
- (goto-char (point-min))
- (let* ((max
- (search-forward (concat ":" symbol)))
- (min
- (search-backward (concat ":" symbol)))
- (middle
- (/ (+ max min) 2)))
- (add-text-properties min max '(face font-lock-constant-face))
- (goto-char middle))))
-
-(When "^I place the cursor on the string \"\\(.+\\)\"$"
- (lambda (symbol)
- (goto-char (point-min))
- (let* ((string-quote-regex "['\"]")
- (max
- (re-search-forward (concat string-quote-regex symbol string-quote-regex)))
- (min
- (re-search-backward (concat string-quote-regex symbol string-quote-regex)))
- (middle
- (/ (+ max min) 2)))
- (add-text-properties min max '(face font-lock-string-face))
- (goto-char middle))))
-
-(When "^I place the cursor on \"\\(.+\\)\"$"
- (lambda (text)
- (goto-char (point-min))
- (let* ((max
- (search-forward text))
- (min
- (search-backward text))
- (middle
- (/ (+ max min) 2)))
- (goto-char middle))))
-
@@ -5,41 +5,41 @@ Feature: String conversion
Scenario: Turn single quote string to double quote string
When I insert "'foo'"
And I turn on ruby-mode
- And I place the cursor on the string "foo"
+ And I go to word "foo"
And I press "C-""
Then I should see ""foo""
Scenario: Turn single quote string to double quote string in method call
When I insert "foo('bar')"
And I turn on ruby-mode
- And I place the cursor on the string "bar"
+ And I go to word "bar"
And I press "C-""
Then I should see "foo("bar")"
Scenario: Do not turn to single quote string when on single quote string
When I insert "'foo'"
And I turn on ruby-mode
- And I place the cursor on the string "foo"
+ And I go to word "foo"
And I press "C-'"
Then I should see "'foo'"
Scenario: Turn double quote string to single quote string
When I insert ""foo""
And I turn on ruby-mode
- And I place the cursor on the string "foo"
+ And I go to word "foo"
And I press "C-'"
Then I should see "'foo'"
Scenario: Turn double quote string to single quote string in method call
When I insert "foo("bar")"
And I turn on ruby-mode
- And I place the cursor on the string "bar"
+ And I go to word "bar"
And I press "C-'"
Then I should see "foo('bar')"
Scenario: Do not turn to double quote string when on double quote string
When I insert ""foo""
And I turn on ruby-mode
- And I place the cursor on the string "foo"
+ And I go to word "foo"
And I press "C-""
Then I should see ""foo""
@@ -5,35 +5,35 @@ Feature: String To Symbol
Scenario: Turn single quote string to symbol
When I insert "'foo'"
And I turn on ruby-mode
- And I place the cursor on the string "foo"
+ And I go to word "foo"
And I press "C-:"
Then I should see ":foo"
Scenario: Turn double quote string to symbol
When I insert ""foo""
And I turn on ruby-mode
- And I place the cursor on the string "foo"
+ And I go to word "foo"
And I press "C-:"
Then I should see ":foo"
Scenario: Turn single quote string in method argument to symbol
When I insert "foo('bar')"
And I turn on ruby-mode
- And I place the cursor on the string "bar"
+ And I go to word "bar"
And I press "C-:"
Then I should see "foo(:bar)"
Scenario: Turn double quote string in method argument to symbol
When I insert "foo("bar")"
And I turn on ruby-mode
- And I place the cursor on the string "bar"
+ And I go to word "bar"
And I press "C-:"
Then I should see "foo(:bar)"
Scenario: Turn single quote string with underscores to symbol
When I insert "'foo_bar'"
And I turn on ruby-mode
- And I place the cursor on the string "foo_bar"
+ And I go to word "foo_bar"
And I press "C-:"
Then I should see ":foo_bar"
@@ -54,13 +54,13 @@ Feature: String To Symbol
Scenario: Do not turn symbol to string when not on a string
When I insert "foo('bar')"
And I turn on ruby-mode
- And I place the cursor on "foo"
+ And I go to word "foo"
And I press "C-:"
Then I should see "foo('bar')"
Scenario: Do not turn symbol to string when invalid symbol characters in string
When I insert "'foo bar'"
And I turn on ruby-mode
- And I place the cursor on the string "foo bar"
+ And I go to word "foo bar"
And I press "C-:"
Then I should see "'foo bar'"
@@ -5,28 +5,28 @@ Feature: Symbol To String
Scenario: Turn symbol to single quote string
When I insert ":foo"
And I turn on ruby-mode
- And I place the cursor on the symbol "foo"
+ And I go to word "foo"
And I press "C-'"
Then I should see "'foo'"
Scenario: Turn symbol to double quote string
When I insert ":foo"
And I turn on ruby-mode
- And I place the cursor on the symbol "foo"
+ And I go to word "foo"
And I press "C-""
Then I should see ""foo""
Scenario: Turn symbol in method argument to single quote string
When I insert "foo(:bar)"
And I turn on ruby-mode
- And I place the cursor on the symbol "bar"
+ And I go to word "bar"
And I press "C-'"
Then I should see "foo('bar')"
Scenario: Turn symbol in method argument to double quote string
When I insert "foo(:bar)"
And I turn on ruby-mode
- And I place the cursor on the symbol "bar"
+ And I go to word "bar"
And I press "C-""
Then I should see "foo("bar")"
@@ -47,13 +47,13 @@ Feature: Symbol To String
Scenario: Do not turn symbol to string when not on symbol
When I insert "foo(:bar)"
And I turn on ruby-mode
- And I place the cursor on "foo"
+ And I go to word "foo"
And I press "C-'"
Then I should see "foo(:bar)"
Scenario: Do not turn symbol to string when symbol in string
When I insert "'foo :bar baz'"
And I turn on ruby-mode
- And I place the cursor on "bar"
+ And I go to word "bar"
And I press "C-'"
Then I should see "'foo :bar baz'"

0 comments on commit a980c4b

Please sign in to comment.