Sha256: 07e2e2d05b93d4f0a5ee9e969d1422f6ddafb9c76240341ffabe1894ba74f5a8

Contents?: true

Size: 1.87 KB

Versions: 2

Compression:

Stored size: 1.87 KB

Contents

require 'rspec'
require File.dirname(__FILE__) + "/../lib/repo"

describe "select" do
  describe "feature" do
    it 'should return multiple feature file names' do
      gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple"
      result = gs.query do
        select name
        from features
      end
      result.should == [{"name"=>"Simple"}, {"name"=>"Test Feature"},
                        {"name"=>"Test2 Feature"}, {"name"=>"Test3 Feature"}]
    end

    it 'should find the feature description' do
      gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple2"
      result = gs.query do
        select description
        from features
      end
      result.should == {"description"=>"The cat in the hat"}
    end

    it 'should find the feature file uri' do
      gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple"
      result = gs.query do
        select uri
        from features
      end
      result[0]['uri'].should =~ /simple\.feature/
      result[1]['uri'].should =~ /test\.feature/
      result[2]['uri'].should =~ /test2\.feature/
      result[3]['uri'].should =~ /test\_full\.feature/
    end

    it 'should return multiple feature file names with associated tags' do
      gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tagged_features"
      result = gs.query do
        select name, tags
        from features
      end
      result.should == [{"name"=>"Simple", "tags"=>nil},
                        {"name"=>"Test Feature", "tags"=>[{"name"=>"@one", "line"=>1}]},
                        {"name"=>"Test2 Feature", "tags"=>[{"name"=>"@two", "line"=>1}]},
                        {"name"=>"Test3 Feature", "tags"=>[{"name"=>"@one", "line"=>1}, {"name"=>"@two", "line"=>1}]}]
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cql-0.1.3 spec/select_feature_dsl_spec.rb
cql-0.0.2 spec/select_feature_dsl_spec.rb