Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't start Clucumber for its own features.

This starts up much faster, and lets us prod it properly from the outside.
  • Loading branch information...
commit 14fb1402ee2629063f363355fd38e2568b47946f 1 parent ad38b3e
@antifuchs antifuchs authored
Showing with 44 additions and 47 deletions.
  1. +43 −24 features/sharing_state.feature
  2. +1 −23 features/support/env.rb
View
67 features/sharing_state.feature
@@ -1,30 +1,49 @@
-@lisp
Feature: Sharing state between steps
As a user of clucumber,
I want to record state between steps
So that I can test that state in my features.
-Scenario: State resetting
-
- Given I have a clucumber variable "a" set to "value-1"
- Given I have a clucumber variable "b" set to "value-2"
-
- When I reset the variable state
-
- Then clucumber variable "a" should be undefined
- And clucumber variable "b" should be undefined
-
-Scenario: Set a variable to a value
-
- Given I have a clucumber variable "a" set to "value-1"
- When I have a clucumber variable "b" set to "value-2"
-
- Then clucumber variable "a" should have value "value-1"
- And clucumber variable "b" should have value "value-2"
-
-Scenario: Implicit state resetting
-
- # When the "Set a variable to a value" step has run:
- Then clucumber variable "a" should be undefined
- Then clucumber variable "b" should be undefined
+Background:
+ Given a standard Cucumber project directory structure
+ Given the standard clucumber setup
+ Given a file named "features/step_definitions/variable_steps.lisp" with:
+ """
+ (Given* #?{^I have a clucumber variable "([^"]*)" set to "([^"]*)"$} (variable-name value)
+ (setf (var (intern variable-name :keyword)) value))
+
+ (Then* #?{^clucumber variable \"([^\"]*)\" should have value \"([^\"]*)\"$} (variable-name value)
+ (assert (string= (var (intern variable-name :keyword)) value)))
+
+ (Then* #?{^clucumber variable \"([^\"]*)\" should be undefined$} (variable-name)
+ (assert (eql (nth-value 1 (var (intern variable-name :keyword))) nil)))
+ """
+
+Scenario: State resetting between features
+
+ Given a file named "features/shared-state.feature" with:
+ """
+ Feature: Shared state
+
+ Scenario: Scenario with variables
+
+ When I have a clucumber variable "a" set to "value-1"
+ When I have a clucumber variable "b" set to "value-2"
+
+ Then clucumber variable "a" should have value "value-1"
+ And clucumber variable "b" should have value "value-2"
+
+ Scenario: Scenario without variables
+
+ Then clucumber variable "a" should be undefined
+ Then clucumber variable "b" should be undefined
+ """
+ When I run cucumber -f progress
+ Then it should pass with
+ """
+ ......
+
+ 2 scenarios (2 passed)
+ 6 steps (6 passed)
+
+ """
View
24 features/support/env.rb
@@ -1,5 +1,6 @@
require 'fileutils'
require 'tempfile'
+require File.expand_path("../../clucumber.rb", File.dirname(__FILE__))
class ClucumberWorld
extend Forwardable
@@ -61,26 +62,3 @@ def last_stdout
FileUtils.rm_rf ClucumberWorld.working_dir
FileUtils.mkdir ClucumberWorld.working_dir
end
-
-
-# Start the main clucumber:
-
-require File.expand_path("../../clucumber.rb", File.dirname(__FILE__))
-
-unless File.exist?(File.expand_path("../step_definitions/clucumber_override.wire", File.dirname(__FILE__)))
- begin
- @main_clucumber = ClucumberSubprocess.new(File.expand_path("../", File.dirname(__FILE__)),
- :port => 42428)
- at_exit do
- @main_clucumber.kill
- end
-
- @main_clucumber.start <<-LISP
- ;; Load the current dir's system definition,
- ;; not what might be linked somewhere in the system:
- (load #p"#{File.expand_path("../../clucumber.asd", File.dirname(__FILE__))}")
- LISP
- rescue PTY::ChildExited
- puts(@main_clucumber && @main_clucumber.output)
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.