Sha256: b081f0a2b06e08b48ff7e6ec7b84f531da96f77b0cc8ea13bf95bcb8030a37a7

Contents?: true

Size: 1.82 KB

Versions: 4

Compression:

Stored size: 1.82 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

4 entries across 4 versions & 1 rubygems

Version Path
cql-0.1.6 spec/select_feature_dsl_spec.rb
cql-0.1.5 spec/select_feature_dsl_spec.rb
cql-0.1.2 spec/select_feature_dsl_spec.rb
cql-0.1.0.1 spec/select_feature_dsl_spec.rb