rspec-suite_initializer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 993e148a7cb7d0674d152ec8049ee276bb210ee4
4
+ data.tar.gz: 3d7763a409fc0efe664cc3ad942b924b40cf9df0
5
+ SHA512:
6
+ metadata.gz: a8b4b9fb5da2ed65d5b3d105fb634b8b39488376143858b85aa3d8b484de6a0557fe853bcee9e1e0d5111c6ab1b152ebe9dd533c8d549f6cf669345c1fb264f5
7
+ data.tar.gz: d993358269f5b347722ca969a45ec847edcebc7f2cb7b5356fee16d9b7b81c915cce0286243e879f3d11d85b72ac88ebba47a0e44bf11a20b86620e9f9fb4574
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.swp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Takeshi Horiuchi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Rspec::SuiteInitializer
2
+
3
+ Initialize instance variables for RSpec on before :suite hook.
4
+
5
+ ## Installation
6
+
7
+ ```ruby
8
+ gem 'rspec-suite_initializer'
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ruby
14
+ require 'rspec/suite_initializer'
15
+
16
+ RSpec::SuiteInitializer.before_suite do |v|
17
+ v[:foo] = 'foo'
18
+ v[:bar] = 'bar'
19
+ end
20
+
21
+ RSpec.describe RSpec::SuiteInitializer do
22
+ context 'When use variable defined at before_suite' do
23
+ subject { [@foo, @bar] }
24
+ it { is_expected.to eq(['foo', 'bar']) }
25
+ end
26
+ end
27
+ ```
28
+
29
+ When `require rspec/suite_initializer`, defines `RSpec.configuration.suite_initializer`.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ require "rspec/suite_initializer/version"
2
+
3
+ RSpec.configure do |c|
4
+ c.add_setting :suite_initializer
5
+ c.suite_initializer = {}
6
+ c.before :all do
7
+ RSpec.configuration.suite_initializer.each do |k, v|
8
+ k = ('@' + k.to_s).to_sym
9
+ instance_variable_set k, v unless instance_variable_defined? k
10
+ end
11
+ end
12
+ end
13
+
14
+ module RSpec
15
+ module SuiteInitializer
16
+ def before_suite(&block)
17
+ RSpec.configure do |c|
18
+ c.before :suite do
19
+ block.call(c.suite_initializer)
20
+ end
21
+ end
22
+ end
23
+
24
+ module_function :before_suite
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ module RSpec
2
+ module SuiteInitializer
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec/suite_initializer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec-suite_initializer"
8
+ spec.version = RSpec::SuiteInitializer::VERSION
9
+ spec.authors = ["Takeshi Horiuchi"]
10
+ spec.email = ["keshihoriuchi@gmail.com"]
11
+
12
+ spec.summary = %q{Initialize instance variables for RSpec on before :suite hook.}
13
+ spec.homepage = "https://github.com/keshihoriuchi/rspec-suite_initializer"
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.9"
20
+ spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency "rspec", "> 2.10"
22
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-suite_initializer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Takeshi Horiuchi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.10'
55
+ description:
56
+ email:
57
+ - keshihoriuchi@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - lib/rspec/suite_initializer.rb
70
+ - lib/rspec/suite_initializer/version.rb
71
+ - rspec-suite_initializer.gemspec
72
+ homepage: https://github.com/keshihoriuchi/rspec-suite_initializer
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.4.5
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Initialize instance variables for RSpec on before :suite hook.
96
+ test_files: []