crb 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +10 -1
- data/VERSION +1 -1
- data/crb.gemspec +4 -4
- data/lib/crb.rb +15 -20
- metadata +4 -4
data/README
CHANGED
@@ -12,6 +12,7 @@ Features
|
|
12
12
|
* Can share cuke world and irb context in a same object
|
13
13
|
* Can see instance variables of step files via irb
|
14
14
|
* Supported hooks (but only before/after without parameters)
|
15
|
+
* Supported World methods
|
15
16
|
|
16
17
|
|
17
18
|
Usage
|
@@ -47,6 +48,14 @@ Example
|
|
47
48
|
irb(CRB:3):005:0> @calc
|
48
49
|
=> #<Calculator:0x7faa0a3e5218 @args=[3, 5]>
|
49
50
|
|
51
|
+
You can operate your variables directly .
|
52
|
+
|
53
|
+
irb(CRB:3):006:0> @calc.push 1
|
54
|
+
=> [3, 5, 1]
|
55
|
+
|
56
|
+
irb(CRB:3):007:0> Then "I press add"
|
57
|
+
=> 9
|
58
|
+
|
50
59
|
|
51
60
|
I18N
|
52
61
|
====
|
@@ -84,7 +93,7 @@ World Methods
|
|
84
93
|
* before : execute before hooks. returns message (String)
|
85
94
|
* after : execute after hooks. returns message (String)
|
86
95
|
* steps : returns step definitions (Array[RbStepDefinition])
|
87
|
-
*
|
96
|
+
* support: returns support code object (Runtime::SupportCode)
|
88
97
|
* hooks : returns hooks (Hash[type=>Array[RbHook]])
|
89
98
|
* rb : returns ruby language support object (RbLanguage)
|
90
99
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/crb.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{crb}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["maiha"]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-12}
|
13
13
|
s.default_executable = %q{crb}
|
14
|
-
s.description = %q{
|
14
|
+
s.description = %q{A cucumber console that offers cucumber world enviroment on irb}
|
15
15
|
s.email = %q{maiha@wota.jp}
|
16
16
|
s.executables = ["crb"]
|
17
17
|
s.extra_rdoc_files = [
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.licenses = ["MIT"]
|
31
31
|
s.require_paths = ["lib"]
|
32
32
|
s.rubygems_version = %q{1.3.7}
|
33
|
-
s.summary = %q{
|
33
|
+
s.summary = %q{A cucumber console that offers cucumber world enviroment on irb}
|
34
34
|
|
35
35
|
if s.respond_to? :specification_version then
|
36
36
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
data/lib/crb.rb
CHANGED
@@ -5,21 +5,10 @@ require 'cucumber/rb_support/rb_dsl'
|
|
5
5
|
require 'irb'
|
6
6
|
|
7
7
|
module CRB
|
8
|
-
class Runtime < Cucumber::Runtime
|
9
|
-
def run!
|
10
|
-
load_step_definitions
|
11
|
-
fire_after_configuration_hook
|
12
|
-
end
|
13
|
-
|
14
|
-
def step_definitions
|
15
|
-
@support_code.step_definitions
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
8
|
module World
|
20
9
|
include Cucumber::RbSupport::RbDsl
|
21
10
|
|
22
|
-
attr_accessor :
|
11
|
+
attr_accessor :support
|
23
12
|
attr_accessor :rb
|
24
13
|
|
25
14
|
def to_s
|
@@ -27,7 +16,7 @@ module CRB
|
|
27
16
|
end
|
28
17
|
|
29
18
|
def steps
|
30
|
-
|
19
|
+
support.step_definitions
|
31
20
|
end
|
32
21
|
|
33
22
|
def hooks
|
@@ -49,7 +38,7 @@ module CRB
|
|
49
38
|
"%s is defined" % (step.regexp_source rescue 'A new step')
|
50
39
|
else
|
51
40
|
@crb_before_executed ||= (before; true)
|
52
|
-
|
41
|
+
support.step_match(name).invoke(nil)
|
53
42
|
end
|
54
43
|
rescue Cucumber::Undefined => e
|
55
44
|
puts e.to_s
|
@@ -74,20 +63,21 @@ module CRB
|
|
74
63
|
class Console < Cucumber::Cli::Main
|
75
64
|
include IRB
|
76
65
|
|
77
|
-
def
|
78
|
-
@
|
66
|
+
def support
|
67
|
+
@support ||= Cucumber::Runtime::SupportCode.new(configuration)
|
79
68
|
end
|
80
69
|
|
81
70
|
def rb
|
82
|
-
@rb ||=
|
71
|
+
@rb ||= support.load_programming_language('rb')
|
83
72
|
end
|
84
73
|
|
85
74
|
def world
|
86
75
|
@world ||= (
|
87
|
-
|
76
|
+
stub = Struct.new(:language).new # stub scenario
|
77
|
+
rb.begin_rb_scenario(stub)
|
88
78
|
world = rb.current_world
|
89
79
|
world.extend(CRB::World)
|
90
|
-
world.
|
80
|
+
world.support = support
|
91
81
|
world.rb = rb
|
92
82
|
world.instance_eval do
|
93
83
|
Gherkin::I18n.code_keywords.each do |adverb|
|
@@ -99,11 +89,16 @@ module CRB
|
|
99
89
|
)
|
100
90
|
end
|
101
91
|
|
92
|
+
def load_step_definitions
|
93
|
+
files = configuration.support_to_load + configuration.step_defs_to_load
|
94
|
+
support.load_files!(files)
|
95
|
+
end
|
96
|
+
|
102
97
|
def execute!
|
98
|
+
load_step_definitions
|
103
99
|
IRB.setup(__FILE__)
|
104
100
|
IRB.conf[:CONTEXT_MODE] = 0
|
105
101
|
irb = Irb.new(WorkSpace.new(world))
|
106
|
-
runtime.run!
|
107
102
|
IRB.module_eval do
|
108
103
|
@CONF[:MAIN_CONTEXT] = irb.context
|
109
104
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- maiha
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-12 00:00:00 +09:00
|
19
19
|
default_executable: crb
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|