moto 0.9.10 → 0.9.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca6c20b7f4e8e0cee81b903f30b6fe27e2d6c7e3
4
- data.tar.gz: be348dc99ec4679540a44c0600df952bc3cf28d7
3
+ metadata.gz: e7d75bfa8620395beba5bd52ac893556c9662519
4
+ data.tar.gz: f47066f906dc8b4e8edc6ad3581ff57f49425113
5
5
  SHA512:
6
- metadata.gz: 4c212aec57badffad322784d3bbd76d38d9293f8614f7c0426e3811dff2ce1802aa35cb104a896648b4350b9b4cca032bef88bacf52542cd9934cbc40636ccb4
7
- data.tar.gz: 70d924d0dd98158e4720055151c339ae7bb35594e5e7fdae978d6b76bf5b726d315313bfb4769447e511d67ed5b059eb78e3fcd6a3d998bec88ebb5e3ce712f5
6
+ metadata.gz: 7bf1de8ba4eea78865dd1c64323f069ddf9f61602bbc44b0e7e48a30bccabbbc9e0eeeb54a19f9e935d680ee7a6c08cb4e3201bd271fa8d37ef2e91c99030c77
7
+ data.tar.gz: ac99006b16ea7f86f00651a24a7a4186970f99aeb6df0d4f2306e0e921d3c23b850a95a1d8afb0f3d5bc3a5f714b0e980b5229e6b6cdb45c88eb189b0329b8d9
data/bin/moto CHANGED
File without changes
data/lib/cli.rb CHANGED
@@ -63,29 +63,20 @@ module Moto
63
63
  # Make sure there are no repetitions in gathered set
64
64
  tests_metadata.uniq! { |metadata| metadata.test_path }
65
65
 
66
- # Tests to be removed due to filtering will be gathered in this array
67
- # [].delete(item) cannot be used since it interferes with [].each
68
- unfit_metadata = []
69
-
70
66
  # Filter tests by provied tags
71
67
  # - test must contain ALL tags specified with -f param
68
+ # - use ~ for negation
72
69
  # - test may contain other tags
73
70
  if filters
74
- tests_metadata.each do |metadata|
75
-
76
- # If test has no tags at all and filters are set it should be automatically removed
77
- if metadata.tags.empty?
78
- unfit_metadata << metadata
79
- # Otherwise check provided tags and filters for compatibility
80
- elsif (metadata.tags & filters).length != filters.length
81
- unfit_metadata << metadata
71
+ filters.each do |filter|
72
+ filtered = tests_metadata.select do |metadata|
73
+ next if metadata.tags.empty?
74
+ filter_matches_any_tag?(filter, metadata.tags) || filter_negation_matches_none_tag?(filter, metadata.tags)
82
75
  end
83
-
76
+ tests_metadata &= filtered
84
77
  end
85
78
  end
86
79
 
87
- tests_metadata -= unfit_metadata
88
-
89
80
  #TODO Display criteria used
90
81
  if tests_metadata.empty?
91
82
  puts 'No tests found for given arguments.'
@@ -115,5 +106,15 @@ module Moto
115
106
  runner.run
116
107
  end
117
108
 
109
+ def self.filter_matches_any_tag?(filter, tags)
110
+ !filter.start_with?('~') && tags.any? { |tag| filter == tag }
111
+ end
112
+ private_class_method :filter_matches_any_tag?
113
+
114
+ def self.filter_negation_matches_none_tag?(filter, tags)
115
+ filter.start_with?('~') && tags.none? { |tag| filter[1..-1] == tag }
116
+ end
117
+ private_class_method :filter_negation_matches_none_tag?
118
+
118
119
  end
119
120
  end
@@ -1,17 +1,17 @@
1
- module Moto
2
- module EmptyListener
3
-
4
- def start_run
5
- end
6
-
7
- def end_run
8
- end
9
-
10
- def start_test(test)
11
- end
12
-
13
- def end_test(test)
14
- end
15
-
16
- end
1
+ module Moto
2
+ module EmptyListener
3
+
4
+ def start_run
5
+ end
6
+
7
+ def end_run
8
+ end
9
+
10
+ def start_test(test)
11
+ end
12
+
13
+ def end_test(test)
14
+ end
15
+
16
+ end
17
17
  end
@@ -1,7 +1,7 @@
1
- module Moto
2
- module Exceptions
3
- class MotoException < RuntimeError
4
-
5
- end
6
- end
1
+ module Moto
2
+ module Exceptions
3
+ class MotoException < RuntimeError
4
+
5
+ end
6
+ end
7
7
  end
@@ -1,7 +1,7 @@
1
- module Moto
2
- module Exceptions
3
- class TestForcedFailure < MotoException
4
-
5
- end
6
- end
1
+ module Moto
2
+ module Exceptions
3
+ class TestForcedFailure < MotoException
4
+
5
+ end
6
+ end
7
7
  end
@@ -1,7 +1,7 @@
1
- module Moto
2
- module Exceptions
3
- class TestForcedPassed < MotoException
4
-
5
- end
6
- end
1
+ module Moto
2
+ module Exceptions
3
+ class TestForcedPassed < MotoException
4
+
5
+ end
6
+ end
7
7
  end
@@ -1,7 +1,7 @@
1
- module Moto
2
- module Exceptions
3
- class TestSkipped < MotoException
4
-
5
- end
6
- end
1
+ module Moto
2
+ module Exceptions
3
+ class TestSkipped < MotoException
4
+
5
+ end
6
+ end
7
7
  end
data/lib/parser.rb CHANGED
@@ -135,6 +135,7 @@ module Moto
135
135
  -f, --filters Tags that filter tests passed via -t parameter.
136
136
  Only tests in appropriate directory, having all of the specified tags will be executed.
137
137
  Use # MOTO_TAGS: TAGNAME1 in test to assign tag.
138
+ Use ~ to filter tests that do not contain specific tag, e.g. ~tag
138
139
 
139
140
 
140
141
  -e, --environment Mandatory environment. Environment constants and tests parametrized in certain way depend on this.
data/lib/test/metadata.rb CHANGED
@@ -1,95 +1,95 @@
1
- module Moto
2
- module Test
3
- # Provides tools for accessing metadata embedded in test files
4
- class Metadata
5
-
6
- # Absolute test path
7
- attr_reader :test_path
8
-
9
- # @param [String] test_path Absolute path to file with test
10
- def initialize(test_path)
11
- @test_path = test_path
12
- end
13
-
14
- # Text of the file with test
15
- def text
16
- if @text.nil?
17
- @text = ''
18
-
19
- File.foreach(@test_path) do |line|
20
-
21
- # Read lines of file until class specification begins
22
- if line.match(/^\s*(class|module)/)
23
- break
24
- end
25
-
26
- @text += line
27
- end
28
-
29
- end
30
-
31
- @text
32
- end
33
- private :text
34
-
35
- # @return [Array] of [String] which represent contents of #MOTO_TAGS
36
- def tags
37
- if @tags.nil?
38
- matches = text.match(/^#(\s*)MOTO_TAGS:(.*?)$/)
39
-
40
- if matches
41
- @tags = matches.to_a[2].gsub(/\s*/, '').split(',')
42
- else
43
- @tags = []
44
- end
45
- end
46
-
47
- @tags
48
- end
49
-
50
- # @return [Array] of [String] which represent contents of #TICKET_URL
51
- def ticket_urls
52
- if @ticket_urls.nil?
53
- matches = text.match(/^#(\s*)TICKET_URLS:(.*?)$/)
54
-
55
- if matches
56
- @ticket_urls = matches.to_a[2].gsub(/\s*/, '').split(',')
57
- else
58
- @ticket_urls = []
59
- end
60
- end
61
-
62
- @ticket_urls
63
- end
64
-
65
- # @return [Array] of [String] which represent contents of #TICKET_URL
66
- def description
67
- if @description.nil?
68
- matches = text.scan(/^#(\s*)DESC:(.*?)$/)
69
-
70
- @description = ''
71
-
72
- if !matches.empty?
73
- matches.each do |match|
74
- @description += match[1] + "\n"
75
- end
76
- end
77
- end
78
-
79
- @description
80
- end
81
-
82
-
83
- # Overriden eql? so various comparisons, array substractions etc. can be perfromed on
84
- # Metadata objects with them being represented by test's location
85
- def eql?(other)
86
- if self.class == other.class
87
- return self.test_path == other.test_path
88
- end
89
-
90
- false
91
- end
92
-
93
- end
94
- end
1
+ module Moto
2
+ module Test
3
+ # Provides tools for accessing metadata embedded in test files
4
+ class Metadata
5
+
6
+ # Absolute test path
7
+ attr_reader :test_path
8
+
9
+ # @param [String] test_path Absolute path to file with test
10
+ def initialize(test_path)
11
+ @test_path = test_path
12
+ end
13
+
14
+ # Text of the file with test
15
+ def text
16
+ if @text.nil?
17
+ @text = ''
18
+
19
+ File.foreach(@test_path) do |line|
20
+
21
+ # Read lines of file until class specification begins
22
+ if line.match(/^\s*(class|module)/)
23
+ break
24
+ end
25
+
26
+ @text += line
27
+ end
28
+
29
+ end
30
+
31
+ @text
32
+ end
33
+ private :text
34
+
35
+ # @return [Array] of [String] which represent contents of #MOTO_TAGS
36
+ def tags
37
+ if @tags.nil?
38
+ matches = text.match(/^#(\s*)MOTO_TAGS:(.*?)$/)
39
+
40
+ if matches
41
+ @tags = matches.to_a[2].gsub(/\s*/, '').split(',')
42
+ else
43
+ @tags = []
44
+ end
45
+ end
46
+
47
+ @tags
48
+ end
49
+
50
+ # @return [Array] of [String] which represent contents of #TICKET_URL
51
+ def ticket_urls
52
+ if @ticket_urls.nil?
53
+ matches = text.match(/^#(\s*)TICKET_URLS:(.*?)$/)
54
+
55
+ if matches
56
+ @ticket_urls = matches.to_a[2].gsub(/\s*/, '').split(',')
57
+ else
58
+ @ticket_urls = []
59
+ end
60
+ end
61
+
62
+ @ticket_urls
63
+ end
64
+
65
+ # @return [Array] of [String] which represent contents of #TICKET_URL
66
+ def description
67
+ if @description.nil?
68
+ matches = text.scan(/^#(\s*)DESC:(.*?)$/)
69
+
70
+ @description = ''
71
+
72
+ if !matches.empty?
73
+ matches.each do |match|
74
+ @description += match[1] + "\n"
75
+ end
76
+ end
77
+ end
78
+
79
+ @description
80
+ end
81
+
82
+
83
+ # Overriden eql? so various comparisons, array substractions etc. can be perfromed on
84
+ # Metadata objects with them being represented by test's location
85
+ def eql?(other)
86
+ if self.class == other.class
87
+ return self.test_path == other.test_path
88
+ end
89
+
90
+ false
91
+ end
92
+
93
+ end
94
+ end
95
95
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '0.9.10'
2
+ VERSION = '0.9.11'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.10
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Wilczek
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-05-12 00:00:00.000000000 Z
14
+ date: 2017-07-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.5.2
137
+ rubygems_version: 2.6.11
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Moto - yet another web testing framework