cucumber-console 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +60 -0
- data/lib/cucumber-console.rb +10 -0
- data/lib/cucumber-console/pry.rb +12 -0
- data/lib/cucumber-console/runner.rb +52 -0
- data/lib/cucumber-console/version.rb +3 -0
- metadata +83 -0
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
Cucumber Console
|
2
|
+
=============
|
3
|
+
|
4
|
+
Cucumber Console allows you to run your Cucumber tests in a Rails console.
|
5
|
+
Best served chilled with [irb-config](https://github.com/nviennot/irb-config).
|
6
|
+
|
7
|
+
### Watch the screencast
|
8
|
+
|
9
|
+
[](http://velvetpulse.com/2012/11/19/improve-your-ruby-workflow-by-integrating-vim-tmux-pry/)
|
10
|
+
|
11
|
+
Usage
|
12
|
+
------
|
13
|
+
|
14
|
+
Install it with:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'cucumber-console'
|
18
|
+
```
|
19
|
+
|
20
|
+
If you have [Pry](https://github.com/pry/pry) installed, you will have access to the `cucumber` command
|
21
|
+
in your console, which works exactly like the shell command line cucumber one.
|
22
|
+
|
23
|
+
|
24
|
+
```
|
25
|
+
pafy@bisou ~/prj/pleasehalp [master●] % rails c
|
26
|
+
Loading development environment (Rails 3.2.9)
|
27
|
+
~/prj/pleasehalp (development) > cucumber --format=pretty features/questions.feature:8
|
28
|
+
Using the default profile...
|
29
|
+
Feature: User asks a question
|
30
|
+
|
31
|
+
@javascript
|
32
|
+
Scenario: User asks a question # features/questions.feature:4
|
33
|
+
Given I am on the homepage # features/step_definitions/web_steps.rb:50
|
34
|
+
When I fill in the question field with "What time is it?" # features/step_definitions/question.rb:1
|
35
|
+
And I press "Ask" # features/step_definitions/web_steps.rb:58
|
36
|
+
Then the "question_text" field within the page should equal "" # features/step_definitions/web_steps.rb:145
|
37
|
+
And I should see a question "What time is it?" # features/step_definitions/question.rb:5
|
38
|
+
|
39
|
+
1 scenario (1 passed)
|
40
|
+
5 steps (5 passed)
|
41
|
+
0m1.036s
|
42
|
+
|
43
|
+
~/prj/crowdtap/sniper (development) >
|
44
|
+
```
|
45
|
+
|
46
|
+
If you don't have pry, you can use:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
CucumberConsole.run '--format=pretty', 'features/questions.feature:8'
|
50
|
+
```
|
51
|
+
|
52
|
+
TODO
|
53
|
+
----
|
54
|
+
|
55
|
+
* Testing
|
56
|
+
|
57
|
+
License
|
58
|
+
-------
|
59
|
+
|
60
|
+
MIT License
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module CucumberConsole::Pry
|
2
|
+
def self.setup
|
3
|
+
::Pry::CommandSet.new do
|
4
|
+
create_command "cucumber", "Works pretty much like the regular cucumber command" do
|
5
|
+
group "Testing"
|
6
|
+
def process(*args)
|
7
|
+
CucumberConsole::Runner.run(args)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end.tap { |cmd| ::Pry::Commands.import cmd }
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class CucumberConsole::Runner
|
2
|
+
def self.reset(args)
|
3
|
+
require 'cucumber'
|
4
|
+
require 'cucumber/rspec/disable_option_parser'
|
5
|
+
require 'optparse'
|
6
|
+
require 'cucumber'
|
7
|
+
require 'logger'
|
8
|
+
require 'cucumber/parser'
|
9
|
+
require 'cucumber/feature_file'
|
10
|
+
require 'cucumber/cli/configuration'
|
11
|
+
|
12
|
+
# If we are using RSpec, make sure we load it before, because some step
|
13
|
+
# definitions may contain some rspec wizardry.
|
14
|
+
::RSpecConsole::Runner.reset(args) if defined?(::RSpec) && defined?(::RSpecConsole)
|
15
|
+
|
16
|
+
config = ::Cucumber::Cli::Configuration.new
|
17
|
+
config.parse!(args)
|
18
|
+
::Cucumber.logger = config.log
|
19
|
+
|
20
|
+
if @runtime
|
21
|
+
def config.support_to_load
|
22
|
+
begin
|
23
|
+
load 'factory_girl/step_definitions.rb' if defined?(FactoryGirl)
|
24
|
+
rescue LoadError
|
25
|
+
end
|
26
|
+
[]
|
27
|
+
end
|
28
|
+
@runtime.configure(config)
|
29
|
+
else
|
30
|
+
@runtime = ::Cucumber::Runtime.new(config)
|
31
|
+
end
|
32
|
+
|
33
|
+
@runtime.instance_eval do
|
34
|
+
@loader = nil
|
35
|
+
@results = ::Cucumber::Runtime::Results.new(config)
|
36
|
+
@support_code.instance_eval do
|
37
|
+
@programming_languages.map do |programming_language|
|
38
|
+
programming_language.step_definitions.clear
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.run(args)
|
45
|
+
::RailsEnvSwitcher.with_env('test', :reload => true) do
|
46
|
+
reset(args)
|
47
|
+
@runtime.run!
|
48
|
+
@runtime.write_stepdefs_json
|
49
|
+
@runtime.results.failure?
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-console
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Nicolas Viennot
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: cucumber
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rails-env-switcher
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Run Cucumber tests in your console
|
47
|
+
email:
|
48
|
+
- nicolas@viennot.biz
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- lib/cucumber-console/pry.rb
|
54
|
+
- lib/cucumber-console/version.rb
|
55
|
+
- lib/cucumber-console/runner.rb
|
56
|
+
- lib/cucumber-console.rb
|
57
|
+
- README.md
|
58
|
+
homepage: http://github.com/nviennot/cucumber-console
|
59
|
+
licenses: []
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.8.24
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Run Cucumber tests in your console
|
82
|
+
test_files: []
|
83
|
+
has_rdoc: false
|