rspec-absolutely_prepended_after_each 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm gemset use rspec-absolutely_prepended_after_each --create
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec-absolutely_prepended_after_each.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 okitan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,54 @@
1
+ # Rspec::AbsolutelyPrependedAfterEach [![Build Status](https://travis-ci.org/okitan/rspec-absolutely_prepended_after_each.png)](https://travis-ci.org/okitan/rspec-absolutely_prepended_after_each) [![Dependency Status](https://gemnasium.com/okitan/rspec-absolutely_prepended_after_each.png)](https://gemnasium.com/okitan/rspec-absolutely_prepended_after_each)
2
+
3
+ forcelly prepend at the top of the after:each
4
+
5
+
6
+ It suits for example:
7
+ * take screen shot of selenium test BEFORE the teardown of after hooks
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'rspec-absolutely_prepended_after_each'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rspec-absolutely_prepended_after_each
22
+
23
+ ## Usage
24
+
25
+ ```ruby
26
+ require "rspec/absolutely_prepended_after_each"
27
+
28
+ RSpec.configure do |config|
29
+ config.absolutely_prepend_after_each do
30
+ # codes you'd like to execute before every after(:each) blocks
31
+ end
32
+ end
33
+ ```
34
+
35
+ ```ruby
36
+ require "rspec/absolutely_prepended_after_each"
37
+
38
+ describe "some description" do
39
+ absoutely_prepend_after_each do
40
+ # codes you'd like to execute before every after(:each) blocks below
41
+ end
42
+
43
+ context "some context" do
44
+ after(:each) { "some teardown" }
45
+ end
46
+ end
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create new Pull Request
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core'
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = FileList['spec/**/*_spec.rb']
7
+ end
8
+
9
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1 @@
1
+ require "rspec/absolutely_prepend_after_each"
@@ -0,0 +1,28 @@
1
+ require "rspec"
2
+
3
+ module RSpec::AbsolutelyPrependedAfterEach
4
+ def prepend_absolutely_after_each(*args, &block)
5
+ around(:each, *args) do |ex|
6
+ example_group = example.example_group
7
+
8
+ # if not after(:each) is called multiple times
9
+ unless example_group.metadata[:absolutely_prepended_after_each]
10
+ example_group.before(:each, *args, &block)
11
+
12
+ example_group.metadata[:absolutely_prepended_after_each] = true
13
+ end
14
+
15
+ ex.run
16
+ end
17
+ end
18
+ end
19
+
20
+ module RSpec::Core
21
+ class ExampleGroup
22
+ extend ::RSpec::AbsolutelyPrependedAfterEach
23
+ end
24
+
25
+ class Configuration
26
+ include ::RSpec::AbsolutelyPrependedAfterEach
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "rspec-absolutely_prepended_after_each"
5
+ gem.version = File.read(File.join(File.dirname(__FILE__), "VERSION")).chomp
6
+ gem.authors = ["okitan"]
7
+ gem.email = ["okitakunio@gmail.com"]
8
+ gem.description = "absolutely prepended after(:each) in rspec"
9
+ gem.summary = "absolutely prepended after(:each) in rspec"
10
+ gem.homepage = "https://github.com/okitan/rspec-absolutely_prepended_after_each"
11
+
12
+ gem.files = `git ls-files`.split($/)
13
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.require_paths = ["lib"]
16
+
17
+ gem.add_dependency "rspec", "~> 2.0"
18
+
19
+ gem.add_development_dependency "tapp"
20
+ gem.add_development_dependency "pry"
21
+ gem.add_development_dependency "rake"
22
+ end
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ describe "rspec-absolutely_prepended_after_each" do
4
+ it_behaves_like "returning rspec output" do
5
+ let(:spec) do <<-SPEC
6
+ describe "absolutely prepended after each" do
7
+ prepend_absolutely_after_each { puts "prepend_absolutely_after_each" }
8
+ after(:each) { puts "after(:each)" }
9
+ prepend_after(:each) { puts "pepend_after(:each)" }
10
+
11
+ it "works" do
12
+ end
13
+ end
14
+ SPEC
15
+ end
16
+
17
+ let(:result) do <<-RESULT
18
+ prepend_absolutely_after_each
19
+ pepend_after(:each)
20
+ after(:each)
21
+ RESULT
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ require "spec_helper"
2
+
3
+ describe "rspec-absolutely_prepended_after_each" do
4
+ it_behaves_like "returning rspec output" do
5
+ let(:spec) do <<-SPEC
6
+ RSpec.configure do |config|
7
+ config.prepend_absolutely_after_each do
8
+ puts "RSpec::Configuration.prepend_absolutely_after_each"
9
+ end
10
+ end
11
+
12
+ describe "absolutely prepended after each" do
13
+ after(:each) { puts "after(:each)" }
14
+ prepend_after(:each) { puts "pepend_after(:each)" }
15
+
16
+ it "works" do
17
+ end
18
+ end
19
+ SPEC
20
+ end
21
+
22
+ let(:result) do <<-RESULT
23
+ RSpec::Configuration.prepend_absolutely_after_each
24
+ pepend_after(:each)
25
+ after(:each)
26
+ RESULT
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,45 @@
1
+ require "bundler/setup"
2
+
3
+ require "rspec/absolutely_prepended_after_each"
4
+
5
+ require "tempfile"
6
+
7
+ require "tapp"
8
+ require "pry"
9
+
10
+ TMP_ROOT = File.expand_path("../tmp", File.dirname(__FILE__))
11
+
12
+ # this example require spec and return to set
13
+ shared_examples "returning rspec output" do
14
+ def rspec(file)
15
+ %x(bundle exec rspec -fd #{file})
16
+ end
17
+
18
+ def common_configuration
19
+ <<-SPEC
20
+ require "rspec/absolutely_prepended_after_each"
21
+
22
+ RSpec.configure do |config|
23
+ config.run_all_when_everything_filtered = true
24
+ end
25
+ SPEC
26
+ end
27
+
28
+ before(:each) do
29
+ @file = Tempfile.open(%w[ tmp _spec.rb ], TMP_ROOT) do |fp|
30
+ fp.print common_configuration
31
+ fp.print spec
32
+
33
+ fp.path
34
+ end
35
+ end
36
+
37
+ it "works" do
38
+ rspec(@file).should include(result)
39
+ end
40
+ end
41
+
42
+ RSpec.configure do |config|
43
+ config.treat_symbols_as_metadata_keys_with_true_values = true
44
+ config.run_all_when_everything_filtered = true
45
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-absolutely_prepended_after_each
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - okitan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: tapp
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: pry
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: absolutely prepended after(:each) in rspec
79
+ email:
80
+ - okitakunio@gmail.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - .gitignore
86
+ - .rvmrc
87
+ - .travis.yml
88
+ - Gemfile
89
+ - LICENSE.txt
90
+ - README.md
91
+ - Rakefile
92
+ - VERSION
93
+ - lib/rspec-absolutely_prepended_after_each.rb
94
+ - lib/rspec/absolutely_prepended_after_each.rb
95
+ - rspec-absolutely_prepended_after_each.gemspec
96
+ - spec/in_context_spec.rb
97
+ - spec/in_rspec_configure_spec.rb
98
+ - spec/spec_helper.rb
99
+ - tmp/.gitkeep
100
+ homepage: https://github.com/okitan/rspec-absolutely_prepended_after_each
101
+ licenses: []
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 1.8.24
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: absolutely prepended after(:each) in rspec
124
+ test_files:
125
+ - spec/in_context_spec.rb
126
+ - spec/in_rspec_configure_spec.rb
127
+ - spec/spec_helper.rb
128
+ has_rdoc: