lucid 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +13 -0
  3. data/bin/lucid +1 -7
  4. data/lib/lucid/ast/doc_string.rb +1 -1
  5. data/lib/lucid/ast/step_invocation.rb +2 -2
  6. data/lib/lucid/cli/app.rb +6 -2
  7. data/lib/lucid/cli/configuration.rb +18 -5
  8. data/lib/lucid/cli/options.rb +56 -53
  9. data/lib/lucid/core_ext/instance_exec.rb +1 -2
  10. data/lib/lucid/core_ext/proc.rb +2 -2
  11. data/lib/lucid/errors.rb +3 -3
  12. data/lib/lucid/formatter/ansicolor.rb +20 -21
  13. data/lib/lucid/formatter/console.rb +1 -1
  14. data/lib/lucid/formatter/progress.rb +1 -1
  15. data/lib/lucid/generators/project.rb +1 -7
  16. data/lib/lucid/generators/project/browser-fluent.rb +0 -1
  17. data/lib/lucid/generators/project/events-fluent.rb +1 -4
  18. data/lib/lucid/interface_rb/matcher.rb +7 -7
  19. data/lib/lucid/interface_rb/rb_lucid.rb +2 -0
  20. data/lib/lucid/interface_rb/rb_step_definition.rb +5 -6
  21. data/lib/lucid/interface_rb/rb_world.rb +2 -3
  22. data/lib/lucid/platform.rb +3 -3
  23. data/lib/lucid/runtime/facade.rb +9 -11
  24. data/lib/lucid/runtime/orchestrator.rb +2 -3
  25. data/lib/lucid/runtime/results.rb +0 -2
  26. data/lib/lucid/spec_file.rb +1 -3
  27. data/spec/lucid/ansicolor_spec.rb +31 -0
  28. data/spec/lucid/app_spec.rb +73 -4
  29. data/spec/lucid/ast/background_spec.rb +128 -0
  30. data/spec/lucid/ast/doc_string_spec.rb +36 -0
  31. data/spec/lucid/ast/feature_spec.rb +66 -0
  32. data/spec/lucid/ast/outline_table_spec.rb +21 -0
  33. data/spec/lucid/ast/scenario_outline_spec.rb +81 -0
  34. data/spec/lucid/ast/specs_spec.rb +48 -0
  35. data/spec/lucid/ast/step_invocation_spec.rb +45 -0
  36. data/spec/lucid/ast/step_spec.rb +72 -0
  37. data/spec/lucid/ast/table_spec.rb +265 -0
  38. data/spec/lucid/ast/tdl_factory.rb +78 -0
  39. data/spec/lucid/ast/tdl_walker_spec.rb +21 -0
  40. data/spec/lucid/configuration_spec.rb +163 -8
  41. data/spec/lucid/duration_spec.rb +22 -0
  42. data/spec/lucid/facade_spec.rb +31 -0
  43. data/spec/lucid/matcher_spec.rb +127 -0
  44. data/spec/lucid/options_spec.rb +223 -3
  45. data/spec/lucid/orchestrator_spec.rb +117 -0
  46. data/spec/lucid/pending_spec.rb +45 -0
  47. data/spec/lucid/progress_spec.rb +34 -0
  48. data/spec/lucid/rb_step_definition_spec.rb +127 -0
  49. data/spec/lucid/rb_transform_spec.rb +24 -0
  50. data/spec/lucid/regexp_argument_matcher_spec.rb +19 -0
  51. data/spec/lucid/results_spec.rb +81 -0
  52. data/spec/lucid/runtime_spec.rb +1 -1
  53. data/spec/lucid/step_match_spec.rb +55 -0
  54. data/spec/spec_helper.rb +11 -5
  55. metadata +51 -7
  56. data/.ruby-gemset +0 -1
  57. data/.ruby-version +0 -1
  58. data/lib/lucid/generators/project/lucid-fluent.yml +0 -6
@@ -0,0 +1,265 @@
1
+ require 'spec_helper'
2
+ require 'lucid/ast/table'
3
+
4
+ module Lucid
5
+ module AST
6
+
7
+ describe Table do
8
+ before do
9
+ @table = Table.new([
10
+ %w{one four seven},
11
+ %w{4444 55555 666666}
12
+ ])
13
+
14
+ def @table.cells_rows; super; end
15
+ def @table.columns; super; end
16
+ end
17
+
18
+ it 'should have rows' do
19
+ @table.cells_rows[0].map{|cell| cell.value}.should == %w{one four seven}
20
+ end
21
+
22
+ it 'should have columns' do
23
+ @table.columns[1].map{|cell| cell.value}.should == %w{four 55555}
24
+ end
25
+
26
+ it 'should have headers' do
27
+ @table.headers.should == %w{one four seven}
28
+ end
29
+
30
+ it 'should have same cell objects in rows and columns' do
31
+ @table.cells_rows[1].__send__(:[], 2).should equal(@table.columns[2].__send__(:[], 1))
32
+ end
33
+
34
+ it 'should know about max width of a row' do
35
+ @table.columns[1].__send__(:width).should == 5
36
+ end
37
+
38
+ it 'should be convertible to an array of hashes' do
39
+ @table.hashes.should == [
40
+ {'one' => '4444', 'four' => '55555', 'seven' => '666666'}
41
+ ]
42
+ end
43
+
44
+ it 'should accept symbols as keys for the hashes' do
45
+ @table.hashes.first[:one].should == '4444'
46
+ end
47
+
48
+ it 'should return the row values in order' do
49
+ @table.rows.first.should == %w{4444 55555 666666}
50
+ end
51
+
52
+ describe '#map_column!' do
53
+ it 'should allow mapping columns' do
54
+ @table.map_column!('one') { |v| v.to_i }
55
+ @table.hashes.first['one'].should == 4444
56
+ end
57
+
58
+ it 'applies the block once to each value' do
59
+ headers = ['header']
60
+ rows = ['value']
61
+ table = Table.new [headers, rows]
62
+ count = 0
63
+ table.map_column!('header') { |value| count +=1 }
64
+ table.rows
65
+ count.should eq rows.size
66
+ end
67
+
68
+ it 'should allow mapping columns and take a symbol as the column name' do
69
+ @table.map_column!(:one) { |v| v.to_i }
70
+ @table.hashes.first['one'].should == 4444
71
+ end
72
+
73
+ it 'should allow mapping columns and modify the rows as well' do
74
+ @table.map_column!(:one) { |v| v.to_i }
75
+ @table.rows.first.should include(4444)
76
+ @table.rows.first.should_not include('4444')
77
+ end
78
+
79
+ it 'should pass silently if a mapped column does not exist in non-strict mode' do
80
+ lambda {
81
+ @table.map_column!('two', false) { |v| v.to_i }
82
+ @table.hashes
83
+ }.should_not raise_error
84
+ end
85
+
86
+ it 'should fail if a mapped column does not exist in strict mode' do
87
+ lambda {
88
+ @table.map_column!('two', true) { |v| v.to_i }
89
+ @table.hashes
90
+ }.should raise_error('The column named "two" does not exist')
91
+ end
92
+
93
+ it 'should return the table' do
94
+ (@table.map_column!(:one) { |v| v.to_i }).should == @table
95
+ end
96
+ end
97
+
98
+ describe '#match' do
99
+ before(:each) do
100
+ @table = Table.new([
101
+ %w{one four seven},
102
+ %w{4444 55555 666666}
103
+ ])
104
+ end
105
+
106
+ it 'returns nil if headers do not match' do
107
+ @table.match('does,not,match').should be_nil
108
+ end
109
+
110
+ it 'requires a table: prefix on match' do
111
+ @table.match('table:one,four,seven').should_not be_nil
112
+ end
113
+
114
+ it 'does not match if no table: prefix on match' do
115
+ @table.match('one,four,seven').should be_nil
116
+ end
117
+ end
118
+
119
+ describe '#transpose' do
120
+ before(:each) do
121
+ @table = Table.new([
122
+ %w{one 1111},
123
+ %w{two 22222}
124
+ ])
125
+ end
126
+
127
+ it 'should be convertible in to an array where each row is a hash' do
128
+ @table.transpose.hashes[0].should == {'one' => '1111', 'two' => '22222'}
129
+ end
130
+ end
131
+
132
+ describe '#rows_hash' do
133
+ it 'should return a hash of the rows' do
134
+ table = Table.new([
135
+ %w{one 1111},
136
+ %w{two 22222}
137
+ ])
138
+
139
+ table.rows_hash.should == {'one' => '1111', 'two' => '22222'}
140
+ end
141
+
142
+ it 'should fail if the table does not have two columns' do
143
+ faulty_table = Table.new([
144
+ %w{one 1111 abc},
145
+ %w{two 22222 def}
146
+ ])
147
+
148
+ lambda {
149
+ faulty_table.rows_hash
150
+ }.should raise_error('The table must have exactly 2 columns')
151
+ end
152
+
153
+ it 'should support header and column mapping' do
154
+ table = Table.new([
155
+ %w{one 1111},
156
+ %w{two 22222}
157
+ ])
158
+
159
+ table.map_headers!({ 'two' => 'Two' }) { |header| header.upcase }
160
+ table.map_column!('two', false) { |val| val.to_i }
161
+ table.rows_hash.should == { 'ONE' => '1111', 'Two' => 22222 }
162
+ end
163
+ end
164
+
165
+ describe '#map_headers!' do
166
+ let(:table) do
167
+ Table.new([
168
+ %w{HELLO LUCID},
169
+ %w{4444 55555}
170
+ ])
171
+ end
172
+
173
+ it 'renames the columns to the specified values in the provided hash' do
174
+ @table.map_headers!('one' => :three)
175
+ @table.hashes.first[:three].should == '4444'
176
+ end
177
+
178
+ it 'allows renaming columns using regular expressions' do
179
+ @table.map_headers!(/one|uno/ => :three)
180
+ @table.hashes.first[:three].should == '4444'
181
+ end
182
+
183
+ it 'copies column mappings' do
184
+ @table.map_column!('one') { |v| v.to_i }
185
+ @table.map_headers!('one' => 'three')
186
+ @table.hashes.first['three'].should == 4444
187
+ end
188
+
189
+ it 'takes a block and operates on all the headers with it' do
190
+ table.map_headers! do |header|
191
+ header.downcase
192
+ end
193
+ table.hashes.first.keys.should =~ %w[hello lucid]
194
+ end
195
+
196
+ it 'treats the mappings in the provided hash as overrides when used with a block' do
197
+ table.map_headers!('LUCID' => 'test') do |header|
198
+ header.downcase
199
+ end
200
+ table.hashes.first.keys.should =~ %w[hello test]
201
+ end
202
+ end
203
+
204
+ describe 'replacing arguments' do
205
+ before(:each) do
206
+ @table = Table.new([
207
+ %w{showings movie},
208
+ %w{<showings> <movie>}
209
+ ])
210
+ end
211
+
212
+ it 'should return a new table with arguments replaced with values' do
213
+ table_with_replaced_args = @table.arguments_replaced({'<movie>' => 'Gravity', '<showings>' => '5'})
214
+ table_with_replaced_args.hashes[0]['movie'].should == 'Gravity'
215
+ table_with_replaced_args.hashes[0]['showings'].should == '5'
216
+ end
217
+
218
+ it 'should recognise when entire cell is delimited' do
219
+ @table.should have_text('<movie>')
220
+ end
221
+
222
+ it 'should recognise when just a subset of a cell is delimited' do
223
+ table = Table.new([
224
+ %w{showings movie},
225
+ [nil, "Seeing <director>'s movie"]
226
+ ])
227
+
228
+ table.should have_text('<director>')
229
+ end
230
+
231
+ it 'should replace nil values with nil' do
232
+ table_with_replaced_args = @table.arguments_replaced({'<movie>' => nil})
233
+ table_with_replaced_args.hashes[0]['movie'].should == nil
234
+ end
235
+
236
+ it 'should preserve values which do not match a placeholder when replacing with nil' do
237
+ table = Table.new([
238
+ %w{movie},
239
+ %w{screenplay}
240
+ ])
241
+ table_with_replaced_args = table.arguments_replaced({'<movie>' => nil})
242
+ table_with_replaced_args.hashes[0]['movie'].should == 'screenplay'
243
+ end
244
+
245
+ it 'should not change the original table' do
246
+ @table.arguments_replaced({'<movie>' => 'Gravity'})
247
+ @table.hashes[0]['movie'].should_not == 'Gravity'
248
+ end
249
+
250
+ it 'should not raise an error when there are nil values in the table' do
251
+ table = Table.new([
252
+ ['movie', 'showings'],
253
+ ['<movie', nil]
254
+ ])
255
+
256
+ lambda {
257
+ table.arguments_replaced({'<movie>' => nil, '<showings>' => '5'})
258
+ }.should_not raise_error
259
+ end
260
+ end
261
+
262
+ end
263
+
264
+ end
265
+ end
@@ -0,0 +1,78 @@
1
+ require 'lucid/ast'
2
+
3
+ module Lucid
4
+ module AST
5
+ module TDLFactory
6
+
7
+ class TestDomain
8
+
9
+ end
10
+
11
+ def create_feature(dsl)
12
+ dsl.Given (/^a (.*) step with an inline argument:$/) do |action, table|
13
+ end
14
+
15
+ dsl.Given (/^a (.*) step$/) do |action|
16
+ end
17
+
18
+ dsl.Domain do
19
+ TestDomain.new
20
+ end
21
+
22
+ table = AST::Table.new([
23
+ %w{1 22 333},
24
+ %w{4444 55555 666666}
25
+ ])
26
+
27
+ doc_string = AST::DocString.new(%{\n Testing with\nLucid tools\n}, '')
28
+ location = AST::Location.new('test.spec', 2)
29
+ language = double.as_null_object
30
+
31
+ background = AST::Background.new(
32
+ language,
33
+ location,
34
+ AST::Comment.new(''),
35
+ 'Background:',
36
+ '',
37
+ '',
38
+ [
39
+ Step.new(language, location.on_line(3), 'Given', 'a passing step')
40
+ ]
41
+ )
42
+
43
+ if Lucid::WINDOWS
44
+ location = Location.new('specs\\test.spec', 0)
45
+ else
46
+ location = Location.new('specs/test.spec', 0)
47
+ end
48
+
49
+ AST::Feature.new(
50
+ location,
51
+ background,
52
+ AST::Comment.new("# Feature Comment Line\n"),
53
+ AST::Tags.new(6, [Gherkin::Formatter::Model::Tag.new('smoke', 6),
54
+ Gherkin::Formatter::Model::Tag.new('critical', 6)]),
55
+ 'Feature',
56
+ 'Testing TDL',
57
+ '',
58
+ [AST::Scenario.new(
59
+ language,
60
+ location.on_line(9),
61
+ background,
62
+ AST::Comment.new(" # Scenario Comment Line 1 \n# Scenario Comment Line 2 \n"),
63
+ AST::Tags.new(8, [Gherkin::Formatter::Model::Tag.new('regression', 8),
64
+ Gherkin::Formatter::Model::Tag.new('selenium', 8)]),
65
+ AST::Tags.new(1, []),
66
+ 'Scenario:', 'Test Scenario', '',
67
+ [
68
+ Step.new(language, location.on_line(10), 'Given', 'a passing step with an inline argument:', table),
69
+ Step.new(language, location.on_line(11), 'Given', 'a working step with an inline argument:', doc_string),
70
+ Step.new(language, location.on_line(12), 'Given', 'a non-passing step')
71
+ ]
72
+ )]
73
+ )
74
+ end
75
+
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ module Lucid::AST
4
+
5
+ describe TDLWalker do
6
+ let(:tdl_walker) do
7
+ TDLWalker.new(nil, [double('listener', :before_visit_features => nil)])
8
+ end
9
+ let(:features) { double('features', :accept => nil) }
10
+
11
+ it 'should visit features' do
12
+ tdl_walker.should_not_receive(:warn)
13
+ tdl_walker.visit_features(features)
14
+ end
15
+
16
+ it 'should return self' do
17
+ tdl_walker.visit_features(features).should == tdl_walker
18
+ end
19
+ end
20
+
21
+ end
@@ -1,4 +1,4 @@
1
- require_relative '../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  module Lucid
4
4
  describe Configuration do
@@ -6,9 +6,9 @@ module Lucid
6
6
  subject { Configuration.default }
7
7
 
8
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')
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
12
  end
13
13
  end
14
14
 
@@ -24,6 +24,8 @@ module Lucid
24
24
 
25
25
  module CLI
26
26
  describe Configuration do
27
+
28
+ attr_reader :out, :error
27
29
 
28
30
  module ExposeOptions
29
31
  attr_reader :options
@@ -39,12 +41,13 @@ module Lucid
39
41
  Dir.stub(:[]).and_return(files)
40
42
  end
41
43
 
42
- def with_this_configuration_file(info)
44
+ def with_this_configuration(info)
45
+ Dir.stub(:glob).with('{,.config/,config/}lucid{.yml,.yaml}').and_return(['lucid.yml'])
43
46
  File.stub(:exist?).and_return(true)
44
47
  profile_file = info.is_a?(Hash) ? info.to_yaml : info
45
48
  IO.stub(:read).with('lucid.yml').and_return(profile_file)
46
49
  end
47
-
50
+
48
51
  it 'should require driver.rb files first' do
49
52
  with_these_files('/common/support/browser.rb', '/common/support/driver.rb')
50
53
  config.parse(%w{--require /common})
@@ -77,17 +80,39 @@ module Lucid
77
80
  it 'should default to a specs directory when no information is provided' do
78
81
  File.stub(:directory?).and_return(true)
79
82
  Dir.stub(:[]).with('specs/**/*.spec').and_return(['lucid.spec'])
83
+ Dir.stub(:[]).with('specs/**/*.feature').and_return(['lucid.spec'])
84
+ Dir.stub(:[]).with('specs/**/*.story').and_return(['lucid.spec'])
80
85
  config.parse(%w{})
81
86
  config.spec_files.should == ['lucid.spec']
82
87
  end
83
88
 
84
89
  it 'should search for all specs in the specified directory' do
85
90
  File.stub(:directory?).and_return(true)
86
- Dir.stub(:[]).with('specs/**/*.spec').and_return(["lucid.spec"])
91
+ Dir.stub(:[]).with('specs/**/*.spec').and_return(['lucid.spec'])
92
+ Dir.stub(:[]).with('specs/**/*.feature').and_return(['lucid.spec'])
93
+ Dir.stub(:[]).with('specs/**/*.story').and_return(['lucid.spec'])
87
94
  config.parse(%w{specs/})
88
95
  config.spec_files.should == ['lucid.spec']
89
96
  end
90
-
97
+
98
+ it 'should return the correct spec file type for feature file' do
99
+ File.stub(:directory?).and_return(true)
100
+ Dir.stub(:[]).with('specs/**/*.spec').and_return(['lucid.feature'])
101
+ Dir.stub(:[]).with('specs/**/*.feature').and_return(['lucid.feature'])
102
+ Dir.stub(:[]).with('specs/**/*.story').and_return(['lucid.feature'])
103
+ config.parse(%w{specs/})
104
+ config.spec_files.should == ['lucid.feature']
105
+ end
106
+
107
+ it 'should return the correct spec file type for story file' do
108
+ File.stub(:directory?).and_return(true)
109
+ Dir.stub(:[]).with('specs/**/*.spec').and_return(['lucid.story'])
110
+ Dir.stub(:[]).with('specs/**/*.feature').and_return(['lucid.story'])
111
+ Dir.stub(:[]).with('specs/**/*.story').and_return(['lucid.story'])
112
+ config.parse(%w{specs/})
113
+ config.spec_files.should == ['lucid.story']
114
+ end
115
+
91
116
  it 'should preserve the order of the spec files' do
92
117
  config.parse(%w{test_b.spec test_c.spec test_a.spec})
93
118
  config.spec_files.should == %w[test_b.spec test_c.spec test_a.spec]
@@ -142,6 +167,12 @@ module Lucid
142
167
  config.parse(%w{--verbose})
143
168
  config.options[:verbose].should be_true
144
169
  end
170
+
171
+ it 'uses the default profile when no profile is defined' do
172
+ with_this_configuration({'default' => '--require test_file'})
173
+ config.parse(%w{--format progress})
174
+ config.options[:require].should include('test_file')
175
+ end
145
176
 
146
177
  describe 'generating output' do
147
178
 
@@ -167,6 +198,130 @@ module Lucid
167
198
  config = Configuration.new(StringIO.new)
168
199
  config.parse(['--no-color'])
169
200
  end
201
+
202
+ it 'should accept multiple --format options and put the STDOUT one first so progress is seen' do
203
+ config.parse(%w{--format standard --out output.txt --format progress})
204
+ config.formats.should == [['progress', out], ['standard', 'output.txt']]
205
+ end
206
+
207
+ it 'should not accept multiple --format options when both use implicit STDOUT' do
208
+ lambda do
209
+ config.parse(%w{--format pretty --format progress})
210
+ end.should raise_error('All but one formatter must use --out, only one can print to each stream (or STDOUT)')
211
+ end
212
+
213
+ it 'should accept same --format options with implicit STDOUT, and keep only one' do
214
+ config.parse(%w{--format standard --format standard})
215
+ config.formats.should == [['standard', out]]
216
+ end
217
+
218
+ it 'should not accept multiple --out streams pointing to the same place' do
219
+ lambda do
220
+ config.parse(%w{--format standard --out file1 --format progress --out file1})
221
+ end.should raise_error('All but one formatter must use --out, only one can print to each stream (or STDOUT)')
222
+ end
223
+
224
+ it 'should associate --out to previous --format' do
225
+ config.parse(%w{--format progress --out file1 --format profile --out file2})
226
+ config.formats.should == [['progress', 'file1'], ['profile', 'file2']]
227
+ end
228
+
229
+ it 'should accept same --format options with same --out streams and keep only one' do
230
+ config.parse(%w{--format html --out file --format standard --format html --out file})
231
+ config.formats.should == [['standard', out], ['html', 'file']]
232
+ end
233
+
234
+ it 'should accept same --format options with different --out streams' do
235
+ config.parse(%w{--format html --out file1 --format html --out file2})
236
+ config.formats.should == [['html', 'file1'], ['html', 'file2']]
237
+ end
238
+
239
+ it 'should accept multiple --name options' do
240
+ config.parse(['--name', 'User logs in', '--name', 'User signs up'])
241
+
242
+ config.options[:name_regexps].should include(/User logs in/)
243
+ config.options[:name_regexps].should include(/User signs up/)
244
+ end
245
+
246
+ it 'should accept multiple -n options' do
247
+ config.parse(['-n', 'User logs in', '-n', 'User signs up'])
248
+
249
+ config.options[:name_regexps].should include(/User logs in/)
250
+ config.options[:name_regexps].should include(/User signs up/)
251
+ end
252
+
253
+ it 'should allow specifying environment variables in profiles' do
254
+ with_this_configuration({'selenium' => 'DRIVER=selenium'})
255
+ config.parse(['--profile', 'selenium'])
256
+ ENV['DRIVER'].should == 'selenium'
257
+ config.spec_files.should_not include('DRIVER=selenium')
258
+ end
259
+
260
+ describe 'Dry run execution' do
261
+ it 'returns true when --dry-run was specified on in the arguments' do
262
+ config.parse(['--dry-run'])
263
+ config.dry_run?.should be_true
264
+ end
265
+
266
+ it 'returns true when --dry-run was specified in a profile' do
267
+ with_this_configuration({'default' => '--dry-run'})
268
+ config.parse([])
269
+ config.dry_run?.should be_true
270
+ end
271
+
272
+ it 'returns false by default' do
273
+ config.parse([])
274
+ config.dry_run?.should be_false
275
+ end
276
+ end
277
+
278
+ describe 'Specifying matcher type' do
279
+ it 'returns the matcher type when it was set' do
280
+ config.parse(['--matcher-type', 'classic'])
281
+ config.matcher_type.should eql :classic
282
+ end
283
+
284
+ it 'returns the matcher type when it was set with shorthand option' do
285
+ config.parse(['-I', 'classic'])
286
+ config.matcher_type.should eql :classic
287
+ end
288
+
289
+ it 'returns the default matcher type if it was not set' do
290
+ config.parse([])
291
+ config.matcher_type.should eql :regexp
292
+ end
293
+ end
294
+
295
+ describe 'handling tags' do
296
+ it 'returns an empty expression when no tags are specified' do
297
+ config.parse([])
298
+ config.tag_expression.should be_empty
299
+ end
300
+
301
+ it 'returns an expression when tags are specified' do
302
+ config.parse(['--tags','@smoke'])
303
+ config.tag_expression.should_not be_empty
304
+ end
305
+ end
306
+
307
+ describe 'Getting a backtrace of errors' do
308
+ before do
309
+ Lucid.use_full_backtrace = false
310
+ end
311
+
312
+ it 'should show full backtrace when --backtrace is called for' do
313
+ config = App.new(['--backtrace'])
314
+ begin
315
+ 'x'.should == 'y'
316
+ rescue => e
317
+ e.backtrace[0].should_not == "#{__FILE__}:#{__LINE__ - 2}"
318
+ end
319
+ end
320
+
321
+ after do
322
+ Lucid.use_full_backtrace = false
323
+ end
324
+ end
170
325
 
171
326
  end
172
327
  end