rspec-example_disabler 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +22 -0
  3. data/lib/rspec/example_disabler.rb +33 -0
  4. metadata +48 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTU4ODdmZDNhZDFmYTFmMDE1NWZkZjY5YWFmNTQxZmYyZTI3ODA4Ng==
5
+ data.tar.gz: !binary |-
6
+ ZGViZjYwNjY0MTdkZDRjZmVkODBkMzFiMjU0YjZiY2YyNWFiN2NhNQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NzUwMDU1ODFhNzE2MTJjZjNkZTBkZDJmZTY5NGEwMmEyMzQ1NjAwYTk2YWQy
10
+ MWRlYzIxNGYyMTcwYzI2NTcyZDE5OTY3YTMwNDFhMTBkMDlkN2IwZTBiMmJj
11
+ OGY5NzE0YTk5MDBiYzhmZjViZjA2YjBkYWZhNGQ2YTg4MjllYWM=
12
+ data.tar.gz: !binary |-
13
+ NTEyZTk2ODcxYjU3ZjA2N2ZlZGJkNjU5MDJkZDQyYjc5MmNlNTE2NWY0ZTZm
14
+ MmNjMzJkNTI5NmY4YjZjYTNlYmE0YTJmZTBmODcyNjBiN2U3ZjI2MDRmODgx
15
+ Nzk2YTM5YmYxZjEwMjU5ODE0YTkxNzAzNWU3ZTYzNTk1ZjlhZWE=
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # RSpec Example Disabler
2
+
3
+ Allows disabling specific examples. Useful when working with plugins that intentionally modify behavior of a core application. The disabled examples are marked as pending.
4
+
5
+ ## Usage
6
+
7
+ In any plugin `*_spec.rb` file, you can disable another spec. Just make sure the spec file disabling the other spec is loaded when running the tests. You could also put the disabling
8
+ code into another file like a spec_helper.
9
+
10
+ RSpec::ExampleDisabler.disable_example('<full description of example>', '<reason')
11
+
12
+ Example from [spec/example_disabler_spec.rb](spec/example_disabler_spec.rb):
13
+
14
+ RSpec::ExampleDisabler.disable_example('RSpec::ExampleDisabler test example ' +
15
+ 'should be pending and thus not fail',
16
+ 'Testing rspec-example-disabler')
17
+
18
+ ## License
19
+
20
+ (c) 2011 - 2013 - Finn GmbH
21
+
22
+ This gem is licensed under the GNU GPL v3.
@@ -0,0 +1,33 @@
1
+ require 'rspec'
2
+
3
+ module RSpec::ExampleDisabler
4
+ @@disabled_examples = {}
5
+
6
+ def self.register_disabler
7
+ RSpec.configure do |c|
8
+ c.before(:each) do
9
+ description = example.metadata[:full_description]
10
+ if @@disabled_examples.include?(description)
11
+ reasons = @@disabled_examples[description].join(', ')
12
+ pending "Disabled by rspec-example_disabler. Reason: #{reasons}"
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ def self.disable_example(example, reason)
19
+ disable_examples([example], reason)
20
+ end
21
+
22
+ def self.disable_examples(examples, reason)
23
+ examples.each do |example|
24
+ if @@disabled_examples.include? example
25
+ @@disabled_examples[example] << reason
26
+ else
27
+ @@disabled_examples[example] = [reason]
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ RSpec::ExampleDisabler.register_disabler
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-example_disabler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Finn GmbH
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-22 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Disable specific examples. Useful when working with plugins that intentionally
14
+ modify behavior
15
+ email:
16
+ - info@finn.de
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/rspec/example_disabler.rb
22
+ - README.md
23
+ homepage: https://github.com/finnlabs/rspec-example_disabler
24
+ licenses:
25
+ - GPLv3
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.0.6
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: RSpec Example Disabler
47
+ test_files: []
48
+ has_rdoc: