lucid 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 917611903e891a6a27b4dce03e92437edb07ceaa
4
- data.tar.gz: cdef90026f8bc2071096a02b91cccf652ca30231
3
+ metadata.gz: 9d2a717993789634de1b6ae5ba60727d9ba02530
4
+ data.tar.gz: d93ebd52e3040fe1419f06c6e7804a82bd81aae4
5
5
  SHA512:
6
- metadata.gz: 6a3ec2d6be6b9e3090c9a76ffb8bc42c81424978762aa2145d995dbdb5831f0dafff8df606863006e9520a14a9099994b5aee7982cc996f1de9ef70d3b19c1e0
7
- data.tar.gz: 83cc3a91752a0bc0ce7d8fd81c3092c919fdf14473b1e0f760738cd5bab6ab7d880b801c3a08e8d3cf48a9f00fe05c0e628d4683ef4b0934cfb8f2434f9babce
6
+ metadata.gz: fc9a55f318ff62840ffa90e03d8f2850567809ba830c05d50132d0e0128fc601bde88fbd64dd4a1fc06ea2c81eabaeb632bb74944e279b39ca2cac58958032cd
7
+ data.tar.gz: 29c79a655dc6bb08a68e83eaecfe894ffa18bf1cfe8765dd6ba8a0e1045b81ca1968073fb7521a90291b985f3f2fb72152980cf3f6594b37b89e5a01dba2f052
data/.travis.yml CHANGED
@@ -3,7 +3,6 @@ script: "rake"
3
3
  rvm:
4
4
  - 2.0.0
5
5
  - 1.9.3
6
- - jruby
7
6
 
8
7
  branches:
9
8
  only:
data/HISTORY.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Change Log and History
2
2
  ======================
3
3
 
4
+ Version 0.2.1 / 2013-10-21
5
+ --------------------------
6
+
7
+ This is a small patch release. The patch is in the project generator. The [Symbiont](https://github.com/jnyman/symbiont) test framework is being deprecated in favor of [Fluent](https://github.com/jnyman/fluent). The project generator has been updated accordingly.
4
8
 
5
9
  Version 0.2.0 / 2013-09-28
6
10
  --------------------------
data/lib/lucid.rb CHANGED
@@ -4,7 +4,6 @@ $:.unshift(File.dirname(__FILE__)) unless
4
4
  require 'yaml'
5
5
  require 'logger'
6
6
  require 'lucid/platform'
7
- require 'lucid/parser'
8
7
  require 'lucid/runtime'
9
8
  require 'lucid/cli/app'
10
9
  require 'lucid/step_definitions'
data/lib/lucid/cli/app.rb CHANGED
@@ -2,7 +2,6 @@ require 'gherkin'
2
2
  require 'optparse'
3
3
  require 'lucid'
4
4
  require 'logger'
5
- require 'lucid/parser'
6
5
  require 'lucid/spec_file'
7
6
  require 'lucid/cli/configuration'
8
7
 
@@ -101,15 +101,15 @@ module Lucid
101
101
 
102
102
  opts.separator ""
103
103
 
104
- opts.on("-r LIBRARY|DIR", "--require LIBRARY|DIR",
105
- "Require files before executing the features. If this option",
106
- "is not specified, all *.rb files that are siblings or below",
107
- "the features will be loaded automatically. Automatic loading",
108
- "is disabled when this option is specified. That means all",
109
- "loading becomes explicit.",
104
+ opts.on('-r LIBRARY|DIR', '--require LIBRARY|DIR',
105
+ 'Require files before executing the features. If this option',
106
+ 'is not specified, all *.rb files that are siblings or below',
107
+ 'the features will be loaded automatically. Automatic loading',
108
+ 'is disabled when this option is specified. That means all',
109
+ 'loading becomes explicit.',
110
110
  "Files under directories named \"support\" will always be",
111
- "loaded first.",
112
- "This option can be specified multiple times.") do |v|
111
+ 'loaded first.',
112
+ 'This option can be specified multiple times.') do |v|
113
113
  @options[:require] << v
114
114
  if(Lucid::JRUBY && File.directory?(v))
115
115
  require 'java'
@@ -117,91 +117,91 @@ module Lucid
117
117
  end
118
118
  end
119
119
 
120
- opts.separator ""
120
+ opts.separator ''
121
121
 
122
- opts.on("-f FORMAT", "--format FORMAT",
123
- "How Lucid will format spec execution output.",
124
- "(Default: standard). Available formats:",
122
+ opts.on('-f FORMAT', '--format FORMAT',
123
+ 'How Lucid will format spec execution output.',
124
+ '(Default: standard). Available formats:',
125
125
  *FORMAT_LIST
126
126
  ) do |v|
127
127
  @options[:formats] << [v, @out_stream]
128
128
  end
129
129
 
130
- opts.on("-o", "--out [FILE|DIR]",
131
- "Write output to a file or directory instead of to standard",
132
- "console output. This option applies to any specified format",
133
- "option (via the --format switch) or to the default format",
134
- "if no format was specified. You can check the specific",
135
- "documentation for a given formatter to see whether to pass",
136
- "a file or a directory."
130
+ opts.on('-o', '--out [FILE|DIR]',
131
+ 'Write output to a file or directory instead of to standard',
132
+ 'console output. This option applies to any specified format',
133
+ 'option (via the --format switch) or to the default format',
134
+ 'if no format was specified. You can check the specific',
135
+ 'documentation for a given formatter to see whether to pass',
136
+ 'a file or a directory.'
137
137
  ) do |v|
138
138
  @options[:formats] << ['standard', nil] if @options[:formats].empty?
139
139
  @options[:formats][-1][1] = v
140
140
  end
141
141
 
142
- opts.separator ""
142
+ opts.separator ''
143
143
 
144
- opts.on("-d", "--dry-run", "Invokes formatters without executing the steps.",
145
- "This also omits the loading of your support/env.rb file if it exists.") do
144
+ opts.on('-d', '--dry-run', 'Invokes formatters without executing the steps.',
145
+ 'This also omits the loading of your common/support/driver.rb file if it exists.') do
146
146
  @options[:dry_run] = true
147
147
  end
148
148
 
149
- opts.on("-n NAME", "--name NAME",
150
- "Lucid will only execute features or abilities that match with the name",
149
+ opts.on('-n NAME', '--name NAME',
150
+ 'Lucid will only execute features or abilities that match with the name",
151
151
  "provided. The match can be done on partial information. If this option",
152
152
  "is provided multiple times, then the match will be performed against",
153
- "each set of provided names."
153
+ "each set of provided names.'
154
154
  ) do |v|
155
155
  @options[:name_regexps] << /#{v}/
156
156
  end
157
157
 
158
- opts.on("-l", "--lines LINES", "Run given line numbers. Equivalent to FILE:LINE syntax") do |lines|
158
+ opts.on('-l', '--lines LINES', 'Run given line numbers. Equivalent to FILE:LINE syntax') do |lines|
159
159
  @options[:lines] = lines
160
160
  end
161
161
 
162
- opts.on("-e", "--exclude PATTERN",
163
- "Lucid will not use files that match the PATTERN.") do |v|
162
+ opts.on('-e', '--exclude PATTERN',
163
+ 'Lucid will not use files that match the PATTERN.') do |v|
164
164
  @options[:excludes] << Regexp.new(v)
165
165
  end
166
166
 
167
- opts.on("-t TAG_EXPRESSION", "--tags TAG_EXPRESSION",
168
- "Lucid will only execute features or scenarios with tags that match the",
169
- "tag expression provided. A single tag expressions can have several tags",
170
- "separated by a comma, which represents a logical OR. If this option is",
171
- "provided more than once, this represents a logical AND. A tag expression",
172
- "can be prefaced with a ~ character, which represents a logical NOT.",
173
- "Examples:",
174
- " --tags @smoke.",
175
- " --tags ~@wip",
176
- " --tags @smoke,@wip",
177
- " --tags @smoke,~@wip --tags @regression",
178
- "If you want to use multiple exclusion tags, you must use the logical",
179
- "AND approach, as in: --tags ~@wip --tags ~@failing",
180
- "Positive tags can be given a threshold to limit the number of occurrences.",
181
- "Example: --tags @critical:3",
182
- "That will fail if there are more than three occurrences of the @critical tag."
167
+ opts.on('-t TAG_EXPRESSION', '--tags TAG_EXPRESSION',
168
+ 'Lucid will only execute features or scenarios with tags that match the',
169
+ 'tag expression provided. A single tag expressions can have several tags',
170
+ 'separated by a comma, which represents a logical OR. If this option is',
171
+ 'provided more than once, this represents a logical AND. A tag expression',
172
+ 'can be prefaced with a ~ character, which represents a logical NOT.',
173
+ 'Examples:',
174
+ ' --tags @smoke.',
175
+ ' --tags ~@wip',
176
+ ' --tags @smoke,@wip',
177
+ ' --tags @smoke,~@wip --tags @regression',
178
+ 'If you want to use multiple exclusion tags, you must use the logical',
179
+ 'AND approach, as in: --tags ~@wip --tags ~@failing',
180
+ 'Positive tags can be given a threshold to limit the number of occurrences.',
181
+ 'Example: --tags @critical:3',
182
+ 'That will fail if there are more than three occurrences of the @critical tag.'
183
183
  ) do |v|
184
184
  @options[:tag_expressions] << v
185
185
  end
186
186
 
187
- opts.separator ""
187
+ opts.separator ''
188
188
 
189
189
  opts.on(PROFILE_SHORT_FLAG, "#{PROFILE_LONG_FLAG} PROFILE",
190
- "Pull commandline arguments from lucid.yml which can be defined as",
191
- "strings or arrays. When a 'default' profile is defined and no profile",
192
- "is specified it is always used. (Unless disabled, see -P below.)",
193
- "When feature files are defined in a profile and on the command line",
194
- "then only the ones from the command line are used."
190
+ 'Pull commandline arguments from lucid.yml which can be defined as',
191
+ 'strings or arrays. When a default profile is defined and no profile',
192
+ 'is specified it is always used. (Unless disabled, see -P below.)',
193
+ 'When feature files are defined in a profile and on the command line',
194
+ 'then only the ones from the command line are used.'
195
195
  ) do |v|
196
196
  @profiles << v
197
197
  end
198
198
 
199
199
  opts.on(NO_PROFILE_SHORT_FLAG, NO_PROFILE_LONG_FLAG,
200
- "Disables all profile loading to avoid using the 'default' profile.") do |v|
200
+ 'Disables all profile loading to avoid using the default profile.') do |v|
201
201
  @disable_profile_loading = true
202
202
  end
203
203
 
204
- opts.separator ""
204
+ opts.separator ''
205
205
 
206
206
  opts.on("-c", "--[no-]color",
207
207
  "Specifies whether or not to use ANSI color in the output. If this",
@@ -277,28 +277,28 @@ module Lucid
277
277
  end
278
278
  end
279
279
 
280
- opts.separator ""
280
+ opts.separator ''
281
281
 
282
- opts.on("-b", "--backtrace", "Show full backtrace for all errors during Lucid execution.") do
282
+ opts.on('-b', '--backtrace', 'Show full backtrace for all errors during Lucid execution.') do
283
283
  Lucid.use_full_backtrace = true
284
284
  end
285
285
 
286
- opts.on("-v", "--verbose", "Show detailed information about Lucid execution.") do
286
+ opts.on('-v', '--verbose', 'Show detailed information about Lucid execution.') do
287
287
  @options[:verbose] = true
288
288
  end
289
289
 
290
- opts.on("--debug", "Show behind-the-scenes information about Lucid execution.") do
290
+ opts.on('--debug', 'Show behind-the-scenes information about Lucid execution.') do
291
291
  @options[:debug] = true
292
292
  end
293
293
 
294
- opts.separator ""
294
+ opts.separator ''
295
295
 
296
- opts.on_tail("--version", "Show Lucid version information.") do
296
+ opts.on_tail('--version', 'Show Lucid version information.') do
297
297
  @out_stream.puts Lucid::VERSION
298
298
  Kernel.exit(0)
299
299
  end
300
300
 
301
- opts.on_tail("-h", "--help", "Show Lucid execution options.") do
301
+ opts.on_tail('-h', '--help', 'Show Lucid execution options.') do
302
302
  @out_stream.puts opts.help
303
303
  Kernel.exit(0)
304
304
  end
@@ -381,7 +381,7 @@ module Lucid
381
381
 
382
382
  def establish_profile
383
383
  if @disable_profile_loading
384
- @out_stream.puts "Disabling profiles..."
384
+ @out_stream.puts 'Disabling profiles...'
385
385
  return
386
386
  end
387
387
 
@@ -46,7 +46,7 @@ module Lucid
46
46
 
47
47
  def default_options
48
48
  {
49
- :autoload_code_paths => ['common', 'steps']
49
+ :autoload_code_paths => ['common', 'steps', 'pages']
50
50
  }
51
51
  end
52
52
  end
@@ -1,5 +1,5 @@
1
1
  require 'erb'
2
- require 'lucid/formatter/ordered_xml_markup'
2
+ require 'builder'
3
3
  require 'lucid/formatter/duration'
4
4
  require 'lucid/formatter/io'
5
5
 
@@ -563,7 +563,7 @@ module Lucid
563
563
  end
564
564
 
565
565
  def create_builder(io)
566
- OrderedXmlMarkup.new(:target => io, :indent => 0)
566
+ Builder::XmlMarkup.new(:target => io, :indent => 0)
567
567
  end
568
568
 
569
569
  class MatcherExtractor #:nodoc:
@@ -1,4 +1,4 @@
1
- require 'lucid/formatter/ordered_xml_markup'
1
+ require 'builder'
2
2
  require 'lucid/formatter/io'
3
3
  require 'lucid/formatter/interceptor'
4
4
  require 'fileutils'
@@ -23,7 +23,7 @@ module Lucid
23
23
  def before_feature(feature)
24
24
  @current_feature = feature
25
25
  @failures = @errors = @tests = @skipped = 0
26
- @builder = OrderedXmlMarkup.new( :indent => 2 )
26
+ @builder = Builder::XmlMarkup.new( :indent => 2 )
27
27
  @time = 0
28
28
  # In order to fill out <system-err/> and <system-out/>, we need to
29
29
  # intercept the $stderr and $stdout
@@ -37,7 +37,7 @@ module Lucid
37
37
  end
38
38
 
39
39
  def after_feature(feature)
40
- @testsuite = OrderedXmlMarkup.new( :indent => 2 )
40
+ @testsuite = Builder::XmlMarkup.new( :indent => 2 )
41
41
  @testsuite.instruct!
42
42
  @testsuite.testsuite(
43
43
  :failures => @failures,
@@ -3,15 +3,15 @@ require 'lucid/generators/project'
3
3
 
4
4
  module Lucid
5
5
  class Generator < Thor
6
- desc "project NAME", "Create a new project."
6
+ desc 'project NAME', 'Create a new project.'
7
7
 
8
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 'symbiont'.)"
9
+ method_option :driver, aliases: '-d', type: :string, required: false, desc: "Framework driver to use. (Default value is 'fluent'.)"
10
10
 
11
11
  def project(name)
12
12
  puts "Name of project: #{name}"
13
13
 
14
- driver = options[:driver].nil? ? 'symbiont' : options[:driver]
14
+ driver = options[:driver].nil? ? 'fluent' : options[:driver]
15
15
  #browser = options[:browser] == true ? 'true' : 'false'
16
16
 
17
17
  #Lucid::Generators::Project.start([name, browser, driver])
@@ -5,13 +5,13 @@ module Lucid
5
5
  class Project < Thor::Group
6
6
  include Thor::Actions
7
7
 
8
- argument :name, type: :string, desc: "Name of the project."
9
- argument :driver, type: :string, desc: "Framework driver to use."
8
+ argument :name, type: :string, desc: 'Name of the project.'
9
+ argument :driver, type: :string, desc: 'Framework driver to use.'
10
10
 
11
- desc "Generates a project structure."
11
+ desc 'Generates a project structure.'
12
12
 
13
13
  def self.source_root
14
- File.dirname(__FILE__) + "/project"
14
+ File.dirname(__FILE__) + '/project'
15
15
  end
16
16
 
17
17
  def spit_back_values
@@ -34,34 +34,34 @@ module Lucid
34
34
  end
35
35
 
36
36
  def copy_errors
37
- copy_file "errors.rb", "#{name}/common/support/errors.rb"
37
+ copy_file 'errors.rb', "#{name}/common/support/errors.rb"
38
38
  end
39
39
 
40
40
  def copy_browser
41
- if driver.downcase == 'symbiont'
42
- copy_file "browser-symbiont.rb", "#{name}/common/support/browser.rb"
41
+ if driver.downcase == 'fluent'
42
+ copy_file 'browser-fluent.rb', "#{name}/common/support/browser.rb"
43
43
  end
44
44
  end
45
45
 
46
46
  def copy_driver
47
- if driver.downcase == 'symbiont'
48
- copy_file "driver-symbiont.rb", "#{name}/common/support/driver.rb"
47
+ if driver.downcase == 'fluent'
48
+ copy_file 'driver-fluent.rb', "#{name}/common/support/driver.rb"
49
49
  end
50
50
  end
51
51
 
52
52
  def copy_events
53
- if driver.downcase == 'symbiont'
54
- copy_file "events-symbiont.rb", "#{name}/common/support/events.rb"
53
+ if driver.downcase == 'fluent'
54
+ copy_file 'events-fluent.rb', "#{name}/common/support/events.rb"
55
55
  end
56
56
  end
57
57
 
58
58
  def copy_gemfile
59
- template "Gemfile.tt", "#{name}/Gemfile"
59
+ template 'Gemfile.tt', "#{name}/Gemfile"
60
60
  end
61
61
 
62
62
  def copy_lucid_yml
63
- if driver.downcase == 'symbiont'
64
- copy_file "lucid-symbiont.yml", "#{name}/lucid.yml"
63
+ if driver.downcase == 'fluent'
64
+ copy_file 'lucid-fluent.yml', "#{name}/lucid.yml"
65
65
  end
66
66
  end
67
67
 
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'lucid'
4
- <% if driver.downcase == 'symbiont' -%>gem 'symbiont'<% end -%>
4
+ <% if driver.downcase == 'fluent' -%>gem 'fluent'<% end -%>
5
5
  gem 'syntax'
6
6
  gem 'rspec'
@@ -1,17 +1,17 @@
1
1
  begin
2
- require 'symbiont'
3
- require 'symbiont/factory'
2
+ require 'fluent'
3
+ require 'fluent/factory'
4
4
  rescue LoadError
5
- STDOUT.puts ["The Symbiont test execution library is not installed.",
6
- "The driver file is currently set to use the Symbiont library but",
7
- "that gem was not found. Run the following command:", "",
8
- " gem install symbiont"].join("\n")
5
+ STDOUT.puts ['The Fluent test execution library is not installed.',
6
+ 'The driver file is currently set to use the Fluent library but',
7
+ 'that gem was not found. Run the following command:', '',
8
+ ' gem install fluent'].join("\n")
9
9
  Kernel.exit(1)
10
10
  end
11
11
 
12
- Domain(Symbiont::Factory)
12
+ Domain(Fluent::Factory)
13
13
 
14
- module Symbiont
14
+ module Fluent
15
15
  module Browser
16
16
 
17
17
  @@browser = false
@@ -3,7 +3,7 @@ AfterConfiguration do |config|
3
3
  end
4
4
 
5
5
  Before('~@practice','~@sequence') do
6
- @browser = Symbiont::Browser.start
6
+ @browser = Fluent::Browser.start
7
7
  end
8
8
 
9
9
  AfterStep('@pause') do
@@ -28,9 +28,9 @@ After do |scenario|
28
28
  # This is an alternative way to embed.
29
29
  #embed screenshot, 'image/png'
30
30
  end
31
- Symbiont::Browser.stop
31
+ Fluent::Browser.stop
32
32
  end
33
33
 
34
34
  at_exit do
35
- Symbiont::Browser.stop
35
+ Fluent::Browser.stop
36
36
  end
@@ -2,7 +2,7 @@ require 'rbconfig'
2
2
 
3
3
  module Lucid
4
4
  unless defined?(Lucid::VERSION)
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/lucid')
7
7
  LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
8
8
  JRUBY = defined?(JRUBY_VERSION)
data/lib/lucid/runtime.rb CHANGED
@@ -50,7 +50,7 @@ module Lucid
50
50
  specs.accept(tdl_walker)
51
51
  end
52
52
 
53
- def features_paths
53
+ def specs_paths
54
54
  @configuration.spec_source
55
55
  end
56
56
 
@@ -17,7 +17,7 @@ module Lucid
17
17
  :embed,
18
18
  :ask,
19
19
  :puts,
20
- :features_paths,
20
+ :specs_paths,
21
21
  :step_match
22
22
 
23
23
  def_delegators :@orchestrator,
@@ -75,10 +75,9 @@ module Lucid
75
75
  # Regular expression that is used to scan for ANSI-sequences while
76
76
  # uncoloring strings.
77
77
  COLORED_REGEXP = /\e\[(?:[34][0-7]|[0-9])?m/
78
-
79
-
78
+
80
79
  def self.included(klass)
81
- if version_is_greater_than_18? and klass == String
80
+ if klass == String
82
81
  ATTRIBUTES.delete(:clear)
83
82
  ATTRIBUTE_NAMES.delete(:clear)
84
83
  end
@@ -106,13 +105,6 @@ module Lucid
106
105
  end
107
106
  extend self
108
107
 
109
- private
110
-
111
- def version_is_greater_than_18?
112
- version = RUBY_VERSION.split('.')
113
- version.map! &:to_i
114
- version[0] >= 1 && version[1] > 8
115
- end
116
108
  end
117
109
  end
118
110
  end
data/lucid.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
- require "lucid/platform"
5
+ require 'lucid/platform'
6
6
 
7
7
  Gem::Specification.new do |gem|
8
8
  gem.name = 'lucid'
9
9
  gem.version = Lucid::VERSION
10
- gem.authors = ["Jeff Nyman"]
10
+ gem.author = 'Jeff Nyman'
11
11
  gem.description = 'Test Description Language Execution Engine'
12
12
  gem.summary = "lucid-#{gem.version}"
13
- gem.email = ['jeffnyman@gmail.com']
13
+ gem.email = 'jeffnyman@gmail.com'
14
14
  gem.license = 'MIT'
15
15
  gem.homepage = 'https://github.com/jnyman/lucid'
16
16
  gem.platform = Gem::Platform::RUBY
@@ -39,5 +39,5 @@ Gem::Specification.new do |gem|
39
39
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
40
40
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
41
41
  gem.rdoc_options = ["--charset=UTF-8"]
42
- gem.require_paths = ["lib"]
42
+ gem.require_paths = %w(lib)
43
43
  end
@@ -11,15 +11,15 @@ module Lucid
11
11
  let(:kernel) { double(:kernel) }
12
12
  subject { App.new(args, stdin, stdout, stderr, kernel) }
13
13
 
14
- describe "start" do
15
- context "passed a runtime" do
14
+ describe 'start' do
15
+ context 'passed a runtime' do
16
16
  let(:runtime) { double('runtime').as_null_object }
17
17
 
18
18
  def do_start
19
19
  subject.start(runtime)
20
20
  end
21
21
 
22
- it "configures the runtime" do
22
+ it 'configures the runtime' do
23
23
  configuration = double('Configuration').as_null_object
24
24
  Configuration.stub(:new => configuration)
25
25
  runtime.should_receive(:configure).with(configuration)
@@ -27,7 +27,7 @@ module Lucid
27
27
  do_start
28
28
  end
29
29
 
30
- it "uses that runtime for running and reporting results" do
30
+ it 'uses that runtime for running and reporting results' do
31
31
  results = double('results', :failure? => true)
32
32
  runtime.should_receive(:run)
33
33
  runtime.stub(:results).and_return(results)
@@ -1,6 +1,27 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  module Lucid
4
+ describe Configuration do
5
+ describe '.default' do
6
+ subject { Configuration.default }
7
+
8
+ it 'has an autoload_code_paths containing default Lucid folders' do
9
+ subject.autoload_code_paths.should include('common')
10
+ subject.autoload_code_paths.should include('steps')
11
+ subject.autoload_code_paths.should include('pages')
12
+ end
13
+ end
14
+
15
+ describe 'supports custom user options' do
16
+ let(:user_options) { { :autoload_code_paths => ['library/common'] } }
17
+ subject { Configuration.new(user_options) }
18
+
19
+ it 'should allow the defaults to be overridden' do
20
+ subject.autoload_code_paths.should == ['library/common']
21
+ end
22
+ end
23
+ end
24
+
4
25
  module CLI
5
26
  describe Configuration do
6
27
 
@@ -52,6 +73,25 @@ module Lucid
52
73
  /steps/steps.rb
53
74
  )
54
75
  end
76
+
77
+ it 'should default to a specs directory when no information is provided' do
78
+ File.stub(:directory?).and_return(true)
79
+ Dir.stub(:[]).with('specs/**/*.spec').and_return(['lucid.spec'])
80
+ config.parse(%w{})
81
+ config.spec_files.should == ['lucid.spec']
82
+ end
83
+
84
+ it 'should search for all specs in the specified directory' do
85
+ File.stub(:directory?).and_return(true)
86
+ Dir.stub(:[]).with('specs/**/*.spec').and_return(["lucid.spec"])
87
+ config.parse(%w{specs/})
88
+ config.spec_files.should == ['lucid.spec']
89
+ end
90
+
91
+ it 'should preserve the order of the spec files' do
92
+ config.parse(%w{test_b.spec test_c.spec test_a.spec})
93
+ config.spec_files.should == %w[test_b.spec test_c.spec test_a.spec]
94
+ end
55
95
 
56
96
  it 'should be able to exclude files based on a specific reference' do
57
97
  with_these_files('/common/support/browser.rb', '/common/support/driver.rb')
@@ -70,6 +110,12 @@ module Lucid
70
110
  /steps/testing.rb
71
111
  )
72
112
  end
113
+
114
+ it 'should allow specifying environment variables on the command line' do
115
+ config.parse(['test=this'])
116
+ ENV['test'].should == 'this'
117
+ config.spec_files.should_not include('test=this')
118
+ end
73
119
 
74
120
  it 'should be able to use a --dry-run option' do
75
121
  config.parse(%w{--dry-run})
@@ -96,15 +142,30 @@ module Lucid
96
142
  config.parse(%w{--verbose})
97
143
  config.options[:verbose].should be_true
98
144
  end
145
+
146
+ describe 'generating output' do
147
+
148
+ it 'should be able to use an --out option' do
149
+ config.parse(%w{--out report.txt})
150
+ config.formats.should == [%w(standard report.txt)]
151
+ end
152
+
153
+ it 'should be able to use multiple --out options' do
154
+ config.parse(%w{--format standard --out report1.txt --out report2.txt})
155
+ config.formats.should == [%w(standard report2.txt)]
156
+ end
157
+
158
+ end
99
159
 
100
- it 'should be able to use an --out option' do
101
- config.parse(%w{--out report.txt})
102
- config.formats.should == [%w(standard report.txt)]
160
+ it 'should be able to use a --color option' do
161
+ Lucid::Term::ANSIColor.should_receive(:coloring=).with(true)
162
+ config.parse(['--color'])
103
163
  end
104
164
 
105
- it 'should be able to use multiple --out options' do
106
- config.parse(%w{--format standard --out report1.txt --out report2.txt})
107
- config.formats.should == [%w(standard report2.txt)]
165
+ it 'should accept --no-color option' do
166
+ Lucid::Term::ANSIColor.should_receive(:coloring=).with(false)
167
+ config = Configuration.new(StringIO.new)
168
+ config.parse(['--no-color'])
108
169
  end
109
170
 
110
171
  end
@@ -0,0 +1,16 @@
1
+ require_relative '../spec_helper'
2
+
3
+ module Lucid
4
+ describe ObjectFactory do
5
+ include ObjectFactory
6
+
7
+ it 'should load a valid formatter' do
8
+ generated_class = create_object_of('Lucid::Formatter::Html')
9
+ generated_class.name.should == 'Lucid::Formatter::Html'
10
+ end
11
+
12
+ it 'should not load an invalid formatter' do
13
+ expect { create_object_of('Lucid::Formatter::Testing') }.to raise_error(LoadError)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,126 @@
1
+ require_relative '../spec_helper'
2
+
3
+ module Lucid
4
+ module CLI
5
+ describe Options do
6
+
7
+ before(:each) do
8
+ Kernel.stub(:exit).and_return(nil)
9
+ end
10
+
11
+ def output_stream
12
+ @output_stream ||= StringIO.new
13
+ end
14
+
15
+ def error_stream
16
+ @error_stream ||= StringIO.new
17
+ end
18
+
19
+ def options
20
+ @options ||= Options.new(output_stream, error_stream)
21
+ end
22
+
23
+ def prep_args(args)
24
+ args.is_a?(Array) ? args : args.split(' ')
25
+ end
26
+
27
+ describe 'parsing options' do
28
+
29
+ def during_parsing(command)
30
+ yield
31
+ options.parse(prep_args(command))
32
+ end
33
+
34
+ def after_parsing(command)
35
+ options.parse(prep_args(command))
36
+ yield
37
+ end
38
+
39
+ context '--version' do
40
+ it "should display Lucid's version" do
41
+ after_parsing('--version') do
42
+ output_stream.string.should =~ /#{Lucid::VERSION}/
43
+ end
44
+ end
45
+
46
+ it 'should exit from any Lucid execution' do
47
+ during_parsing('--version') { Kernel.should_receive(:exit) }
48
+ end
49
+ end
50
+
51
+ context 'environment variables' do
52
+ it 'should put all environment variables into a hash' do
53
+ after_parsing('MODE=symbiont AUTOSPEC=true') do
54
+ options[:env_vars].should == {'MODE' => 'symbiont', 'AUTOSPEC' => 'true'}
55
+ end
56
+ end
57
+ end
58
+
59
+ context '-r or --require' do
60
+ it 'should collect all specified files into an array' do
61
+ after_parsing('--require file_a.rb -r file_b.rb') do
62
+ options[:require].should == ['file_a.rb', 'file_b.rb']
63
+ end
64
+ end
65
+ end
66
+
67
+ context '-n NAME or --name NAME' do
68
+ it 'should store provided scenario names as regular expressions' do
69
+ after_parsing('-n sc1 --name sc2') { options[:name_regexps].should == [/sc1/,/sc2/] }
70
+ end
71
+ end
72
+
73
+ context '-l LINES or --lines LINES' do
74
+ it 'should add line numbers to spec files' do
75
+ options.parse(%w{-l 42 FILE})
76
+ options.instance_variable_get(:@args).should == ['FILE:42']
77
+ end
78
+ end
79
+
80
+ context '-e PATTERN or --exclude PATTERN' do
81
+ it 'should stored provided exclusions as regular expressions' do
82
+ after_parsing('-e file1 --exclude file2') { options[:excludes].should == [/file1/,/file2/] }
83
+ end
84
+ end
85
+
86
+ context '-b or --backtrace' do
87
+ it 'should use a full backtrace during Lucid execution' do
88
+ during_parsing("-b") do
89
+ Lucid.should_receive(:use_full_backtrace=).with(true)
90
+ end
91
+ end
92
+ end
93
+
94
+ context '-t TAGS --tags TAGS' do
95
+ it 'should store tags passed with different --tags options separately' do
96
+ after_parsing('--tags @smoke --tags @wip') { options[:tag_expressions].should == ['@smoke', '@wip'] }
97
+ end
98
+
99
+ it 'should designate tags prefixed with ~ as tags to be excluded' do
100
+ after_parsing('--tags ~@smoke,@wip') { options[:tag_expressions].should == ['~@smoke,@wip'] }
101
+ end
102
+ end
103
+
104
+ context '-f FORMAT or --format FORMAT' do
105
+ it 'should default to using the standard output stream (STDOUT) formatter' do
106
+ after_parsing('-f standard') { options[:formats].should == [['standard', output_stream]] }
107
+ end
108
+ end
109
+
110
+ context '-o [FILE|DIR] or --out [FILE|DIR]' do
111
+ it 'should default to the standard formatter when not specified' do
112
+ after_parsing('-o file.txt') { options[:formats].should == [['standard', 'file.txt']] }
113
+ end
114
+
115
+ it 'should set the output for the formatter defined for each option' do
116
+ after_parsing('-f profile --out file.txt -f standard -o file2.txt') do
117
+ options[:formats].should == [['profile', 'file.txt'], ['standard', 'file2.txt']]
118
+ end
119
+ end
120
+ end
121
+
122
+ end
123
+
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,38 @@
1
+ require_relative '../spec_helper'
2
+
3
+ module Lucid
4
+ describe Runtime do
5
+
6
+ let(:options) { {} }
7
+ subject { Runtime.new(options) }
8
+
9
+ describe '#specs_paths' do
10
+ let(:options) { {:paths => ['specs/area1/test.spec', 'specs/area1/area2/test.spec', 'others_specs'] } }
11
+
12
+ it 'returns the value from the configuration.spec_source' do
13
+ subject.specs_paths.should == options[:spec_source]
14
+ end
15
+ end
16
+
17
+ describe '#configure' do
18
+ let(:orchestrator) { double(Runtime::Orchestrator).as_null_object }
19
+ let(:results) { double(Runtime::Results).as_null_object }
20
+ let(:new_config) { double('New Configuration') }
21
+
22
+ before(:each) do
23
+ Runtime::Orchestrator.stub(:new => orchestrator)
24
+ Runtime::Results.stub(:new => results)
25
+ end
26
+
27
+ it 'tells the orchestrator and results about the new configuration' do
28
+ orchestrator.should_receive(:configure).with(new_config)
29
+ results.should_receive(:configure).with(new_config)
30
+ subject.configure(new_config)
31
+ end
32
+
33
+ it '#doc_string' do
34
+ subject.doc_string('Testing').should == 'Testing'
35
+ end
36
+ end
37
+ 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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Nyman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-28 00:00:00.000000000 Z
11
+ date: 2013-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -115,8 +115,7 @@ dependencies:
115
115
  - !ruby/object:Gem::Version
116
116
  version: 0.7.1
117
117
  description: Test Description Language Execution Engine
118
- email:
119
- - jeffnyman@gmail.com
118
+ email: jeffnyman@gmail.com
120
119
  executables:
121
120
  - lucid
122
121
  - lucid-gen
@@ -192,7 +191,6 @@ files:
192
191
  - lib/lucid/formatter/junit.rb
193
192
  - lib/lucid/formatter/lucid.css
194
193
  - lib/lucid/formatter/lucid.sass
195
- - lib/lucid/formatter/ordered_xml_markup.rb
196
194
  - lib/lucid/formatter/progress.rb
197
195
  - lib/lucid/formatter/rerun.rb
198
196
  - lib/lucid/formatter/standard.rb
@@ -204,11 +202,11 @@ files:
204
202
  - lib/lucid/generator.rb
205
203
  - lib/lucid/generators/project.rb
206
204
  - lib/lucid/generators/project/Gemfile.tt
207
- - lib/lucid/generators/project/browser-symbiont.rb
208
- - lib/lucid/generators/project/driver-symbiont.rb
205
+ - lib/lucid/generators/project/browser-fluent.rb
206
+ - lib/lucid/generators/project/driver-fluent.rb
209
207
  - lib/lucid/generators/project/errors.rb
210
- - lib/lucid/generators/project/events-symbiont.rb
211
- - lib/lucid/generators/project/lucid-symbiont.yml
208
+ - lib/lucid/generators/project/events-fluent.rb
209
+ - lib/lucid/generators/project/lucid-fluent.yml
212
210
  - lib/lucid/interface.rb
213
211
  - lib/lucid/interface_methods.rb
214
212
  - lib/lucid/interface_rb/matcher.rb
@@ -220,7 +218,6 @@ files:
220
218
  - lib/lucid/interface_rb/rb_world.rb
221
219
  - lib/lucid/interface_rb/regexp_argument_matcher.rb
222
220
  - lib/lucid/load_path.rb
223
- - lib/lucid/parser.rb
224
221
  - lib/lucid/platform.rb
225
222
  - lib/lucid/rspec/allow_doubles.rb
226
223
  - lib/lucid/rspec/disallow_options.rb
@@ -256,6 +253,9 @@ files:
256
253
  - lucid.gemspec
257
254
  - spec/lucid/app_spec.rb
258
255
  - spec/lucid/configuration_spec.rb
256
+ - spec/lucid/factory_spec.rb
257
+ - spec/lucid/options_spec.rb
258
+ - spec/lucid/runtime_spec.rb
259
259
  - spec/lucid/sequences/sequence_conditional_spec.rb
260
260
  - spec/lucid/sequences/sequence_group_spec.rb
261
261
  - spec/lucid/sequences/sequence_phrase_spec.rb
@@ -269,7 +269,7 @@ licenses:
269
269
  - MIT
270
270
  metadata: {}
271
271
  post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n
272
- \ Thanks for installing Lucid 0.2.0.\n\n(::) (::) (::) (::) (::) (::) (::) (::)
272
+ \ Thanks for installing Lucid 0.2.1.\n\n(::) (::) (::) (::) (::) (::) (::) (::)
273
273
  (::) (::) (::) (::)\n "
274
274
  rdoc_options:
275
275
  - --charset=UTF-8
@@ -287,13 +287,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  version: '0'
288
288
  requirements: []
289
289
  rubyforge_project:
290
- rubygems_version: 2.0.2
290
+ rubygems_version: 2.0.3
291
291
  signing_key:
292
292
  specification_version: 4
293
- summary: lucid-0.2.0
293
+ summary: lucid-0.2.1
294
294
  test_files:
295
295
  - spec/lucid/app_spec.rb
296
296
  - spec/lucid/configuration_spec.rb
297
+ - spec/lucid/factory_spec.rb
298
+ - spec/lucid/options_spec.rb
299
+ - spec/lucid/runtime_spec.rb
297
300
  - spec/lucid/sequences/sequence_conditional_spec.rb
298
301
  - spec/lucid/sequences/sequence_group_spec.rb
299
302
  - spec/lucid/sequences/sequence_phrase_spec.rb
@@ -1,24 +0,0 @@
1
- begin
2
- require 'builder'
3
- rescue LoadError
4
- gem 'builder'
5
- require 'builder'
6
- end
7
-
8
- module Lucid
9
- module Formatter
10
- # Emits attributes ordered alphabetically, so that we can predicatbly test output.
11
- class OrderedXmlMarkup < Builder::XmlMarkup #:nodoc:
12
- def _insert_attributes(attrs, order=[])
13
- return if attrs.nil?
14
- keys = attrs.keys.map{|k| k.to_s}
15
- keys.sort!
16
- keys.reverse! if (attrs.keys - [:version, :encoding] == []) #HACK to ensure the 'version' attribute is first in xml declaration.
17
- keys.each do |k|
18
- v = attrs[k.to_sym] || attrs[k]
19
- @target << %{ #{k}="#{_attr_value(v)}"} if v
20
- end
21
- end
22
- end
23
- end
24
- end
data/lib/lucid/parser.rb DELETED
@@ -1,2 +0,0 @@
1
- require 'lucid/platform'
2
- require 'lucid/ast'