dradis-mediawiki 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/.github/issue_template.md +16 -0
  3. data/.github/pull_request_template.md +36 -0
  4. data/.rspec +2 -0
  5. data/CHANGELOG.md +51 -0
  6. data/CONTRIBUTING.md +3 -0
  7. data/Gemfile +23 -0
  8. data/LICENSE +339 -0
  9. data/README.md +32 -0
  10. data/Rakefile +1 -0
  11. data/dradis-mediawiki.gemspec +31 -0
  12. data/lib/dradis-mediawiki.rb +2 -0
  13. data/lib/dradis/plugins/mediawiki.rb +10 -0
  14. data/lib/dradis/plugins/mediawiki/engine.rb +17 -0
  15. data/lib/dradis/plugins/mediawiki/filters.rb +68 -0
  16. data/lib/dradis/plugins/mediawiki/gem_version.rb +21 -0
  17. data/lib/dradis/plugins/mediawiki/version.rb +9 -0
  18. data/lib/tasks/thorfile.rb +17 -0
  19. data/spec/spec_helper.rb +22 -0
  20. data/spec/wiki_import_spec.rb +18 -0
  21. data/test/vendor/mocha-0.9.5/COPYING +3 -0
  22. data/test/vendor/mocha-0.9.5/MIT-LICENSE +7 -0
  23. data/test/vendor/mocha-0.9.5/README +37 -0
  24. data/test/vendor/mocha-0.9.5/README.dradis +4 -0
  25. data/test/vendor/mocha-0.9.5/RELEASE +269 -0
  26. data/test/vendor/mocha-0.9.5/Rakefile +207 -0
  27. data/test/vendor/mocha-0.9.5/lib/mocha.rb +49 -0
  28. data/test/vendor/mocha-0.9.5/lib/mocha/any_instance_method.rb +55 -0
  29. data/test/vendor/mocha-0.9.5/lib/mocha/argument_iterator.rb +21 -0
  30. data/test/vendor/mocha-0.9.5/lib/mocha/backtrace_filter.rb +17 -0
  31. data/test/vendor/mocha-0.9.5/lib/mocha/cardinality.rb +95 -0
  32. data/test/vendor/mocha-0.9.5/lib/mocha/central.rb +27 -0
  33. data/test/vendor/mocha-0.9.5/lib/mocha/change_state_side_effect.rb +19 -0
  34. data/test/vendor/mocha-0.9.5/lib/mocha/class_method.rb +87 -0
  35. data/test/vendor/mocha-0.9.5/lib/mocha/configuration.rb +60 -0
  36. data/test/vendor/mocha-0.9.5/lib/mocha/deprecation.rb +22 -0
  37. data/test/vendor/mocha-0.9.5/lib/mocha/exception_raiser.rb +17 -0
  38. data/test/vendor/mocha-0.9.5/lib/mocha/expectation.rb +476 -0
  39. data/test/vendor/mocha-0.9.5/lib/mocha/expectation_error.rb +15 -0
  40. data/test/vendor/mocha-0.9.5/lib/mocha/expectation_list.rb +50 -0
  41. data/test/vendor/mocha-0.9.5/lib/mocha/in_state_ordering_constraint.rb +19 -0
  42. data/test/vendor/mocha-0.9.5/lib/mocha/inspect.rb +67 -0
  43. data/test/vendor/mocha-0.9.5/lib/mocha/instance_method.rb +16 -0
  44. data/test/vendor/mocha-0.9.5/lib/mocha/is_a.rb +9 -0
  45. data/test/vendor/mocha-0.9.5/lib/mocha/logger.rb +15 -0
  46. data/test/vendor/mocha-0.9.5/lib/mocha/metaclass.rb +13 -0
  47. data/test/vendor/mocha-0.9.5/lib/mocha/method_matcher.rb +21 -0
  48. data/test/vendor/mocha-0.9.5/lib/mocha/mini_test_adapter.rb +50 -0
  49. data/test/vendor/mocha-0.9.5/lib/mocha/mock.rb +200 -0
  50. data/test/vendor/mocha-0.9.5/lib/mocha/mockery.rb +181 -0
  51. data/test/vendor/mocha-0.9.5/lib/mocha/module_method.rb +16 -0
  52. data/test/vendor/mocha-0.9.5/lib/mocha/multiple_yields.rb +20 -0
  53. data/test/vendor/mocha-0.9.5/lib/mocha/names.rb +53 -0
  54. data/test/vendor/mocha-0.9.5/lib/mocha/no_yields.rb +11 -0
  55. data/test/vendor/mocha-0.9.5/lib/mocha/object.rb +187 -0
  56. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers.rb +27 -0
  57. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/all_of.rb +42 -0
  58. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/any_of.rb +47 -0
  59. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/any_parameters.rb +40 -0
  60. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/anything.rb +33 -0
  61. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/base.rb +15 -0
  62. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/equals.rb +42 -0
  63. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/has_entries.rb +45 -0
  64. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/has_entry.rb +56 -0
  65. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/has_key.rb +42 -0
  66. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/has_value.rb +42 -0
  67. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/includes.rb +40 -0
  68. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/instance_of.rb +42 -0
  69. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/is_a.rb +42 -0
  70. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/kind_of.rb +42 -0
  71. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/not.rb +42 -0
  72. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/object.rb +15 -0
  73. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/optionally.rb +55 -0
  74. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/regexp_matches.rb +43 -0
  75. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/responds_with.rb +43 -0
  76. data/test/vendor/mocha-0.9.5/lib/mocha/parameter_matchers/yaml_equivalent.rb +43 -0
  77. data/test/vendor/mocha-0.9.5/lib/mocha/parameters_matcher.rb +37 -0
  78. data/test/vendor/mocha-0.9.5/lib/mocha/pretty_parameters.rb +28 -0
  79. data/test/vendor/mocha-0.9.5/lib/mocha/return_values.rb +31 -0
  80. data/test/vendor/mocha-0.9.5/lib/mocha/sequence.rb +42 -0
  81. data/test/vendor/mocha-0.9.5/lib/mocha/single_return_value.rb +17 -0
  82. data/test/vendor/mocha-0.9.5/lib/mocha/single_yield.rb +18 -0
  83. data/test/vendor/mocha-0.9.5/lib/mocha/standalone.rb +166 -0
  84. data/test/vendor/mocha-0.9.5/lib/mocha/state_machine.rb +91 -0
  85. data/test/vendor/mocha-0.9.5/lib/mocha/stubbing_error.rb +16 -0
  86. data/test/vendor/mocha-0.9.5/lib/mocha/test_case_adapter.rb +103 -0
  87. data/test/vendor/mocha-0.9.5/lib/mocha/unexpected_invocation.rb +18 -0
  88. data/test/vendor/mocha-0.9.5/lib/mocha/yield_parameters.rb +31 -0
  89. data/test/vendor/mocha-0.9.5/lib/mocha_standalone.rb +2 -0
  90. data/test/vendor/mocha-0.9.5/lib/stubba.rb +4 -0
  91. data/test/wiki_import_test.rb +106 -0
  92. metadata +249 -0
@@ -0,0 +1,27 @@
1
+ module Mocha
2
+
3
+ # Used as parameters for Expectation#with to restrict the parameter values which will match the expectation. Can be nested.
4
+ module ParameterMatchers; end
5
+
6
+ end
7
+
8
+ require 'mocha/parameter_matchers/object'
9
+
10
+ require 'mocha/parameter_matchers/all_of'
11
+ require 'mocha/parameter_matchers/any_of'
12
+ require 'mocha/parameter_matchers/any_parameters'
13
+ require 'mocha/parameter_matchers/anything'
14
+ require 'mocha/parameter_matchers/equals'
15
+ require 'mocha/parameter_matchers/has_entry'
16
+ require 'mocha/parameter_matchers/has_entries'
17
+ require 'mocha/parameter_matchers/has_key'
18
+ require 'mocha/parameter_matchers/has_value'
19
+ require 'mocha/parameter_matchers/includes'
20
+ require 'mocha/parameter_matchers/instance_of'
21
+ require 'mocha/parameter_matchers/is_a'
22
+ require 'mocha/parameter_matchers/kind_of'
23
+ require 'mocha/parameter_matchers/not'
24
+ require 'mocha/parameter_matchers/optionally'
25
+ require 'mocha/parameter_matchers/regexp_matches'
26
+ require 'mocha/parameter_matchers/responds_with'
27
+ require 'mocha/parameter_matchers/yaml_equivalent'
@@ -0,0 +1,42 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: all_of(*parameter_matchers) -> parameter_matcher
8
+ #
9
+ # Matches if all +parameter_matchers+ match.
10
+ # object = mock()
11
+ # object.expects(:method_1).with(all_of(includes(1), includes(3)))
12
+ # object.method_1([1, 3])
13
+ # # no error raised
14
+ #
15
+ # object = mock()
16
+ # object.expects(:method_1).with(all_of(includes(1), includes(3)))
17
+ # object.method_1([1, 2])
18
+ # # error raised, because method_1 was not called with object including 1 and 3
19
+ def all_of(*matchers)
20
+ AllOf.new(*matchers)
21
+ end
22
+
23
+ class AllOf < Base # :nodoc:
24
+
25
+ def initialize(*matchers)
26
+ @matchers = matchers
27
+ end
28
+
29
+ def matches?(available_parameters)
30
+ parameter = available_parameters.shift
31
+ @matchers.all? { |matcher| matcher.to_matcher.matches?([parameter]) }
32
+ end
33
+
34
+ def mocha_inspect
35
+ "all_of(#{@matchers.map { |matcher| matcher.mocha_inspect }.join(", ") })"
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,47 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: any_of(*parameter_matchers) -> parameter_matcher
8
+ #
9
+ # Matches if any +parameter_matchers+ match.
10
+ # object = mock()
11
+ # object.expects(:method_1).with(any_of(1, 3))
12
+ # object.method_1(1)
13
+ # # no error raised
14
+ #
15
+ # object = mock()
16
+ # object.expects(:method_1).with(any_of(1, 3))
17
+ # object.method_1(3)
18
+ # # no error raised
19
+ #
20
+ # object = mock()
21
+ # object.expects(:method_1).with(any_of(1, 3))
22
+ # object.method_1(2)
23
+ # # error raised, because method_1 was not called with 1 or 3
24
+ def any_of(*matchers)
25
+ AnyOf.new(*matchers)
26
+ end
27
+
28
+ class AnyOf < Base # :nodoc:
29
+
30
+ def initialize(*matchers)
31
+ @matchers = matchers
32
+ end
33
+
34
+ def matches?(available_parameters)
35
+ parameter = available_parameters.shift
36
+ @matchers.any? { |matcher| matcher.to_matcher.matches?([parameter]) }
37
+ end
38
+
39
+ def mocha_inspect
40
+ "any_of(#{@matchers.map { |matcher| matcher.mocha_inspect }.join(", ") })"
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+ end
@@ -0,0 +1,40 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: any_parameters() -> parameter_matcher
8
+ #
9
+ # Matches any parameters.
10
+ # object = mock()
11
+ # object.expects(:method_1).with(any_parameters)
12
+ # object.method_1(1, 2, 3, 4)
13
+ # # no error raised
14
+ #
15
+ # object = mock()
16
+ # object.expects(:method_1).with(any_parameters)
17
+ # object.method_1(5, 6, 7, 8, 9, 0)
18
+ # # no error raised
19
+ def any_parameters
20
+ AnyParameters.new
21
+ end
22
+
23
+ class AnyParameters < Base # :nodoc:
24
+
25
+ def matches?(available_parameters)
26
+ while available_parameters.length > 0 do
27
+ available_parameters.shift
28
+ end
29
+ return true
30
+ end
31
+
32
+ def mocha_inspect
33
+ "any_parameters"
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
40
+ end
@@ -0,0 +1,33 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: anything() -> parameter_matcher
8
+ #
9
+ # Matches any object.
10
+ # object = mock()
11
+ # object.expects(:method_1).with(anything)
12
+ # object.method_1('foo')
13
+ # # no error raised
14
+ def anything
15
+ Anything.new
16
+ end
17
+
18
+ class Anything < Base # :nodoc:
19
+
20
+ def matches?(available_parameters)
21
+ available_parameters.shift
22
+ return true
23
+ end
24
+
25
+ def mocha_inspect
26
+ "anything"
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,15 @@
1
+ module Mocha
2
+
3
+ module ParameterMatchers
4
+
5
+ class Base # :nodoc:
6
+
7
+ def to_matcher
8
+ self
9
+ end
10
+
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,42 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: equals(value) -> parameter_matcher
8
+ #
9
+ # Matches +Object+ equalling +value+.
10
+ # object = mock()
11
+ # object.expects(:method_1).with(equals(2))
12
+ # object.method_1(2)
13
+ # # no error raised
14
+ #
15
+ # object = mock()
16
+ # object.expects(:method_1).with(equals(2))
17
+ # object.method_1(3)
18
+ # # error raised, because method_1 was not called with Object equalling 3
19
+ def equals(value)
20
+ Equals.new(value)
21
+ end
22
+
23
+ class Equals < Base # :nodoc:
24
+
25
+ def initialize(value)
26
+ @value = value
27
+ end
28
+
29
+ def matches?(available_parameters)
30
+ parameter = available_parameters.shift
31
+ parameter == @value
32
+ end
33
+
34
+ def mocha_inspect
35
+ @value.mocha_inspect
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,45 @@
1
+ require 'mocha/parameter_matchers/base'
2
+ require 'mocha/parameter_matchers/all_of'
3
+ require 'mocha/parameter_matchers/has_entry'
4
+
5
+ module Mocha
6
+
7
+ module ParameterMatchers
8
+
9
+ # :call-seq: has_entries(entries) -> parameter_matcher
10
+ #
11
+ # Matches +Hash+ containing all +entries+.
12
+ # object = mock()
13
+ # object.expects(:method_1).with(has_entries('key_1' => 1, 'key_2' => 2))
14
+ # object.method_1('key_1' => 1, 'key_2' => 2, 'key_3' => 3)
15
+ # # no error raised
16
+ #
17
+ # object = mock()
18
+ # object.expects(:method_1).with(has_entries('key_1' => 1, 'key_2' => 2))
19
+ # object.method_1('key_1' => 1, 'key_2' => 99)
20
+ # # error raised, because method_1 was not called with Hash containing entries: 'key_1' => 1, 'key_2' => 2
21
+ def has_entries(entries)
22
+ HasEntries.new(entries)
23
+ end
24
+
25
+ class HasEntries < Base # :nodoc:
26
+
27
+ def initialize(entries)
28
+ @entries = entries
29
+ end
30
+
31
+ def matches?(available_parameters)
32
+ parameter = available_parameters.shift
33
+ has_entry_matchers = @entries.map { |key, value| HasEntry.new(key, value) }
34
+ AllOf.new(*has_entry_matchers).matches?([parameter])
35
+ end
36
+
37
+ def mocha_inspect
38
+ "has_entries(#{@entries.mocha_inspect})"
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,56 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: has_entry(key, value) -> parameter_matcher
8
+ # has_entry(key => value) -> parameter_matcher
9
+ #
10
+ # Matches +Hash+ containing entry with +key+ and +value+.
11
+ # object = mock()
12
+ # object.expects(:method_1).with(has_entry('key_1', 1))
13
+ # object.method_1('key_1' => 1, 'key_2' => 2)
14
+ # # no error raised
15
+ #
16
+ # object = mock()
17
+ # object.expects(:method_1).with(has_entry('key_1' => 1))
18
+ # object.method_1('key_1' => 1, 'key_2' => 2)
19
+ # # no error raised
20
+ #
21
+ # object = mock()
22
+ # object.expects(:method_1).with(has_entry('key_1', 1))
23
+ # object.method_1('key_1' => 2, 'key_2' => 1)
24
+ # # error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1
25
+ #
26
+ # object = mock()
27
+ # object.expects(:method_1).with(has_entry('key_1' => 1))
28
+ # object.method_1('key_1' => 2, 'key_2' => 1)
29
+ # # error raised, because method_1 was not called with Hash containing entry: 'key_1' => 1
30
+ def has_entry(*options)
31
+ key, value = options.shift, options.shift
32
+ key, value = key.to_a[0][0..1] if key.is_a?(Hash)
33
+ HasEntry.new(key, value)
34
+ end
35
+
36
+ class HasEntry < Base # :nodoc:
37
+
38
+ def initialize(key, value)
39
+ @key, @value = key, value
40
+ end
41
+
42
+ def matches?(available_parameters)
43
+ parameter = available_parameters.shift
44
+ matching_keys = parameter.keys.select { |key| @key.to_matcher.matches?([key]) }
45
+ matching_keys.any? { |key| @value.to_matcher.matches?([parameter[key]]) }
46
+ end
47
+
48
+ def mocha_inspect
49
+ "has_entry(#{@key.mocha_inspect} => #{@value.mocha_inspect})"
50
+ end
51
+
52
+ end
53
+
54
+ end
55
+
56
+ end
@@ -0,0 +1,42 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: has_key(key) -> parameter_matcher
8
+ #
9
+ # Matches +Hash+ containing +key+.
10
+ # object = mock()
11
+ # object.expects(:method_1).with(has_key('key_1'))
12
+ # object.method_1('key_1' => 1, 'key_2' => 2)
13
+ # # no error raised
14
+ #
15
+ # object = mock()
16
+ # object.expects(:method_1).with(has_key('key_1'))
17
+ # object.method_1('key_2' => 2)
18
+ # # error raised, because method_1 was not called with Hash containing key: 'key_1'
19
+ def has_key(key)
20
+ HasKey.new(key)
21
+ end
22
+
23
+ class HasKey < Base # :nodoc:
24
+
25
+ def initialize(key)
26
+ @key = key
27
+ end
28
+
29
+ def matches?(available_parameters)
30
+ parameter = available_parameters.shift
31
+ parameter.keys.any? { |key| @key.to_matcher.matches?([key]) }
32
+ end
33
+
34
+ def mocha_inspect
35
+ "has_key(#{@key.mocha_inspect})"
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,42 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: has_value(value) -> parameter_matcher
8
+ #
9
+ # Matches +Hash+ containing +value+.
10
+ # object = mock()
11
+ # object.expects(:method_1).with(has_value(1))
12
+ # object.method_1('key_1' => 1, 'key_2' => 2)
13
+ # # no error raised
14
+ #
15
+ # object = mock()
16
+ # object.expects(:method_1).with(has_value(1))
17
+ # object.method_1('key_2' => 2)
18
+ # # error raised, because method_1 was not called with Hash containing value: 1
19
+ def has_value(value)
20
+ HasValue.new(value)
21
+ end
22
+
23
+ class HasValue < Base # :nodoc:
24
+
25
+ def initialize(value)
26
+ @value = value
27
+ end
28
+
29
+ def matches?(available_parameters)
30
+ parameter = available_parameters.shift
31
+ parameter.values.any? { |value| @value.to_matcher.matches?([value]) }
32
+ end
33
+
34
+ def mocha_inspect
35
+ "has_value(#{@value.mocha_inspect})"
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,40 @@
1
+ require 'mocha/parameter_matchers/base'
2
+
3
+ module Mocha
4
+
5
+ module ParameterMatchers
6
+
7
+ # :call-seq: includes(item) -> parameter_matcher
8
+ #
9
+ # Matches any object that responds true to include?(item)
10
+ # object = mock()
11
+ # object.expects(:method_1).with(includes('foo'))
12
+ # object.method_1(['foo', 'bar'])
13
+ # # no error raised
14
+ #
15
+ # object.method_1(['baz'])
16
+ # # error raised, because ['baz'] does not include 'foo'.
17
+ def includes(item)
18
+ Includes.new(item)
19
+ end
20
+
21
+ class Includes < Base # :nodoc:
22
+
23
+ def initialize(item)
24
+ @item = item
25
+ end
26
+
27
+ def matches?(available_parameters)
28
+ parameter = available_parameters.shift
29
+ return parameter.include?(@item)
30
+ end
31
+
32
+ def mocha_inspect
33
+ "includes(#{@item.mocha_inspect})"
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
40
+ end