lucid 0.2.1 → 0.3.0
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.
- checksums.yaml +4 -4
- data/HISTORY.md +13 -0
- data/bin/lucid +1 -7
- data/lib/lucid/ast/doc_string.rb +1 -1
- data/lib/lucid/ast/step_invocation.rb +2 -2
- data/lib/lucid/cli/app.rb +6 -2
- data/lib/lucid/cli/configuration.rb +18 -5
- data/lib/lucid/cli/options.rb +56 -53
- data/lib/lucid/core_ext/instance_exec.rb +1 -2
- data/lib/lucid/core_ext/proc.rb +2 -2
- data/lib/lucid/errors.rb +3 -3
- data/lib/lucid/formatter/ansicolor.rb +20 -21
- data/lib/lucid/formatter/console.rb +1 -1
- data/lib/lucid/formatter/progress.rb +1 -1
- data/lib/lucid/generators/project.rb +1 -7
- data/lib/lucid/generators/project/browser-fluent.rb +0 -1
- data/lib/lucid/generators/project/events-fluent.rb +1 -4
- data/lib/lucid/interface_rb/matcher.rb +7 -7
- data/lib/lucid/interface_rb/rb_lucid.rb +2 -0
- data/lib/lucid/interface_rb/rb_step_definition.rb +5 -6
- data/lib/lucid/interface_rb/rb_world.rb +2 -3
- data/lib/lucid/platform.rb +3 -3
- data/lib/lucid/runtime/facade.rb +9 -11
- data/lib/lucid/runtime/orchestrator.rb +2 -3
- data/lib/lucid/runtime/results.rb +0 -2
- data/lib/lucid/spec_file.rb +1 -3
- data/spec/lucid/ansicolor_spec.rb +31 -0
- data/spec/lucid/app_spec.rb +73 -4
- data/spec/lucid/ast/background_spec.rb +128 -0
- data/spec/lucid/ast/doc_string_spec.rb +36 -0
- data/spec/lucid/ast/feature_spec.rb +66 -0
- data/spec/lucid/ast/outline_table_spec.rb +21 -0
- data/spec/lucid/ast/scenario_outline_spec.rb +81 -0
- data/spec/lucid/ast/specs_spec.rb +48 -0
- data/spec/lucid/ast/step_invocation_spec.rb +45 -0
- data/spec/lucid/ast/step_spec.rb +72 -0
- data/spec/lucid/ast/table_spec.rb +265 -0
- data/spec/lucid/ast/tdl_factory.rb +78 -0
- data/spec/lucid/ast/tdl_walker_spec.rb +21 -0
- data/spec/lucid/configuration_spec.rb +163 -8
- data/spec/lucid/duration_spec.rb +22 -0
- data/spec/lucid/facade_spec.rb +31 -0
- data/spec/lucid/matcher_spec.rb +127 -0
- data/spec/lucid/options_spec.rb +223 -3
- data/spec/lucid/orchestrator_spec.rb +117 -0
- data/spec/lucid/pending_spec.rb +45 -0
- data/spec/lucid/progress_spec.rb +34 -0
- data/spec/lucid/rb_step_definition_spec.rb +127 -0
- data/spec/lucid/rb_transform_spec.rb +24 -0
- data/spec/lucid/regexp_argument_matcher_spec.rb +19 -0
- data/spec/lucid/results_spec.rb +81 -0
- data/spec/lucid/runtime_spec.rb +1 -1
- data/spec/lucid/step_match_spec.rb +55 -0
- data/spec/spec_helper.rb +11 -5
- metadata +51 -7
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/lib/lucid/generators/project/lucid-fluent.yml +0 -6
| @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'lucid/interface_rb/rb_language'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Lucid
         | 
| 5 | 
            +
              describe 'Pending' do
         | 
| 6 | 
            +
                before(:each) do
         | 
| 7 | 
            +
                  l = InterfaceRb::RbLanguage.new(Runtime.new)
         | 
| 8 | 
            +
                  l.begin_rb_scenario(double('scenario').as_null_object)
         | 
| 9 | 
            +
                  @domain= l.current_domain
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                it 'should raise a Pending if no block is supplied' do
         | 
| 13 | 
            +
                  lambda {
         | 
| 14 | 
            +
                    @domain.pending 'TODO'
         | 
| 15 | 
            +
                  }.should raise_error(Lucid::Pending, /TODO/)
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                it 'should raise a Pending if a supplied block fails as expected' do
         | 
| 19 | 
            +
                  lambda {
         | 
| 20 | 
            +
                    @domain.pending 'TODO' do
         | 
| 21 | 
            +
                      raise 'that is a problem'
         | 
| 22 | 
            +
                    end
         | 
| 23 | 
            +
                  }.should raise_error(Lucid::Pending, /TODO/)
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                it 'should raise a Pending if a supplied block fails as expected with a double' do
         | 
| 27 | 
            +
                  lambda {
         | 
| 28 | 
            +
                    @domain.pending 'TODO' do
         | 
| 29 | 
            +
                      m = double('test')
         | 
| 30 | 
            +
                      m.should_receive(:testing)
         | 
| 31 | 
            +
                      RSpec::Mocks.verify
         | 
| 32 | 
            +
                    end
         | 
| 33 | 
            +
                  }.should raise_error(Lucid::Pending, /TODO/)
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                it 'should raise a Pending if a supplied block starts working' do
         | 
| 37 | 
            +
                  lambda {
         | 
| 38 | 
            +
                    @domain.pending 'TODO' do
         | 
| 39 | 
            +
                      # Nothing happens here.
         | 
| 40 | 
            +
                    end
         | 
| 41 | 
            +
                  }.should raise_error(Lucid::Pending, /TODO/)
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
                
         | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
            end
         | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            require_relative '../spec_helper'
         | 
| 2 | 
            +
            require 'lucid/formatter/progress'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Lucid
         | 
| 5 | 
            +
              module Formatter
         | 
| 6 | 
            +
                describe Progress do
         | 
| 7 | 
            +
                  
         | 
| 8 | 
            +
                  before(:each) do
         | 
| 9 | 
            +
                    Lucid::Term::ANSIColor.coloring = false
         | 
| 10 | 
            +
                    @out = StringIO.new
         | 
| 11 | 
            +
                    progress = Lucid::Formatter::Progress.new(double('Runtime'), @out, {})
         | 
| 12 | 
            +
                    @visitor = Lucid::AST::TDLWalker.new(nil, [progress])
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  describe 'visiting a table cell value without a status' do
         | 
| 16 | 
            +
                    it 'should take the status from the last run step' do
         | 
| 17 | 
            +
                      step_result = AST::StepResult.new('', '', nil, :failed, nil, 10, nil, nil)
         | 
| 18 | 
            +
                      step_result.accept(@visitor)
         | 
| 19 | 
            +
                      @visitor.visit_outline_table(double) do
         | 
| 20 | 
            +
                        @visitor.visit_table_cell_value('value', nil)
         | 
| 21 | 
            +
                      end
         | 
| 22 | 
            +
                      @out.string.should == "FF"
         | 
| 23 | 
            +
                    end
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  describe 'visiting a table cell which is a table header' do
         | 
| 27 | 
            +
                    it 'should not output anything' do
         | 
| 28 | 
            +
                      @visitor.visit_table_cell_value('value', :skipped_param)
         | 
| 29 | 
            +
                      @out.string.should == ''
         | 
| 30 | 
            +
                    end
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
            end
         | 
| @@ -0,0 +1,127 @@ | |
| 1 | 
            +
            require_relative '../spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Lucid
         | 
| 4 | 
            +
              module InterfaceRb
         | 
| 5 | 
            +
                describe RbStepDefinition do
         | 
| 6 | 
            +
                  let(:interface) { double('interface') }
         | 
| 7 | 
            +
                  let(:orchestrator) { Lucid::Runtime::Orchestrator.new(interface) }
         | 
| 8 | 
            +
                  let(:rb) { orchestrator.load_code_language('rb') }
         | 
| 9 | 
            +
                  let(:dsl) do
         | 
| 10 | 
            +
                    rb
         | 
| 11 | 
            +
                    Object.new.extend(Lucid::InterfaceRb::RbLucid)
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  before do
         | 
| 15 | 
            +
                    rb.before(double('scenario').as_null_object)
         | 
| 16 | 
            +
                    $inside = nil
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  def run_step(text)
         | 
| 20 | 
            +
                    orchestrator.step_match(text).invoke(nil)
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                  
         | 
| 23 | 
            +
                  it 'should allow calling of other steps' do
         | 
| 24 | 
            +
                    dsl.Given /Outside/ do
         | 
| 25 | 
            +
                      step 'Inside'
         | 
| 26 | 
            +
                    end
         | 
| 27 | 
            +
                    dsl.Given /Inside/ do
         | 
| 28 | 
            +
                      $inside = true
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                    run_step 'Outside'
         | 
| 32 | 
            +
                    $inside.should == true
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  it 'should allow calling of other steps with inline arg' do
         | 
| 36 | 
            +
                    dsl.Given /Outside/ do
         | 
| 37 | 
            +
                      step 'Inside', Lucid::AST::Table.new([['inside']])
         | 
| 38 | 
            +
                    end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                    dsl.Given /Inside/ do |table|
         | 
| 41 | 
            +
                      $inside = table.raw[0][0]
         | 
| 42 | 
            +
                    end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    run_step 'Outside'
         | 
| 45 | 
            +
                    $inside.should == 'inside'
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                  context 'mapping to domain methods' do
         | 
| 49 | 
            +
                    it 'should call a method on the domain when specified with a symbol' do
         | 
| 50 | 
            +
                      rb.current_domain.should_receive(:with_symbol)
         | 
| 51 | 
            +
                      dsl.Given /With symbol/, :with_symbol
         | 
| 52 | 
            +
                      run_step 'With symbol'
         | 
| 53 | 
            +
                    end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                    it 'should call a method on a specified object' do
         | 
| 56 | 
            +
                      target = double('target')
         | 
| 57 | 
            +
                      rb.current_domain.stub(:target => target)
         | 
| 58 | 
            +
                      dsl.Given /With symbol on block/, :with_symbol, :on => lambda { target }
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                      target.should_receive(:with_symbol)
         | 
| 61 | 
            +
                      run_step 'With symbol on block'
         | 
| 62 | 
            +
                    end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    it 'should call a method on a specified domain attribute' do
         | 
| 65 | 
            +
                      target = double('target')
         | 
| 66 | 
            +
                      rb.current_domain.stub(:target => target)
         | 
| 67 | 
            +
                      dsl.Given /With symbol on symbol/, :with_symbol, :on => :target
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                      target.should_receive(:with_symbol)
         | 
| 70 | 
            +
                      run_step 'With symbol on symbol'
         | 
| 71 | 
            +
                    end
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  it 'should raise Undefined when inside step is not defined' do
         | 
| 75 | 
            +
                    dsl.Given /Outside/ do
         | 
| 76 | 
            +
                      step 'Inside'
         | 
| 77 | 
            +
                    end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                    lambda { run_step 'Outside' }.should raise_error(Lucid::Undefined, 'Undefined step: "Inside"')
         | 
| 80 | 
            +
                  end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                  it 'should allow forced pending' do
         | 
| 83 | 
            +
                    dsl.Given /Outside/ do
         | 
| 84 | 
            +
                      pending('This needs to be tested.')
         | 
| 85 | 
            +
                    end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                    lambda { run_step 'Outside' }.should raise_error(Lucid::Pending, 'This needs to be tested.')
         | 
| 88 | 
            +
                  end
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                  it 'should allow puts' do
         | 
| 91 | 
            +
                    interface.should_receive(:puts).with('testing')
         | 
| 92 | 
            +
                    dsl.Given /Say Something/ do
         | 
| 93 | 
            +
                      puts 'testing'
         | 
| 94 | 
            +
                    end
         | 
| 95 | 
            +
                    run_step 'Say Something'
         | 
| 96 | 
            +
                  end
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                  it 'should recognize $arg style captures' do
         | 
| 99 | 
            +
                    arg_value = 'testing'
         | 
| 100 | 
            +
                    dsl.Given 'capture this: $arg' do |arg|
         | 
| 101 | 
            +
                      arg.should == arg_value
         | 
| 102 | 
            +
                    end
         | 
| 103 | 
            +
                    run_step 'capture this: testing'
         | 
| 104 | 
            +
                  end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                  it 'should have a JSON representation of the signature' do
         | 
| 107 | 
            +
                    RbStepDefinition.new(rb, /There are (\d+) Lucid tests/i, lambda{}, {}).to_hash.should == {'source' => "There are (\\d+) Lucid tests", 'flags' => 'i'}
         | 
| 108 | 
            +
                  end
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                  it 'should raise ArityMismatchError when the number of capture groups differs from the number of step arguments' do
         | 
| 111 | 
            +
                    dsl.Given /No group: \w+/ do |arg|
         | 
| 112 | 
            +
                    end
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                    lambda { run_step 'No group: arg' }.should raise_error(Lucid::ArityMismatchError)
         | 
| 115 | 
            +
                  end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  it 'should not allow modification of args since it messes up nice formatting' do
         | 
| 118 | 
            +
                    dsl.Given /Lucid tests are (.*)/ do |status|
         | 
| 119 | 
            +
                      status << 'good'
         | 
| 120 | 
            +
                    end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                    lambda { run_step 'Lucid tests are good' }.should raise_error(RuntimeError, /can't modify frozen String/i)
         | 
| 123 | 
            +
                  end
         | 
| 124 | 
            +
                  
         | 
| 125 | 
            +
                end
         | 
| 126 | 
            +
              end
         | 
| 127 | 
            +
            end
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            require_relative '../spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Lucid
         | 
| 4 | 
            +
              module InterfaceRb
         | 
| 5 | 
            +
                describe RbTransform do
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                  def transform(regexp)
         | 
| 8 | 
            +
                    RbTransform.new(nil, regexp, lambda { |a| })
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
                  
         | 
| 11 | 
            +
                  it 'converts captures groups to non-capture groups' do
         | 
| 12 | 
            +
                    transform(/(a|b)bc/).to_s.should == '(?:a|b)bc'
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  it 'leaves non-capture groups alone' do
         | 
| 16 | 
            +
                    transform(/(?:a|b)bc/).to_s.should == '(?:a|b)bc'
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  it 'strips away line anchors' do
         | 
| 20 | 
            +
                    transform(/^xyz$/).to_s.should == 'xyz'
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require_relative '../spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Lucid
         | 
| 4 | 
            +
              module InterfaceRb
         | 
| 5 | 
            +
                describe RegexpArgumentMatcher do
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                  it 'should create two arguments' do
         | 
| 8 | 
            +
                    arguments = RegexpArgumentMatcher.arguments_from(/Lucid (\w+) (\w+)/, 'Lucid works well')
         | 
| 9 | 
            +
                    arguments.map{|argument| [argument.val, argument.offset]}.should == [['works', 6], ['well', 12]]
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  it 'should create two arguments when first group is optional' do
         | 
| 13 | 
            +
                    arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be shown '([^']*?)'$/, "should be shown 'Login failed.'")
         | 
| 14 | 
            +
                    arguments.map{|argument| [argument.val, argument.offset]}.should == [[nil, nil], ['Login failed.', 17]]
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
                  
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,81 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Lucid
         | 
| 4 | 
            +
              describe Runtime::Results do
         | 
| 5 | 
            +
                let(:configuration) {double 'Configuration', :strict? => false}
         | 
| 6 | 
            +
                let(:passed_scenario) {double 'Scenario', :status => :passed}
         | 
| 7 | 
            +
                let(:failed_scenario) {double 'Scenario', :status => :failed}
         | 
| 8 | 
            +
                let(:passed_step) {double 'Step', :status => :passed}
         | 
| 9 | 
            +
                let(:failed_step) {double 'Step', :status => :failed}
         | 
| 10 | 
            +
                let(:pending_step) {double 'Step', :status => :pending}
         | 
| 11 | 
            +
                let(:undefined_step) {double 'Step', :status => :undefined}
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                subject {described_class.new(configuration)}
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                describe '#failure?' do
         | 
| 16 | 
            +
                  context 'feature is not work in progress' do
         | 
| 17 | 
            +
                    before do
         | 
| 18 | 
            +
                      configuration.stub(:wip? => false)
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    it 'should return true if a scenario failed' do
         | 
| 22 | 
            +
                      subject.scenario_visited(passed_scenario)
         | 
| 23 | 
            +
                      subject.scenario_visited(failed_scenario)
         | 
| 24 | 
            +
                      subject.should be_failure
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                    it 'should return true if a step failed' do
         | 
| 28 | 
            +
                      subject.step_visited(failed_step)
         | 
| 29 | 
            +
                      subject.should be_failure
         | 
| 30 | 
            +
                    end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                    it 'should return false if there are no scenarios' do
         | 
| 33 | 
            +
                      subject.should_not be_failure
         | 
| 34 | 
            +
                    end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    it 'should return false if all scenarios passed' do
         | 
| 37 | 
            +
                      subject.scenario_visited(passed_scenario)
         | 
| 38 | 
            +
                      subject.scenario_visited(passed_scenario)
         | 
| 39 | 
            +
                      subject.should_not be_failure
         | 
| 40 | 
            +
                    end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    context 'configuration is strict' do
         | 
| 43 | 
            +
                      before do
         | 
| 44 | 
            +
                        configuration.stub(:strict? => true)
         | 
| 45 | 
            +
                      end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                      it 'should return true if a step is pending' do
         | 
| 48 | 
            +
                        subject.step_visited(pending_step)
         | 
| 49 | 
            +
                        subject.should be_failure
         | 
| 50 | 
            +
                      end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                      it 'should return true if a step is undefined' do
         | 
| 53 | 
            +
                        subject.step_visited(undefined_step)
         | 
| 54 | 
            +
                        subject.should be_failure
         | 
| 55 | 
            +
                      end
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
                  end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                  context 'feature is work in progress' do
         | 
| 60 | 
            +
                    before do
         | 
| 61 | 
            +
                      configuration.stub(:wip? => true)
         | 
| 62 | 
            +
                    end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    it 'should return true if a scenario passed' do
         | 
| 65 | 
            +
                      subject.scenario_visited(passed_scenario)
         | 
| 66 | 
            +
                      subject.should be_failure
         | 
| 67 | 
            +
                    end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                    it 'should return false if there are no scenarios' do
         | 
| 70 | 
            +
                      subject.should_not be_failure
         | 
| 71 | 
            +
                    end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                    it 'should return false if all scenarios fail' do
         | 
| 74 | 
            +
                      subject.scenario_visited(failed_scenario)
         | 
| 75 | 
            +
                      subject.should_not be_failure
         | 
| 76 | 
            +
                    end
         | 
| 77 | 
            +
                  end
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
                
         | 
| 80 | 
            +
              end
         | 
| 81 | 
            +
            end
         | 
    
        data/spec/lucid/runtime_spec.rb
    CHANGED
    
    
| @@ -0,0 +1,55 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'lucid/interface_rb/rb_language'
         | 
| 4 | 
            +
            require 'lucid/interface_rb/rb_step_definition'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module Lucid
         | 
| 7 | 
            +
              describe StepMatch do
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                WORD = '[[:word:]]'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                before do
         | 
| 12 | 
            +
                  @rb_code = InterfaceRb::RbLanguage.new(nil)
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def testdef(regexp)
         | 
| 16 | 
            +
                  InterfaceRb::RbStepDefinition.new(@rb_code, regexp, lambda{}, {})
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def step_match(regexp, name)
         | 
| 20 | 
            +
                  testdef = testdef(regexp)
         | 
| 21 | 
            +
                  StepMatch.new(testdef, name, nil, testdef.arguments_from(name))
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                it 'should format groups with format string' do
         | 
| 25 | 
            +
                  result = step_match(/Lucid (#{WORD}+) (\d+) (#{WORD}+) this (#{WORD}+)/, 'Lucid parsed 10 tests this build')
         | 
| 26 | 
            +
                  result.format_args('<span>%s</span>').should == 'Lucid <span>parsed</span> <span>10</span> <span>tests</span> this <span>build</span>'
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                it 'should format groups with format string when there are duplications' do
         | 
| 30 | 
            +
                  result = step_match(/Lucid (#{WORD}+) (\d+) (#{WORD}+) this (#{WORD}+)/, 'Lucid testing 1 tester this test')
         | 
| 31 | 
            +
                  result.format_args('<span>%s</span>').should == 'Lucid <span>testing</span> <span>1</span> <span>tester</span> this <span>test</span>'
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                it 'should format groups with block' do
         | 
| 35 | 
            +
                  result = step_match(/Lucid (#{WORD}+) (\d+) (#{WORD}+) this (#{WORD}+)/, 'Lucid parsed 1 test this build')
         | 
| 36 | 
            +
                  result.format_args(&lambda{|m| "<span>#{m}</span>"}).should == 'Lucid <span>parsed</span> <span>1</span> <span>test</span> this <span>build</span>'
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                it 'should format groups with proc object' do
         | 
| 40 | 
            +
                  result = step_match(/Lucid (#{WORD}+) (\d+) (#{WORD}+) this (#{WORD}+)/, 'Lucid parsed 1 test this build')
         | 
| 41 | 
            +
                  result.format_args(lambda{|m| "<span>#{m}</span>"}).should == 'Lucid <span>parsed</span> <span>1</span> <span>test</span> this <span>build</span>'
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                it 'should format groups even when the first group is optional and not matched' do
         | 
| 45 | 
            +
                  result = step_match(/should( not)? show message '([^']*?)'$/, "App should show message 'Login failed.'")
         | 
| 46 | 
            +
                  result.format_args('<span>%s</span>').should == "App should show message '<span>Login failed.</span>'"
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                it 'should format embedded groups' do
         | 
| 50 | 
            +
                  result = step_match(/running( (\d+) scenarios)? (\d+) tests/, 'running 5 scenarios 10 tests')
         | 
| 51 | 
            +
                  result.format_args('<span>%s</span>').should == 'running<span> 5 scenarios</span> <span>10</span> tests'
         | 
| 52 | 
            +
                end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              end
         | 
| 55 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -3,11 +3,17 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) | |
| 3 3 | 
             
            require 'coveralls'
         | 
| 4 4 | 
             
            Coveralls.wear!
         | 
| 5 5 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
               | 
| 6 | 
            +
            SimpleCov.add_filter '/spec'
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
         | 
| 9 | 
            +
              SimpleCov::Formatter::HTMLFormatter,
         | 
| 10 | 
            +
              Coveralls::SimpleCov::Formatter
         | 
| 11 | 
            +
            ]
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            SimpleCov.at_exit do
         | 
| 14 | 
            +
              SimpleCov.result.format!
         | 
| 15 | 
            +
              SimpleCov.minimum_coverage 60
         | 
| 16 | 
            +
              SimpleCov.maximum_coverage_drop 5
         | 
| 11 17 | 
             
            end
         | 
| 12 18 |  | 
| 13 19 | 
             
            require 'lucid'
         | 
    
        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. | 
| 4 | 
            +
              version: 0.3.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: 2013- | 
| 11 | 
            +
            date: 2013-11-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: thor
         | 
| @@ -123,8 +123,6 @@ extensions: [] | |
| 123 123 | 
             
            extra_rdoc_files: []
         | 
| 124 124 | 
             
            files:
         | 
| 125 125 | 
             
            - .gitignore
         | 
| 126 | 
            -
            - .ruby-gemset
         | 
| 127 | 
            -
            - .ruby-version
         | 
| 128 126 | 
             
            - .travis.yml
         | 
| 129 127 | 
             
            - Gemfile
         | 
| 130 128 | 
             
            - HISTORY.md
         | 
| @@ -206,7 +204,6 @@ files: | |
| 206 204 | 
             
            - lib/lucid/generators/project/driver-fluent.rb
         | 
| 207 205 | 
             
            - lib/lucid/generators/project/errors.rb
         | 
| 208 206 | 
             
            - lib/lucid/generators/project/events-fluent.rb
         | 
| 209 | 
            -
            - lib/lucid/generators/project/lucid-fluent.yml
         | 
| 210 207 | 
             
            - lib/lucid/interface.rb
         | 
| 211 208 | 
             
            - lib/lucid/interface_methods.rb
         | 
| 212 209 | 
             
            - lib/lucid/interface_rb/matcher.rb
         | 
| @@ -251,10 +248,32 @@ files: | |
| 251 248 | 
             
            - lib/lucid/wire_support/wire_protocol/requests.rb
         | 
| 252 249 | 
             
            - lib/lucid/wire_support/wire_step_definition.rb
         | 
| 253 250 | 
             
            - lucid.gemspec
         | 
| 251 | 
            +
            - spec/lucid/ansicolor_spec.rb
         | 
| 254 252 | 
             
            - spec/lucid/app_spec.rb
         | 
| 253 | 
            +
            - spec/lucid/ast/background_spec.rb
         | 
| 254 | 
            +
            - spec/lucid/ast/doc_string_spec.rb
         | 
| 255 | 
            +
            - spec/lucid/ast/feature_spec.rb
         | 
| 256 | 
            +
            - spec/lucid/ast/outline_table_spec.rb
         | 
| 257 | 
            +
            - spec/lucid/ast/scenario_outline_spec.rb
         | 
| 258 | 
            +
            - spec/lucid/ast/specs_spec.rb
         | 
| 259 | 
            +
            - spec/lucid/ast/step_invocation_spec.rb
         | 
| 260 | 
            +
            - spec/lucid/ast/step_spec.rb
         | 
| 261 | 
            +
            - spec/lucid/ast/table_spec.rb
         | 
| 262 | 
            +
            - spec/lucid/ast/tdl_factory.rb
         | 
| 263 | 
            +
            - spec/lucid/ast/tdl_walker_spec.rb
         | 
| 255 264 | 
             
            - spec/lucid/configuration_spec.rb
         | 
| 265 | 
            +
            - spec/lucid/duration_spec.rb
         | 
| 266 | 
            +
            - spec/lucid/facade_spec.rb
         | 
| 256 267 | 
             
            - spec/lucid/factory_spec.rb
         | 
| 268 | 
            +
            - spec/lucid/matcher_spec.rb
         | 
| 257 269 | 
             
            - spec/lucid/options_spec.rb
         | 
| 270 | 
            +
            - spec/lucid/orchestrator_spec.rb
         | 
| 271 | 
            +
            - spec/lucid/pending_spec.rb
         | 
| 272 | 
            +
            - spec/lucid/progress_spec.rb
         | 
| 273 | 
            +
            - spec/lucid/rb_step_definition_spec.rb
         | 
| 274 | 
            +
            - spec/lucid/rb_transform_spec.rb
         | 
| 275 | 
            +
            - spec/lucid/regexp_argument_matcher_spec.rb
         | 
| 276 | 
            +
            - spec/lucid/results_spec.rb
         | 
| 258 277 | 
             
            - spec/lucid/runtime_spec.rb
         | 
| 259 278 | 
             
            - spec/lucid/sequences/sequence_conditional_spec.rb
         | 
| 260 279 | 
             
            - spec/lucid/sequences/sequence_group_spec.rb
         | 
| @@ -263,13 +282,14 @@ files: | |
| 263 282 | 
             
            - spec/lucid/sequences/sequence_section_spec.rb
         | 
| 264 283 | 
             
            - spec/lucid/sequences/sequence_support_spec.rb
         | 
| 265 284 | 
             
            - spec/lucid/sequences/sequence_template_spec.rb
         | 
| 285 | 
            +
            - spec/lucid/step_match_spec.rb
         | 
| 266 286 | 
             
            - spec/spec_helper.rb
         | 
| 267 287 | 
             
            homepage: https://github.com/jnyman/lucid
         | 
| 268 288 | 
             
            licenses:
         | 
| 269 289 | 
             
            - MIT
         | 
| 270 290 | 
             
            metadata: {}
         | 
| 271 291 | 
             
            post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n
         | 
| 272 | 
            -
              \ Thanks for installing Lucid 0. | 
| 292 | 
            +
              \ Thanks for installing Lucid 0.3.0.\n\n(::) (::) (::) (::) (::) (::) (::) (::)
         | 
| 273 293 | 
             
              (::) (::) (::) (::)\n  "
         | 
| 274 294 | 
             
            rdoc_options:
         | 
| 275 295 | 
             
            - --charset=UTF-8
         | 
| @@ -290,12 +310,34 @@ rubyforge_project: | |
| 290 310 | 
             
            rubygems_version: 2.0.3
         | 
| 291 311 | 
             
            signing_key: 
         | 
| 292 312 | 
             
            specification_version: 4
         | 
| 293 | 
            -
            summary: lucid-0. | 
| 313 | 
            +
            summary: lucid-0.3.0
         | 
| 294 314 | 
             
            test_files:
         | 
| 315 | 
            +
            - spec/lucid/ansicolor_spec.rb
         | 
| 295 316 | 
             
            - spec/lucid/app_spec.rb
         | 
| 317 | 
            +
            - spec/lucid/ast/background_spec.rb
         | 
| 318 | 
            +
            - spec/lucid/ast/doc_string_spec.rb
         | 
| 319 | 
            +
            - spec/lucid/ast/feature_spec.rb
         | 
| 320 | 
            +
            - spec/lucid/ast/outline_table_spec.rb
         | 
| 321 | 
            +
            - spec/lucid/ast/scenario_outline_spec.rb
         | 
| 322 | 
            +
            - spec/lucid/ast/specs_spec.rb
         | 
| 323 | 
            +
            - spec/lucid/ast/step_invocation_spec.rb
         | 
| 324 | 
            +
            - spec/lucid/ast/step_spec.rb
         | 
| 325 | 
            +
            - spec/lucid/ast/table_spec.rb
         | 
| 326 | 
            +
            - spec/lucid/ast/tdl_factory.rb
         | 
| 327 | 
            +
            - spec/lucid/ast/tdl_walker_spec.rb
         | 
| 296 328 | 
             
            - spec/lucid/configuration_spec.rb
         | 
| 329 | 
            +
            - spec/lucid/duration_spec.rb
         | 
| 330 | 
            +
            - spec/lucid/facade_spec.rb
         | 
| 297 331 | 
             
            - spec/lucid/factory_spec.rb
         | 
| 332 | 
            +
            - spec/lucid/matcher_spec.rb
         | 
| 298 333 | 
             
            - spec/lucid/options_spec.rb
         | 
| 334 | 
            +
            - spec/lucid/orchestrator_spec.rb
         | 
| 335 | 
            +
            - spec/lucid/pending_spec.rb
         | 
| 336 | 
            +
            - spec/lucid/progress_spec.rb
         | 
| 337 | 
            +
            - spec/lucid/rb_step_definition_spec.rb
         | 
| 338 | 
            +
            - spec/lucid/rb_transform_spec.rb
         | 
| 339 | 
            +
            - spec/lucid/regexp_argument_matcher_spec.rb
         | 
| 340 | 
            +
            - spec/lucid/results_spec.rb
         | 
| 299 341 | 
             
            - spec/lucid/runtime_spec.rb
         | 
| 300 342 | 
             
            - spec/lucid/sequences/sequence_conditional_spec.rb
         | 
| 301 343 | 
             
            - spec/lucid/sequences/sequence_group_spec.rb
         | 
| @@ -304,4 +346,6 @@ test_files: | |
| 304 346 | 
             
            - spec/lucid/sequences/sequence_section_spec.rb
         | 
| 305 347 | 
             
            - spec/lucid/sequences/sequence_support_spec.rb
         | 
| 306 348 | 
             
            - spec/lucid/sequences/sequence_template_spec.rb
         | 
| 349 | 
            +
            - spec/lucid/step_match_spec.rb
         | 
| 307 350 | 
             
            - spec/spec_helper.rb
         | 
| 351 | 
            +
            has_rdoc: 
         |