lucid 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +13 -9
  3. data/README.md +2 -6
  4. data/lib/lucid.rb +22 -3
  5. data/lib/lucid/{term/ansicolor.rb → ansicolor.rb} +34 -41
  6. data/lib/lucid/ast.rb +2 -2
  7. data/lib/lucid/ast/outline_table.rb +2 -2
  8. data/lib/lucid/ast/{specs.rb → spec.rb} +10 -1
  9. data/lib/lucid/ast/step.rb +3 -3
  10. data/lib/lucid/ast/step_invocation.rb +16 -16
  11. data/lib/lucid/ast/table.rb +1 -1
  12. data/lib/lucid/ast/{tdl_walker.rb → walker.rb} +15 -16
  13. data/lib/lucid/cli/app.rb +23 -21
  14. data/lib/lucid/cli/{configuration.rb → context.rb} +66 -38
  15. data/lib/lucid/cli/options.rb +59 -40
  16. data/lib/lucid/{configuration.rb → context.rb} +2 -3
  17. data/lib/lucid/{runtime.rb → context_loader.rb} +58 -61
  18. data/lib/lucid/{runtime/facade.rb → facade.rb} +5 -6
  19. data/lib/lucid/formatter/ansicolor.rb +15 -14
  20. data/lib/lucid/formatter/debug.rb +1 -1
  21. data/lib/lucid/formatter/usage.rb +2 -2
  22. data/lib/lucid/interface.rb +121 -0
  23. data/lib/lucid/{runtime/interface_io.rb → interface_io.rb} +2 -2
  24. data/lib/lucid/interface_rb/rb_language.rb +6 -23
  25. data/lib/lucid/interface_rb/rb_step_definition.rb +1 -2
  26. data/lib/lucid/{core_ext/instance_exec.rb → lang_extend.rb} +112 -69
  27. data/lib/lucid/{runtime/orchestrator.rb → orchestrator.rb} +36 -24
  28. data/lib/lucid/platform.rb +1 -1
  29. data/lib/lucid/{runtime/results.rb → results.rb} +10 -10
  30. data/lib/lucid/{tdl_builder.rb → spec_builder.rb} +26 -22
  31. data/lib/lucid/spec_file.rb +33 -13
  32. data/lib/lucid/{runtime/specs_loader.rb → spec_loader.rb} +13 -22
  33. data/lib/lucid/{step_definition_light.rb → step_definition_usage.rb} +2 -4
  34. data/lib/lucid/step_definitions.rb +4 -4
  35. data/spec/lucid/app_spec.rb +6 -18
  36. data/spec/lucid/ast/background_spec.rb +4 -4
  37. data/spec/lucid/ast/feature_spec.rb +7 -7
  38. data/spec/lucid/ast/scenario_outline_spec.rb +9 -9
  39. data/spec/lucid/ast/specs_spec.rb +8 -8
  40. data/spec/lucid/ast/step_spec.rb +5 -5
  41. data/spec/lucid/ast/tdl_walker_spec.rb +5 -5
  42. data/spec/lucid/{configuration_spec.rb → context_spec.rb} +78 -78
  43. data/spec/lucid/facade_spec.rb +7 -7
  44. data/spec/lucid/orchestrator_spec.rb +7 -7
  45. data/spec/lucid/pending_spec.rb +3 -3
  46. data/spec/lucid/progress_spec.rb +3 -3
  47. data/spec/lucid/rb_step_definition_spec.rb +4 -4
  48. data/spec/lucid/results_spec.rb +2 -2
  49. data/spec/lucid/runtime_spec.rb +7 -7
  50. metadata +20 -32
  51. data/bin/lucid-gen +0 -4
  52. data/lib/lucid/core_ext/proc.rb +0 -36
  53. data/lib/lucid/core_ext/string.rb +0 -9
  54. data/lib/lucid/generator.rb +0 -21
  55. data/lib/lucid/generators/project.rb +0 -64
  56. data/lib/lucid/generators/project/Gemfile.tt +0 -6
  57. data/lib/lucid/generators/project/browser-fluent.rb +0 -37
  58. data/lib/lucid/generators/project/driver-fluent.rb +0 -1
  59. data/lib/lucid/generators/project/errors.rb +0 -26
  60. data/lib/lucid/generators/project/events-fluent.rb +0 -33
  61. data/lib/lucid/interface_methods.rb +0 -125
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Lucid
4
- describe Runtime::Facade do
5
-
4
+ describe ContextLoader::Facade do
5
+
6
6
  let(:interface) {double('interface')}
7
- subject { Runtime::Orchestrator.new(interface,{}) }
8
- let(:facade) { Runtime::Facade.new(subject, interface) }
9
-
7
+ subject { ContextLoader::Orchestrator.new(interface,{}) }
8
+ let(:facade) { ContextLoader::Facade.new(subject, interface) }
9
+
10
10
  it 'should produce AST::Table by #table' do
11
11
  facade.table( %{
12
12
  | study | phase |
@@ -26,6 +26,6 @@ module Lucid
26
26
  str.should be_kind_of(AST::DocString)
27
27
  str.content_type.should eq('ruby')
28
28
  end
29
-
29
+
30
30
  end
31
- end
31
+ end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Lucid
4
- describe Runtime::Orchestrator do
4
+ describe ContextLoader::Orchestrator do
5
5
  let(:options) { {} }
6
6
  let(:interface) { double('interface') }
7
- subject { Runtime::Orchestrator.new(interface, options) }
7
+ subject { ContextLoader::Orchestrator.new(interface, options) }
8
8
 
9
9
  let(:dsl) do
10
10
  @rb = subject.load_code_language('rb')
@@ -27,7 +27,7 @@ module Lucid
27
27
  step_match.should equal(second_step_match)
28
28
  end
29
29
 
30
-
30
+
31
31
  describe 'resolving test definition matches' do
32
32
  it 'should raise Undefined error when no test definitions match' do
33
33
  lambda do
@@ -63,7 +63,7 @@ spec/lucid/orchestrator_spec.rb:\\d+:in `/Simple (.*)/'
63
63
  }
64
64
  dsl.Given(/Simple (.*)/) {|phrase|}
65
65
  dsl.Given(/Simple (.*)/) {|phrase|}
66
-
66
+
67
67
  lambda do
68
68
  subject.step_match('Simple lucid test')
69
69
  end.should raise_error(Ambiguous, /#{expected_error}/)
@@ -108,10 +108,10 @@ spec/lucid/orchestrator_spec.rb:\\d+:in `/Simple (.*)/'
108
108
  subject.step_match('Simple lucid test')
109
109
  end.should_not raise_error
110
110
  end
111
-
111
+
112
112
  end
113
-
113
+
114
114
  end
115
115
 
116
116
  end
117
- end
117
+ end
@@ -4,7 +4,7 @@ require 'lucid/interface_rb/rb_language'
4
4
  module Lucid
5
5
  describe 'Pending' do
6
6
  before(:each) do
7
- l = InterfaceRb::RbLanguage.new(Runtime.new)
7
+ l = InterfaceRb::RbLanguage.new(ContextLoader.new)
8
8
  l.begin_rb_scenario(double('scenario').as_null_object)
9
9
  @domain= l.current_domain
10
10
  end
@@ -40,6 +40,6 @@ module Lucid
40
40
  end
41
41
  }.should raise_error(Lucid::Pending, /TODO/)
42
42
  end
43
-
43
+
44
44
  end
45
- end
45
+ end
@@ -4,12 +4,12 @@ require 'lucid/formatter/progress'
4
4
  module Lucid
5
5
  module Formatter
6
6
  describe Progress do
7
-
7
+
8
8
  before(:each) do
9
9
  Lucid::Term::ANSIColor.coloring = false
10
10
  @out = StringIO.new
11
11
  progress = Lucid::Formatter::Progress.new(double('Runtime'), @out, {})
12
- @visitor = Lucid::AST::TDLWalker.new(nil, [progress])
12
+ @visitor = Lucid::AST::Walker.new(nil, [progress])
13
13
  end
14
14
 
15
15
  describe 'visiting a table cell value without a status' do
@@ -31,4 +31,4 @@ module Lucid
31
31
  end
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -4,7 +4,7 @@ module Lucid
4
4
  module InterfaceRb
5
5
  describe RbStepDefinition do
6
6
  let(:interface) { double('interface') }
7
- let(:orchestrator) { Lucid::Runtime::Orchestrator.new(interface) }
7
+ let(:orchestrator) { Lucid::ContextLoader::Orchestrator.new(interface) }
8
8
  let(:rb) { orchestrator.load_code_language('rb') }
9
9
  let(:dsl) do
10
10
  rb
@@ -19,7 +19,7 @@ module Lucid
19
19
  def run_step(text)
20
20
  orchestrator.step_match(text).invoke(nil)
21
21
  end
22
-
22
+
23
23
  it 'should allow calling of other steps' do
24
24
  dsl.Given /Outside/ do
25
25
  step 'Inside'
@@ -121,7 +121,7 @@ module Lucid
121
121
 
122
122
  lambda { run_step 'Lucid tests are good' }.should raise_error(RuntimeError, /can't modify frozen String/i)
123
123
  end
124
-
124
+
125
125
  end
126
126
  end
127
- end
127
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Lucid
4
- describe Runtime::Results do
4
+ describe ContextLoader::Results do
5
5
  let(:configuration) {double 'Configuration', :strict? => false}
6
6
  let(:passed_scenario) {double 'Scenario', :status => :passed}
7
7
  let(:failed_scenario) {double 'Scenario', :status => :failed}
@@ -76,6 +76,6 @@ module Lucid
76
76
  end
77
77
  end
78
78
  end
79
-
79
+
80
80
  end
81
81
  end
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Lucid
4
- describe Runtime do
4
+ describe ContextLoader do
5
5
 
6
6
  let(:options) { {} }
7
- subject { Runtime.new(options) }
7
+ subject { ContextLoader.new(options) }
8
8
 
9
9
  describe '#specs_paths' do
10
10
  let(:options) { {:paths => ['specs/area1/test.spec', 'specs/area1/area2/test.spec', 'others_specs'] } }
@@ -15,13 +15,13 @@ module Lucid
15
15
  end
16
16
 
17
17
  describe '#configure' do
18
- let(:orchestrator) { double(Runtime::Orchestrator).as_null_object }
19
- let(:results) { double(Runtime::Results).as_null_object }
18
+ let(:orchestrator) { double(ContextLoader::Orchestrator).as_null_object }
19
+ let(:results) { double(ContextLoader::Results).as_null_object }
20
20
  let(:new_config) { double('New Configuration') }
21
21
 
22
22
  before(:each) do
23
- Runtime::Orchestrator.stub(:new => orchestrator)
24
- Runtime::Results.stub(:new => results)
23
+ ContextLoader::Orchestrator.stub(:new => orchestrator)
24
+ ContextLoader::Results.stub(:new => results)
25
25
  end
26
26
 
27
27
  it 'tells the orchestrator and results about the new configuration' do
@@ -35,4 +35,4 @@ module Lucid
35
35
  end
36
36
  end
37
37
  end
38
- end
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Nyman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,7 +108,6 @@ description: |2
108
108
  email: jeffnyman@gmail.com
109
109
  executables:
110
110
  - lucid
111
- - lucid-gen
112
111
  extensions: []
113
112
  extra_rdoc_files: []
114
113
  files:
@@ -120,8 +119,8 @@ files:
120
119
  - README.md
121
120
  - Rakefile
122
121
  - bin/lucid
123
- - bin/lucid-gen
124
122
  - lib/lucid.rb
123
+ - lib/lucid/ansicolor.rb
125
124
  - lib/lucid/ast.rb
126
125
  - lib/lucid/ast/background.rb
127
126
  - lib/lucid/ast/comment.rb
@@ -136,7 +135,7 @@ files:
136
135
  - lib/lucid/ast/outline_table.rb
137
136
  - lib/lucid/ast/scenario.rb
138
137
  - lib/lucid/ast/scenario_outline.rb
139
- - lib/lucid/ast/specs.rb
138
+ - lib/lucid/ast/spec.rb
140
139
  - lib/lucid/ast/step.rb
141
140
  - lib/lucid/ast/step_collection.rb
142
141
  - lib/lucid/ast/step_invocation.rb
@@ -144,16 +143,15 @@ files:
144
143
  - lib/lucid/ast/step_result.rb
145
144
  - lib/lucid/ast/table.rb
146
145
  - lib/lucid/ast/tags.rb
147
- - lib/lucid/ast/tdl_walker.rb
146
+ - lib/lucid/ast/walker.rb
148
147
  - lib/lucid/cli/app.rb
149
- - lib/lucid/cli/configuration.rb
148
+ - lib/lucid/cli/context.rb
150
149
  - lib/lucid/cli/options.rb
151
150
  - lib/lucid/cli/profile.rb
152
- - lib/lucid/configuration.rb
153
- - lib/lucid/core_ext/instance_exec.rb
154
- - lib/lucid/core_ext/proc.rb
155
- - lib/lucid/core_ext/string.rb
151
+ - lib/lucid/context.rb
152
+ - lib/lucid/context_loader.rb
156
153
  - lib/lucid/errors.rb
154
+ - lib/lucid/facade.rb
157
155
  - lib/lucid/factory.rb
158
156
  - lib/lucid/formatter/ansicolor.rb
159
157
  - lib/lucid/formatter/condensed.rb
@@ -179,15 +177,8 @@ files:
179
177
  - lib/lucid/formatter/testdefs.rb
180
178
  - lib/lucid/formatter/unicode.rb
181
179
  - lib/lucid/formatter/usage.rb
182
- - lib/lucid/generator.rb
183
- - lib/lucid/generators/project.rb
184
- - lib/lucid/generators/project/Gemfile.tt
185
- - lib/lucid/generators/project/browser-fluent.rb
186
- - lib/lucid/generators/project/driver-fluent.rb
187
- - lib/lucid/generators/project/errors.rb
188
- - lib/lucid/generators/project/events-fluent.rb
189
180
  - lib/lucid/interface.rb
190
- - lib/lucid/interface_methods.rb
181
+ - lib/lucid/interface_io.rb
191
182
  - lib/lucid/interface_rb/matcher.rb
192
183
  - lib/lucid/interface_rb/rb_hook.rb
193
184
  - lib/lucid/interface_rb/rb_language.rb
@@ -196,14 +187,11 @@ files:
196
187
  - lib/lucid/interface_rb/rb_transform.rb
197
188
  - lib/lucid/interface_rb/rb_world.rb
198
189
  - lib/lucid/interface_rb/regexp_argument_matcher.rb
190
+ - lib/lucid/lang_extend.rb
199
191
  - lib/lucid/load_path.rb
192
+ - lib/lucid/orchestrator.rb
200
193
  - lib/lucid/platform.rb
201
- - lib/lucid/runtime.rb
202
- - lib/lucid/runtime/facade.rb
203
- - lib/lucid/runtime/interface_io.rb
204
- - lib/lucid/runtime/orchestrator.rb
205
- - lib/lucid/runtime/results.rb
206
- - lib/lucid/runtime/specs_loader.rb
194
+ - lib/lucid/results.rb
207
195
  - lib/lucid/sequence.rb
208
196
  - lib/lucid/sequence/sequence_errors.rb
209
197
  - lib/lucid/sequence/sequence_group.rb
@@ -211,12 +199,12 @@ files:
211
199
  - lib/lucid/sequence/sequence_steps.rb
212
200
  - lib/lucid/sequence/sequence_support.rb
213
201
  - lib/lucid/sequence/sequence_template.rb
202
+ - lib/lucid/spec_builder.rb
214
203
  - lib/lucid/spec_file.rb
215
- - lib/lucid/step_definition_light.rb
204
+ - lib/lucid/spec_loader.rb
205
+ - lib/lucid/step_definition_usage.rb
216
206
  - lib/lucid/step_definitions.rb
217
207
  - lib/lucid/step_match.rb
218
- - lib/lucid/tdl_builder.rb
219
- - lib/lucid/term/ansicolor.rb
220
208
  - lib/lucid/unit.rb
221
209
  - lucid.gemspec
222
210
  - spec/lucid/ansicolor_spec.rb
@@ -232,7 +220,7 @@ files:
232
220
  - spec/lucid/ast/table_spec.rb
233
221
  - spec/lucid/ast/tdl_factory.rb
234
222
  - spec/lucid/ast/tdl_walker_spec.rb
235
- - spec/lucid/configuration_spec.rb
223
+ - spec/lucid/context_spec.rb
236
224
  - spec/lucid/duration_spec.rb
237
225
  - spec/lucid/facade_spec.rb
238
226
  - spec/lucid/factory_spec.rb
@@ -260,7 +248,7 @@ licenses:
260
248
  - MIT
261
249
  metadata: {}
262
250
  post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n
263
- \ Lucid 0.3.3 has been installed.\n\n Run the following command to get help:\n
251
+ \ Lucid 0.4.0 has been installed.\n\n Run the following command to get help:\n
264
252
  \ lucid --help\n\n Information on Lucid can be found under the 'lucid'\n category
265
253
  at:\n http://testerstories.com/category/lucid/\n\n(::) (::) (::) (::) (::) (::)
266
254
  (::) (::) (::) (::) (::) (::)\n "
@@ -279,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
267
  version: 1.6.1
280
268
  requirements: []
281
269
  rubyforge_project:
282
- rubygems_version: 2.0.14
270
+ rubygems_version: 2.1.11
283
271
  signing_key:
284
272
  specification_version: 4
285
273
  summary: Test Description Language Specification and Execution Engine
@@ -297,7 +285,7 @@ test_files:
297
285
  - spec/lucid/ast/table_spec.rb
298
286
  - spec/lucid/ast/tdl_factory.rb
299
287
  - spec/lucid/ast/tdl_walker_spec.rb
300
- - spec/lucid/configuration_spec.rb
288
+ - spec/lucid/context_spec.rb
301
289
  - spec/lucid/duration_spec.rb
302
290
  - spec/lucid/facade_spec.rb
303
291
  - spec/lucid/factory_spec.rb
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'lucid/generator'
4
- Lucid::Generator.start
@@ -1,36 +0,0 @@
1
- # Proc extension to get more location info out of a proc
2
- require 'lucid/platform'
3
- class Proc #:nodoc:
4
- PROC_PATTERN = /[\d\w]+@(.+):(\d+).*>/
5
- PWD = Dir.pwd
6
-
7
- def to_comment_line
8
- "# #{file_colon_line}"
9
- end
10
-
11
- def backtrace_line(name)
12
- "#{file_colon_line}:in `#{name}'"
13
- end
14
-
15
- if Proc.new{}.to_s =~ PROC_PATTERN
16
- def file_colon_line
17
- path, line = *to_s.match(PROC_PATTERN)[1..2]
18
- path = File.expand_path(path)
19
- pwd = File.expand_path(PWD)
20
- pwd.force_encoding(path.encoding)
21
- if path.index(pwd)
22
- path = path[pwd.length+1..-1]
23
- elsif path =~ /.*\/gems\/(.*\.rb)$/
24
- path = $1
25
- end
26
- "#{path}:#{line}"
27
- end
28
- else
29
- # This Ruby implementation doesn't implement Proc#to_s correctly
30
- STDERR.puts '*** THIS RUBY IMPLEMENTATION DOES NOT REPORT FILE AND LINE FOR PROCS ***'
31
-
32
- def file_colon_line
33
- 'UNKNOWN:-1'
34
- end
35
- end
36
- end
@@ -1,9 +0,0 @@
1
- class String #:nodoc:
2
- def indent(n)
3
- if n >= 0
4
- gsub(/^/, ' ' * n)
5
- else
6
- gsub(/^ {0,#{-n}}/, "")
7
- end
8
- end
9
- end
@@ -1,21 +0,0 @@
1
- require 'thor'
2
- require 'lucid/generators/project'
3
-
4
- module Lucid
5
- class Generator < Thor
6
- desc 'project NAME', 'Create a new project.'
7
-
8
- #method_option :browser, aliases: "-b", type: :boolean, desc: "Use for browser-based testing."
9
- method_option :driver, aliases: '-d', type: :string, required: false, desc: "Framework driver to use. (Default value is 'fluent'.)"
10
-
11
- def project(name)
12
- puts "Name of project: #{name}"
13
-
14
- driver = options[:driver].nil? ? 'fluent' : options[:driver]
15
- #browser = options[:browser] == true ? 'true' : 'false'
16
-
17
- #Lucid::Generators::Project.start([name, browser, driver])
18
- Lucid::Generators::Project.start([name, driver])
19
- end
20
- end
21
- end
@@ -1,64 +0,0 @@
1
- require 'thor/group'
2
-
3
- module Lucid
4
- module Generators
5
- class Project < Thor::Group
6
- include Thor::Actions
7
-
8
- argument :name, type: :string, desc: 'Name of the project.'
9
- argument :driver, type: :string, desc: 'Framework driver to use.'
10
-
11
- desc 'Generates a project structure.'
12
-
13
- def self.source_root
14
- File.dirname(__FILE__) + '/project'
15
- end
16
-
17
- def spit_back_values
18
- puts "Create project '#{name}' using #{driver}."
19
- end
20
-
21
- def create_project_directory
22
- empty_directory(name)
23
- end
24
-
25
- def create_project_structure
26
- empty_directory("#{name}/specs")
27
- empty_directory("#{name}/common")
28
- empty_directory("#{name}/common/helpers")
29
- empty_directory("#{name}/common/support")
30
- empty_directory("#{name}/common/config")
31
- empty_directory("#{name}/common/data")
32
- empty_directory("#{name}/steps")
33
- empty_directory("#{name}/pages")
34
- end
35
-
36
- def copy_errors
37
- copy_file 'errors.rb', "#{name}/common/support/errors.rb"
38
- end
39
-
40
- def copy_browser
41
- if driver.downcase == 'fluent'
42
- copy_file 'browser-fluent.rb', "#{name}/common/support/browser.rb"
43
- end
44
- end
45
-
46
- def copy_driver
47
- if driver.downcase == 'fluent'
48
- copy_file 'driver-fluent.rb', "#{name}/common/support/driver.rb"
49
- end
50
- end
51
-
52
- def copy_events
53
- if driver.downcase == 'fluent'
54
- copy_file 'events-fluent.rb', "#{name}/common/support/events.rb"
55
- end
56
- end
57
-
58
- def copy_gemfile
59
- template 'Gemfile.tt', "#{name}/Gemfile"
60
- end
61
-
62
- end
63
- end
64
- end