cql 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- metadata +5 -34
- data/Gemfile +0 -3
- data/README.md +0 -4
- data/cql.gemspec +0 -36
- data/fixtures/.gitkeep +0 -0
- data/fixtures/features/scen_outlines/basic/test_with_scenarios.feature +0 -15
- data/fixtures/features/scen_outlines/multiple_examples/test_with_scenarios.feature +0 -19
- data/fixtures/features/scenario/simple/simple.feature +0 -8
- data/fixtures/features/scenario/simple/test.feature +0 -9
- data/fixtures/features/scenario/simple/test2.feature +0 -5
- data/fixtures/features/scenario/simple/test_full.feature +0 -22
- data/fixtures/features/scenario/simple2/test_full.feature +0 -23
- data/fixtures/features/scenario/table/simple.feature +0 -8
- data/fixtures/features/scenario/tagged_features/simple.feature +0 -8
- data/fixtures/features/scenario/tagged_features/test.feature +0 -10
- data/fixtures/features/scenario/tagged_features/test2.feature +0 -6
- data/fixtures/features/scenario/tagged_features/test_full.feature +0 -22
- data/fixtures/features/scenario/tags/simple.feature +0 -24
- data/fixtures/features/scenario/tags2/simple.feature +0 -24
- data/fixtures/features/scenario/tags2/simple2.feature +0 -24
- data/lib/dsl.rb +0 -56
- data/lib/map_reduce.rb +0 -64
- data/lib/repo.rb +0 -34
- data/projectFilesBackup/.idea/workspace.xml +0 -570
- data/spec/filter_dsl_spec.rb +0 -87
- data/spec/map_reduce_spec.rb +0 -88
- data/spec/select_feature_dsl_spec.rb +0 -50
- data/spec/select_scen_outline_dsl_spec.rb +0 -126
- data/spec/select_scenario_dsl_spec.rb +0 -73
- data/spec/unit_spec.rb +0 -22
data/spec/filter_dsl_spec.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/repo"
|
3
|
-
|
4
|
-
describe "cql" do
|
5
|
-
|
6
|
-
describe 'filter features by name' do
|
7
|
-
it 'should filter by name' do
|
8
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tagged_features"
|
9
|
-
|
10
|
-
result = gs.query do
|
11
|
-
select name
|
12
|
-
from features
|
13
|
-
with name 'Test2 Feature'
|
14
|
-
end
|
15
|
-
|
16
|
-
result.should == {"name"=> "Test2 Feature"}
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should filter by name regexp' do
|
20
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tagged_features"
|
21
|
-
|
22
|
-
result = gs.query do
|
23
|
-
select name
|
24
|
-
from features
|
25
|
-
with name /Test2 Feature/
|
26
|
-
end
|
27
|
-
|
28
|
-
result.should == {"name"=> "Test2 Feature"}
|
29
|
-
|
30
|
-
result = gs.query do
|
31
|
-
select name
|
32
|
-
from features
|
33
|
-
with name /Feature/
|
34
|
-
end
|
35
|
-
|
36
|
-
result.size.should == 3
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe 'filter features by tag' do
|
41
|
-
it 'should filter by a single tag' do
|
42
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tagged_features"
|
43
|
-
|
44
|
-
result = gs.query do
|
45
|
-
select name
|
46
|
-
from features
|
47
|
-
with tags '@one'
|
48
|
-
end
|
49
|
-
|
50
|
-
result.should == [{"name"=> "Test Feature"}, {"name"=>"Test3 Feature"}]
|
51
|
-
|
52
|
-
result = gs.query do
|
53
|
-
select name
|
54
|
-
from features
|
55
|
-
with tags '@two'
|
56
|
-
end
|
57
|
-
|
58
|
-
result.should == [{"name"=> "Test2 Feature"}, {"name"=>"Test3 Feature"}]
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'should filter by multiple filters' do
|
62
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tagged_features"
|
63
|
-
|
64
|
-
result = gs.query do
|
65
|
-
select name
|
66
|
-
from features
|
67
|
-
with tags '@two'
|
68
|
-
with tags '@one'
|
69
|
-
end
|
70
|
-
|
71
|
-
result.should == {"name"=>"Test3 Feature"}
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should filter by a multiple tags' do
|
75
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tagged_features"
|
76
|
-
|
77
|
-
result = gs.query do
|
78
|
-
select name
|
79
|
-
from features
|
80
|
-
with tags '@one', '@two'
|
81
|
-
end
|
82
|
-
|
83
|
-
result.should == {"name"=>"Test3 Feature"}
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
data/spec/map_reduce_spec.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/repo"
|
3
|
-
|
4
|
-
describe "cql" do
|
5
|
-
|
6
|
-
describe "file parsing" do
|
7
|
-
it 'should find the physical files' do
|
8
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple"
|
9
|
-
result = CQL::MapReduce.uri(gs.parsed_feature_files)
|
10
|
-
result[0].should =~ /simple\.feature/
|
11
|
-
result[1].should =~ /test\.feature/
|
12
|
-
result[2].should =~ /test2\.feature/
|
13
|
-
result[3].should =~ /test_full\.feature/
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "tags" do
|
18
|
-
it "retrieve tags from a scenario" do
|
19
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tags2"
|
20
|
-
CQL::MapReduce.tag_set(gs.parsed_feature_files).sort.should == ["@five", "@four", "@one", "@two"].sort
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should filter features by tag' do
|
24
|
-
input = [{"keyword"=>"Feature", "name"=>"Simple", "line"=>1, "description"=>"", "tags"=>[{"name"=>"@two", "line"=>1}], "id"=>"simple", "uri"=>"/a/a"},
|
25
|
-
{"keyword"=>"Feature", "name"=>"Test Feature", "line"=>2, "description"=>"", "tags"=>[{"name"=>"@one", "line"=>1}], "id"=>"test-feature"},
|
26
|
-
{"keyword"=>"Feature", "name"=>"Test2 Feature", "line"=>1, "description"=>"", "id"=>"test2-feature"},
|
27
|
-
{"keyword"=>"Feature", "name"=>"Test3 Feature", "line"=>2, "description"=>"", "tags"=>[{"name"=>"@one", "line"=>1}], "id"=>"test3-feature"}]
|
28
|
-
result = CQL::MapReduce.filter_features(input, 'tags'=>['@one'])
|
29
|
-
result.size.should == 2
|
30
|
-
result[0]['name'].should == "Test Feature"
|
31
|
-
result[1]['name'].should == "Test3 Feature"
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should filter by multiple tags' do
|
35
|
-
input = [{"keyword"=>"Feature", "name"=>"Simple", "line"=>1, "description"=>"", "id"=>"simple"},
|
36
|
-
{"keyword"=>"Feature", "name"=>"Test Feature", "line"=>2, "description"=>"", "tags"=>[{"name"=>"@one", "line"=>1}], "id"=>"test-feature"},
|
37
|
-
{"keyword"=>"Feature", "name"=>"Test2 Feature", "line"=>2, "description"=>"", "tags"=>[{"name"=>"@two", "line"=>1}], "id"=>"test2-feature"},
|
38
|
-
{"keyword"=>"Feature", "name"=>"Test3 Feature", "line"=>2, "description"=>"", "tags"=>[{"name"=>"@one", "line"=>1}, {"name"=>"@two", "line"=>1}], "id"=>"test3-feature"}]
|
39
|
-
result = CQL::MapReduce.filter_features(input, 'tags'=>['@one', '@two'])
|
40
|
-
result.should == [{"keyword"=>"Feature", "name"=>"Test3 Feature",
|
41
|
-
"line"=>2, "description"=>"",
|
42
|
-
"tags"=>[{"name"=>"@one", "line"=>1},
|
43
|
-
{"name"=>"@two", "line"=>1}],
|
44
|
-
"id"=>"test3-feature"}]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'features query' do
|
49
|
-
it 'should find all feature names' do
|
50
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple"
|
51
|
-
CQL::MapReduce.name(gs.parsed_feature_files).should eql ["Simple", "Test Feature", "Test2 Feature", "Test3 Feature"]
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should retrieve a full feature' do
|
55
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scenario/simple"
|
56
|
-
result = CQL::MapReduce.filter_features(gs.parsed_feature_files, {'feature'=>["Test Feature"]})
|
57
|
-
result[0]['name'].should == "Test Feature"
|
58
|
-
result[0]['elements'][0]['name'].should == "Testing the slurping 1"
|
59
|
-
result[0]['elements'].should == [{"keyword"=>"Scenario", "name"=>"Testing the slurping 1", "line"=>3,
|
60
|
-
"description"=>"", "id"=>"test-feature;testing-the-slurping-1", "type"=>"scenario",
|
61
|
-
"steps"=>[{"keyword"=>"Given ", "name"=>"something happend", "line"=>4},
|
62
|
-
{"keyword"=>"Then ", "name"=>"I expect something else", "line"=>5}]},
|
63
|
-
{"keyword"=>"Scenario", "name"=>"Testing the slurping not to be found", "line"=>7,
|
64
|
-
"description"=>"", "id"=>"test-feature;testing-the-slurping-not-to-be-found", "type"=>"scenario",
|
65
|
-
"steps"=>[{"keyword"=>"Given ", "name"=>"something happend", "line"=>8}, {"keyword"=>"Then ", "name"=>"I expect something else", "line"=>9}]}]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe 'scenario query' do
|
70
|
-
it 'should get all scenarios as a list' do
|
71
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
72
|
-
result = CQL::MapReduce.filter_sso(gs.parsed_feature_files, {'feature'=>["Test Feature"], 'what'=>'scenario'})
|
73
|
-
result.should == [{"keyword"=>"Scenario", "name"=>"A Scenario", "line"=>13, "description"=>"", "id"=>"test-feature;a-scenario", "type"=>"scenario", "steps"=>[{"keyword"=>"Given ", "name"=>"something happend", "line"=>14}, {"keyword"=>"Then ", "name"=>"I expect something else", "line"=>15}]}]
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe 'scenario outline query' do
|
78
|
-
it 'should get scenario outlines as a list' do
|
79
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
80
|
-
result = CQL::MapReduce.filter_sso(gs.parsed_feature_files, {'feature'=>["Test Feature"], 'what'=> 'scenario'})
|
81
|
-
result.should == [{"keyword"=>"Scenario", "name"=>"A Scenario", "line"=>13, "description"=>"", "id"=>"test-feature;a-scenario", "type"=>"scenario", "steps"=>[{"keyword"=>"Given ", "name"=>"something happend", "line"=>14}, {"keyword"=>"Then ", "name"=>"I expect something else", "line"=>15}]}]
|
82
|
-
|
83
|
-
result = CQL::MapReduce.filter_sso(gs.parsed_feature_files, {'feature'=> ["Test Feature"], 'what'=> 'scenario_outline'})
|
84
|
-
result.should == [{"keyword"=>"Scenario Outline", "name"=>"An Outline", "line"=>3, "description"=>"", "id"=>"test-feature;an-outline", "type"=>"scenario_outline", "steps"=>[{"keyword"=>"Given ", "name"=>"something happend", "line"=>4}, {"keyword"=>"Then ", "name"=>"I expect something else", "line"=>5}], "examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>6, "description"=>"", "id"=>"test-feature;an-outline;", "rows"=>[{"cells"=>["var_a", "var_b"], "line"=>7, "id"=>"test-feature;an-outline;;1"}, {"cells"=>["1", "a"], "line"=>8, "id"=>"test-feature;an-outline;;2"}, {"cells"=>["2", "b"], "line"=>9, "id"=>"test-feature;an-outline;;3"}, {"cells"=>["3", "c"], "line"=>10, "id"=>"test-feature;an-outline;;4"}, {"cells"=>["4", "d"], "line"=>11, "id"=>"test-feature;an-outline;;5"}]}]}]
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/repo"
|
3
|
-
|
4
|
-
describe "select" do
|
5
|
-
describe "feature" do
|
6
|
-
it 'should return multiple feature file names' do
|
7
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple"
|
8
|
-
result = gs.query do
|
9
|
-
select name
|
10
|
-
from features
|
11
|
-
end
|
12
|
-
result.should == [{"name"=>"Simple"}, {"name"=>"Test Feature"},
|
13
|
-
{"name"=>"Test2 Feature"}, {"name"=>"Test3 Feature"}]
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should find the feature description' do
|
17
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple2"
|
18
|
-
result = gs.query do
|
19
|
-
select description
|
20
|
-
from features
|
21
|
-
end
|
22
|
-
result.should == {"description"=>"The cat in the hat"}
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should find the feature file uri' do
|
26
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/simple"
|
27
|
-
result = gs.query do
|
28
|
-
select uri
|
29
|
-
from features
|
30
|
-
end
|
31
|
-
result[0]['uri'].should =~ /simple\.feature/
|
32
|
-
result[1]['uri'].should =~ /test\.feature/
|
33
|
-
result[2]['uri'].should =~ /test2\.feature/
|
34
|
-
result[3]['uri'].should =~ /test\_full\.feature/
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should return multiple feature file names with associated tags' do
|
38
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tagged_features"
|
39
|
-
result = gs.query do
|
40
|
-
select name, tags
|
41
|
-
from features
|
42
|
-
end
|
43
|
-
result.should == [{"name"=>"Simple", "tags"=>nil},
|
44
|
-
{"name"=>"Test Feature", "tags"=>[{"name"=>"@one", "line"=>1}]},
|
45
|
-
{"name"=>"Test2 Feature", "tags"=>[{"name"=>"@two", "line"=>1}]},
|
46
|
-
{"name"=>"Test3 Feature", "tags"=>[{"name"=>"@one", "line"=>1}, {"name"=>"@two", "line"=>1}]}]
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/repo"
|
3
|
-
|
4
|
-
describe "select" do
|
5
|
-
describe "single value, single results" do
|
6
|
-
it 'should get scenario outlines line number' do
|
7
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
8
|
-
result = gs.query do
|
9
|
-
select line
|
10
|
-
from scenario_outlines
|
11
|
-
end
|
12
|
-
result.should == {"line"=>3}
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should get scenario outlines name' do
|
16
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
17
|
-
result = gs.query do
|
18
|
-
select name
|
19
|
-
from scenario_outlines
|
20
|
-
end
|
21
|
-
result.should == {"name"=> "An Outline"}
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should return the examples used" do
|
25
|
-
gr = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
26
|
-
result = gr.query do
|
27
|
-
select examples
|
28
|
-
from scenario_outlines
|
29
|
-
end
|
30
|
-
result.should == {"examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>6,
|
31
|
-
"description"=>"", "id"=>"test-feature;an-outline;",
|
32
|
-
"rows"=>[{"cells"=>["var_a", "var_b"], "line"=>7, "id"=>"test-feature;an-outline;;1"},
|
33
|
-
{"cells"=>["1", "a"], "line"=>8, "id"=>"test-feature;an-outline;;2"},
|
34
|
-
{"cells"=>["2", "b"], "line"=>9, "id"=>"test-feature;an-outline;;3"},
|
35
|
-
{"cells"=>["3", "c"], "line"=>10, "id"=>"test-feature;an-outline;;4"},
|
36
|
-
{"cells"=>["4", "d"], "line"=>11, "id"=>"test-feature;an-outline;;5"}]
|
37
|
-
}]}
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should return multiple examples used for a single scenario outline" do
|
41
|
-
gr = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/multiple_examples"
|
42
|
-
result = gr.query do
|
43
|
-
select examples
|
44
|
-
from scenario_outlines
|
45
|
-
end
|
46
|
-
result.should == {"examples"=>[{"keyword"=>"Examples", "name"=>"One", "line"=>6, "description"=>"", "id"=>"test-feature;an-outline;one",
|
47
|
-
"rows"=>[{"cells"=>["var_a", "var_b"], "line"=>7, "id"=>"test-feature;an-outline;one;1"},
|
48
|
-
{"cells"=>["1", "a"], "line"=>8, "id"=>"test-feature;an-outline;one;2"},
|
49
|
-
{"cells"=>["2", "b"], "line"=>9, "id"=>"test-feature;an-outline;one;3"}]},
|
50
|
-
{"keyword"=>"Examples", "name"=>"Two", "line"=>11, "description"=>"", "id"=>"test-feature;an-outline;two",
|
51
|
-
"rows"=>[{"cells"=>["var_a", "var_b"], "line"=>12, "id"=>"test-feature;an-outline;two;1"},
|
52
|
-
{"cells"=>["1", "a"], "line"=>13, "id"=>"test-feature;an-outline;two;2"},
|
53
|
-
{"cells"=>["2", "b"], "line"=>14, "id"=>"test-feature;an-outline;two;3"}]}]}
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "single value, multiple results" do
|
59
|
-
it 'should get scenario outlines as is when no select criteria given' do
|
60
|
-
expected = {"all"=>{"keyword"=>"Scenario Outline",
|
61
|
-
"name"=>"An Outline",
|
62
|
-
"line"=>3, "description"=>"",
|
63
|
-
"id"=>"test-feature;an-outline", "type"=>"scenario_outline",
|
64
|
-
"steps"=>[{"keyword"=>"Given ", "name"=>"something happend", "line"=>4},
|
65
|
-
{"keyword"=>"Then ", "name"=>"I expect something else", "line"=>5}],
|
66
|
-
"examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>6, "description"=>"", "id"=>"test-feature;an-outline;",
|
67
|
-
"rows"=>[{"cells"=>["var_a", "var_b"], "line"=>7, "id"=>"test-feature;an-outline;;1"},
|
68
|
-
{"cells"=>["1", "a"], "line"=>8, "id"=>"test-feature;an-outline;;2"},
|
69
|
-
{"cells"=>["2", "b"], "line"=>9, "id"=>"test-feature;an-outline;;3"},
|
70
|
-
{"cells"=>["3", "c"], "line"=>10, "id"=>"test-feature;an-outline;;4"},
|
71
|
-
{"cells"=>["4", "d"], "line"=>11, "id"=>"test-feature;an-outline;;5"}]}]}}
|
72
|
-
|
73
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
74
|
-
result = gs.query do
|
75
|
-
select all
|
76
|
-
from scenario_outlines
|
77
|
-
end
|
78
|
-
result.should == expected
|
79
|
-
|
80
|
-
result = gs.query do
|
81
|
-
select everything
|
82
|
-
from scenario_outlines
|
83
|
-
end
|
84
|
-
result.should == expected
|
85
|
-
|
86
|
-
result = gs.query do
|
87
|
-
select complete
|
88
|
-
from scenario_outlines
|
89
|
-
end
|
90
|
-
result.should == expected
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "select all" do
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
describe "special selectors" do
|
99
|
-
it 'should get the full step line scenario outlines' do
|
100
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
101
|
-
result = gs.query do
|
102
|
-
select step_lines
|
103
|
-
from scenario_outlines
|
104
|
-
end
|
105
|
-
result.should == {"step_lines"=> ["Given something happend", "Then I expect something else"]}
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe "multiple values" do
|
110
|
-
it 'should get scenario outlines name and line numbers as a map' do
|
111
|
-
gs = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scen_outlines/basic"
|
112
|
-
result = gs.query do
|
113
|
-
select name, line, type, step_lines, id, steps
|
114
|
-
from scenario_outlines
|
115
|
-
end
|
116
|
-
result.should == {'name'=>"An Outline",
|
117
|
-
'line'=>3,
|
118
|
-
'id'=>'test-feature;an-outline',
|
119
|
-
'type'=>'scenario_outline',
|
120
|
-
"steps"=>[{"keyword"=>"Given ", "name"=>"something happend", "line"=>4}, {"keyword"=>"Then ", "name"=>"I expect something else", "line"=>5}],
|
121
|
-
"step_lines"=>["Given something happend", "Then I expect something else"]
|
122
|
-
}
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|
126
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/repo"
|
3
|
-
|
4
|
-
describe "select" do
|
5
|
-
|
6
|
-
describe "single value, multiple results" do
|
7
|
-
it 'should get scenario line number' do
|
8
|
-
gr = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scenario/simple2"
|
9
|
-
result = gr.query do
|
10
|
-
select line
|
11
|
-
from scenarios
|
12
|
-
end
|
13
|
-
result.should == [{"line"=> 6}, {"line"=> 11}, {"line"=> 16}, {"line"=> 21}]
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should get scenario name' do
|
17
|
-
gr = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scenario/simple2"
|
18
|
-
result = gr.query do
|
19
|
-
select name
|
20
|
-
from scenarios
|
21
|
-
end
|
22
|
-
result.should == [{"name"=> "Testing the slurping"}, {"name"=> "Testing again"},
|
23
|
-
{"name"=> "Testing yet again"}, {"name"=> "Testing yet again part 2"}]
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should get scenario name from multiple feature files' do
|
27
|
-
gr = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scenario/simple"
|
28
|
-
result = gr.query do
|
29
|
-
select name
|
30
|
-
from scenarios
|
31
|
-
end
|
32
|
-
result.should == [{"name"=> "Has a table"}, {"name"=> "Testing the slurping 1"},
|
33
|
-
{"name"=> "Testing the slurping not to be found"}, {"name"=> "Testing the slurping 2"},
|
34
|
-
{"name"=> "Testing the slurping 3"}, {"name"=> "Testing again"},
|
35
|
-
{"name"=> "Testing yet again"}, {"name"=> "Testing yet again part 2"}]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "multiple values" do
|
40
|
-
it 'should get multiple scenarios as a list of maps' do
|
41
|
-
gr = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scenario/simple2"
|
42
|
-
result = gr.query do
|
43
|
-
select line, name
|
44
|
-
from scenarios
|
45
|
-
end
|
46
|
-
result.should == [{'line'=>6, 'name'=>"Testing the slurping"}, {'line'=>11, 'name'=>"Testing again"},
|
47
|
-
{'line'=>16, 'name'=>"Testing yet again"}, {'line'=>21, 'name'=>"Testing yet again part 2"}]
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should select all" do
|
51
|
-
gr = CQL::Repository.new File.expand_path(File.dirname(__FILE__)) + "/../fixtures/features/scenario/table"
|
52
|
-
expected = {"all"=>{"keyword"=>"Scenario", "name"=>"Has a table", "line"=>3,
|
53
|
-
"description"=>"", "id"=>"simple;has-a-table", "type"=>"scenario",
|
54
|
-
"steps"=>[{"keyword"=>"Given ", "name"=>"Something", "line"=>4,
|
55
|
-
"rows"=>[{"cells"=>["a", "a"], "line"=>5}, {"cells"=>["s", "a"], "line"=>6},
|
56
|
-
{"cells"=>["s", "s"], "line"=>7}]},
|
57
|
-
{"keyword"=>"Then ", "name"=>"something else", "line"=>8}]}}
|
58
|
-
|
59
|
-
result = gr.query do
|
60
|
-
select all
|
61
|
-
from scenarios
|
62
|
-
end
|
63
|
-
result.should == expected
|
64
|
-
|
65
|
-
result = gr.query do
|
66
|
-
select complete
|
67
|
-
from scenarios
|
68
|
-
end
|
69
|
-
result.should == expected
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
data/spec/unit_spec.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/repo"
|
3
|
-
|
4
|
-
describe "cql" do
|
5
|
-
|
6
|
-
describe "tag searcher" do
|
7
|
-
it "should be able to search for tags" do
|
8
|
-
tags_given = [{"name"=>"@one", "line"=>3}, {"name"=>"@four", "line"=>3}, {"name"=>"@six", "line"=>3}, {"name"=>"@seven", "line"=>3}]
|
9
|
-
CQL::MapReduce.has_tags(tags_given, ["@one", "@four"]).should eql true
|
10
|
-
|
11
|
-
tags_given = [{"name"=>"@two", "line"=>3}, {"name"=>"@four", "line"=>3}, {"name"=>"@six", "line"=>3}, {"name"=>"@seven", "line"=>3}]
|
12
|
-
CQL::MapReduce.has_tags(tags_given, ["@one", "@four"]).should eql false
|
13
|
-
|
14
|
-
tags_given = [{"name"=>"@two", "line"=>3}, {"name"=>"@four", "line"=>3}, {"name"=>"@six", "line"=>3}, {"name"=>"@seven", "line"=>3}]
|
15
|
-
CQL::MapReduce.has_tags(tags_given, ["@four"]).should eql true
|
16
|
-
|
17
|
-
tags_given = [{"name"=>"@two", "line"=>3}, {"name"=>"@four", "line"=>3}, {"name"=>"@six", "line"=>3}, {"name"=>"@seven", "line"=>3}]
|
18
|
-
CQL::MapReduce.has_tags(tags_given, ["@four", "@two", "@six", "@seven"]).should eql true
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|