cql 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YmJjZmVjY2MzZGQwMWIyNzIyNjA3ZjMxZDVlNGVhMGYwYWNhMjlmMQ==
5
+ data.tar.gz: !binary |-
6
+ ZTEwODIxZmEwZWFiYTM0MTI0YzI4MjZjMDZhYjk1OGRmOTkyYWE5Zg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZjgxZDk5NjY1ZjA0YTNkYjJkNDIwZGVhYzVlMmEzODRjMmI1MDRkODk2Njc1
10
+ YmUzM2ExYjYzYjY4M2I3YjExMjAwNTFjODhjZGRlY2ZhYjZkNTI0NzgwOGY2
11
+ YTA5ZGE4MDIxOWFjMGU2ZjY1NmY3NzgyYTIxZjNlN2QzMGFhYjc=
12
+ data.tar.gz: !binary |-
13
+ M2NjN2RmZGZhNmUzYTE4NzY2OGE5ODM2ZTcwNDkyYjg5OWVmNDMyNTcxZWIy
14
+ NDkyZTViZTljMGI0ZjRkMzBlMDM1ZDQwZGIzNDRmZTg0OTVmZTNlNmY1NmZh
15
+ MTdjODU5OWIzYTU2YzJkYjIyYmQ5ODI1M2MyMDAyZjliYTZiNzM=
data/lib/cql.rb CHANGED
@@ -103,12 +103,10 @@ module CQL
103
103
  case
104
104
  when repository_root.is_a?(String)
105
105
  @target_directory = CukeModeler::Directory.new(repository_root)
106
- when repository_root.is_a?(Class)
107
- # todo - stop assuming
108
- # Assume valid CukeModeler class for now
106
+ when repository_root.class.to_s =~ /CukeModeler/
109
107
  @target_directory = repository_root
110
108
  else
111
- # todo - raise error?
109
+ raise(ArgumentError, "Don't know how to make a repository from a #{repository_root.class}")
112
110
  end
113
111
  end
114
112
 
@@ -146,6 +146,9 @@ module CQL
146
146
 
147
147
  # Check for pluralization of class match (i.e. remove the final 's')
148
148
  return CukeModeler.const_get(where.chop) if CukeModeler.const_defined?(where.chop)
149
+
150
+ # Then the class must not be a CukeModeler class
151
+ raise(ArgumentError, "Class 'CukeModeler::#{where}' does not exist")
149
152
  end
150
153
 
151
154
  end
@@ -21,17 +21,16 @@ module CQL
21
21
  attr_reader :pattern
22
22
 
23
23
  def initialize(pattern)
24
+ raise(ArgumentError, "Can only match a String or Regexp. Got #{pattern.class}.") unless pattern.is_a?(String) || pattern.is_a?(Regexp)
25
+
24
26
  @pattern = pattern
25
27
  end
26
28
 
27
29
  def content_match?(content)
28
30
  if pattern.is_a?(String)
29
31
  content.any? { |thing| thing == pattern }
30
- elsif pattern.is_a?(Regexp)
31
- content.any? { |thing| thing =~ pattern }
32
32
  else
33
- # todo - Raise exception?
34
- false
33
+ content.any? { |thing| thing =~ pattern }
35
34
  end
36
35
  end
37
36
 
@@ -1,3 +1,3 @@
1
1
  module CQL
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -39,12 +39,24 @@ describe 'dsl' do
39
39
  end
40
40
 
41
41
  end
42
- end
43
42
 
44
- describe 'shorthand' do
43
+ describe 'shorthand' do
44
+
45
+ it 'should consider an exact match over a pluralization' do
46
+ skip('Not sure how to test this without actually have two classes that are so similarly named. It is a required behavior, but not one worth the hassle of testing until it actually comes up.')
47
+ end
48
+
49
+ it 'raises an exception if the shorthand form of a class cannot be mapped to a real class' do
50
+ gs = CQL::Repository.new("#{@feature_fixtures_directory}/scenario/simple")
51
+
52
+ expect {
53
+ gs.query do
54
+ select name
55
+ from not_a_real_class
56
+ end
57
+ }.to raise_error(ArgumentError, "Class 'CukeModeler::NotARealClass' does not exist")
45
58
 
46
- it 'should consider an exact match over a pluralization' do
47
- skip('Not sure how to test this without actually have two classes that are so similarly named. It is a required behavior, but not one worth the hassle of testing until it actually comes up.')
59
+ end
48
60
  end
49
61
 
50
62
  end
@@ -36,5 +36,16 @@ shared_examples_for 'a line filterable target set' do |target_type, test_data|
36
36
  end
37
37
  end
38
38
 
39
+ it 'can only handle a string or regular expression' do
40
+ gs = CQL::Repository.new(@feature_fixtures_directory)
41
+
42
+ expect { gs.query do
43
+ select name
44
+ from scenarios
45
+ with line 7
46
+ end }.to raise_error(ArgumentError, "Can only match a String or Regexp. Got Fixnum.")
47
+
48
+ end
49
+
39
50
  end
40
51
  end
@@ -36,5 +36,16 @@ shared_examples_for 'a name filterable target set' do |target_type, test_data|
36
36
  end
37
37
  end
38
38
 
39
+ it 'can only handle a string or regular expression' do
40
+ gs = CQL::Repository.new(@feature_fixtures_directory)
41
+
42
+ expect { gs.query do
43
+ select name
44
+ from scenarios
45
+ with name 7
46
+ end }.to raise_error(ArgumentError, "Can only match a String or Regexp. Got Fixnum.")
47
+
48
+ end
49
+
39
50
  end
40
51
  end
@@ -14,4 +14,8 @@ describe 'CQL::Repository' do
14
14
  expect { clazz.new(some_model) }.to_not raise_error
15
15
  end
16
16
 
17
+ it "complains if can't be made from what it was given" do
18
+ expect { clazz.new(:some_other_thing) }.to raise_error(ArgumentError, "Don't know how to make a repository from a Symbol")
19
+ end
20
+
17
21
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eric Kessler
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2015-09-11 00:00:00.000000000 Z
12
+ date: 2015-09-20 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: cuke_modeler
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: backports
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ! '>='
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ! '>='
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rake
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ! '>='
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ! '>='
61
54
  - !ruby/object:Gem::Version
@@ -63,7 +56,6 @@ dependencies:
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: rspec
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
60
  - - ~>
69
61
  - !ruby/object:Gem::Version
@@ -71,7 +63,6 @@ dependencies:
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
67
  - - ~>
77
68
  - !ruby/object:Gem::Version
@@ -79,7 +70,6 @@ dependencies:
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: cucumber
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
74
  - - ! '>='
85
75
  - !ruby/object:Gem::Version
@@ -87,7 +77,6 @@ dependencies:
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
81
  - - ! '>='
93
82
  - !ruby/object:Gem::Version
@@ -95,7 +84,6 @@ dependencies:
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: simplecov
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
88
  - - ! '>='
101
89
  - !ruby/object:Gem::Version
@@ -103,7 +91,6 @@ dependencies:
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
95
  - - ! '>='
109
96
  - !ruby/object:Gem::Version
@@ -111,7 +98,6 @@ dependencies:
111
98
  - !ruby/object:Gem::Dependency
112
99
  name: racatt
113
100
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
101
  requirements:
116
102
  - - ! '>='
117
103
  - !ruby/object:Gem::Version
@@ -119,7 +105,6 @@ dependencies:
119
105
  type: :development
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
108
  requirements:
124
109
  - - ! '>='
125
110
  - !ruby/object:Gem::Version
@@ -127,7 +112,6 @@ dependencies:
127
112
  - !ruby/object:Gem::Dependency
128
113
  name: coveralls
129
114
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
115
  requirements:
132
116
  - - ! '>='
133
117
  - !ruby/object:Gem::Version
@@ -135,7 +119,6 @@ dependencies:
135
119
  type: :development
136
120
  prerelease: false
137
121
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
122
  requirements:
140
123
  - - ! '>='
141
124
  - !ruby/object:Gem::Version
@@ -146,13 +129,13 @@ executables: []
146
129
  extensions: []
147
130
  extra_rdoc_files: []
148
131
  files:
132
+ - lib/cql.rb
149
133
  - lib/cql/dsl.rb
150
134
  - lib/cql/feature_filters.rb
151
135
  - lib/cql/filters.rb
152
136
  - lib/cql/map_reduce.rb
153
137
  - lib/cql/sso_filters.rb
154
138
  - lib/cql/version.rb
155
- - lib/cql.rb
156
139
  - spec/dsl_spec.rb
157
140
  - spec/filter_example_spec.rb
158
141
  - spec/filter_feature_dsl_spec.rb
@@ -164,13 +147,14 @@ files:
164
147
  - spec/name_filterable_specs.rb
165
148
  - spec/repository_spec.rb
166
149
  - spec/select_feature_dsl_spec.rb
167
- - spec/select_scenario_dsl_spec.rb
168
150
  - spec/select_scen_outline_dsl_spec.rb
151
+ - spec/select_scenario_dsl_spec.rb
169
152
  - spec/spec_helper.rb
170
153
  - spec/tag_filterable_specs.rb
171
154
  homepage: https://github.com/enkessler/cql
172
155
  licenses:
173
156
  - MIT
157
+ metadata: {}
174
158
  post_install_message: ! '
175
159
 
176
160
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
@@ -188,22 +172,20 @@ rdoc_options:
188
172
  require_paths:
189
173
  - lib
190
174
  required_ruby_version: !ruby/object:Gem::Requirement
191
- none: false
192
175
  requirements:
193
176
  - - ! '>='
194
177
  - !ruby/object:Gem::Version
195
178
  version: '0'
196
179
  required_rubygems_version: !ruby/object:Gem::Requirement
197
- none: false
198
180
  requirements:
199
181
  - - ! '>='
200
182
  - !ruby/object:Gem::Version
201
183
  version: '0'
202
184
  requirements: []
203
185
  rubyforge_project:
204
- rubygems_version: 1.8.29
186
+ rubygems_version: 2.4.8
205
187
  signing_key:
206
- specification_version: 3
188
+ specification_version: 4
207
189
  summary: A gem providing functionality to query a Cucumber test suite.
208
190
  test_files:
209
191
  - spec/dsl_spec.rb