rspec-temp_dir 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: 26f0224659c1d394b7b48dbbd2625105dc964b69
4
+ data.tar.gz: 72e4bd64aab1bc536e28c3e347027cd54738b128
5
+ SHA512:
6
+ metadata.gz: 53c19f2905a0a412be81972ec06b40f73a4ab84e7da1717167bf9389f3f6e0035d93f8d4169ee1e3b99de5304c67c91ef495cde0f7e70f6c4061f2321b889c05
7
+ data.tar.gz: f4b5e0125af96da23344566c235c859cca6ac4131e537e6026218ef1653a5dec19c1b7c9a5ef58cfa6bb3f244972986663d16a58deff2ef5eee28ffa0e612ba4
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ repo_token: neej8FqJspOAXAEtwqYge65Dllr8Jn9R5
data/.gitignore ADDED
@@ -0,0 +1,22 @@
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
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.2
6
+ script: CODECLIMATE_REPO_TOKEN=329887587f83c7ce5a1ab75f426c00830ba5ffac290c90bc486713c88baea900 bundle exec rspec
7
+ branches:
8
+ only:
9
+ - master
10
+ notifications:
11
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec-temp_dir.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 sue445
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.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Rspec::TempDir
2
+
3
+ create automatically temporary directory at each examples
4
+
5
+ This is inspired by Junit [TemporaryFolder](http://junit.org/javadoc/4.9/org/junit/rules/TemporaryFolder.html)
6
+
7
+ [![Build Status](https://travis-ci.org/sue445/rspec-temp_dir.svg)](https://travis-ci.org/sue445/rspec-temp_dir)
8
+ [![Code Climate](https://codeclimate.com/github/sue445/rspec-temp_dir.png)](https://codeclimate.com/github/sue445/rspec-temp_dir)
9
+ [![Coverage Status](https://img.shields.io/coveralls/sue445/rspec-temp_dir.svg)](https://coveralls.io/r/sue445/rspec-temp_dir)
10
+ [![Dependency Status](https://gemnasium.com/sue445/rspec-temp_dir.svg)](https://gemnasium.com/sue445/rspec-temp_dir)
11
+
12
+ ## Requirements
13
+ * ruby 1.9+
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ gem 'rspec-temp_dir'
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install rspec-temp_dir
28
+
29
+ ## Usage
30
+
31
+ ```ruby
32
+ require 'rspec/temp_dir'
33
+
34
+ describe "uses temp dir" do
35
+ include_context "uses temp dir"
36
+
37
+ it "should create temp_dir" do
38
+ expect(Pathname(temp_dir)).to be_exist
39
+ end
40
+
41
+ it "can create file in temp_dir" do
42
+ temp_file = "#{temp_dir}/temp.txt"
43
+
44
+ File.open(temp_file, "w") do |f|
45
+ f.write("foo")
46
+ end
47
+
48
+ expect(File.read(temp_file)).to eq "foo"
49
+ end
50
+ end
51
+ ```
52
+
53
+ ## Contributing
54
+
55
+ 1. Fork it ( https://github.com/sue445/rspec-temp_dir/fork )
56
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
57
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
58
+ 4. Push to the branch (`git push origin my-new-feature`)
59
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,8 @@
1
+ require "rspec/temp_dir/version"
2
+ require "rspec/temp_dir/uses_temp_dir"
3
+
4
+ module Rspec
5
+ module TempDir
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ require "tmpdir"
2
+
3
+ shared_context "uses temp dir" do
4
+ around do |example|
5
+ Dir.mktmpdir("rspec-") do |dir|
6
+ @temp_dir = dir
7
+ example.run
8
+ end
9
+ end
10
+
11
+ attr_reader :temp_dir
12
+ end
@@ -0,0 +1,5 @@
1
+ module Rspec
2
+ module TempDir
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec/temp_dir/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec-temp_dir"
8
+ spec.version = Rspec::TempDir::VERSION
9
+ spec.authors = ["sue445"]
10
+ spec.email = ["sue445@sue445.net"]
11
+ spec.summary = %q{create automatically temporary directory at each examples}
12
+ spec.description = %q{create automatically temporary directory at each examples}
13
+ spec.homepage = "https://github.com/sue445/rspec-temp_dir"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rspec"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+
26
+ spec.add_development_dependency "codeclimate-test-reporter"
27
+ spec.add_development_dependency "coveralls"
28
+ end
@@ -0,0 +1,17 @@
1
+ describe "uses temp dir" do
2
+ include_context "uses temp dir"
3
+
4
+ it "should create temp_dir" do
5
+ expect(Pathname(temp_dir)).to be_exist
6
+ end
7
+
8
+ it "can create file in temp_dir" do
9
+ temp_file = "#{temp_dir}/temp.txt"
10
+
11
+ File.open(temp_file, "w") do |f|
12
+ f.write("foo")
13
+ end
14
+
15
+ expect(File.read(temp_file)).to eq "foo"
16
+ end
17
+ end
@@ -0,0 +1,90 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+
18
+ require "codeclimate-test-reporter"
19
+ CodeClimate::TestReporter.start
20
+
21
+ require 'coveralls'
22
+ Coveralls.wear!
23
+
24
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
25
+ require 'rspec/temp_dir'
26
+
27
+ RSpec.configure do |config|
28
+ # The settings below are suggested to provide a good initial experience
29
+ # with RSpec, but feel free to customize to your heart's content.
30
+ =begin
31
+ # These two settings work together to allow you to limit a spec run
32
+ # to individual examples or groups you care about by tagging them with
33
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
34
+ # get run.
35
+ config.filter_run :focus
36
+ config.run_all_when_everything_filtered = true
37
+
38
+ # Many RSpec users commonly either run the entire suite or an individual
39
+ # file, and it's useful to allow more verbose output when running an
40
+ # individual spec file.
41
+ if config.files_to_run.one?
42
+ # Use the documentation formatter for detailed output,
43
+ # unless a formatter has already been configured
44
+ # (e.g. via a command-line flag).
45
+ config.default_formatter = 'doc'
46
+ end
47
+
48
+ # Print the 10 slowest examples and example groups at the
49
+ # end of the spec run, to help surface which specs are running
50
+ # particularly slow.
51
+ config.profile_examples = 10
52
+
53
+ # Run specs in random order to surface order dependencies. If you find an
54
+ # order dependency and want to debug it, you can fix the order by providing
55
+ # the seed, which is printed after each run.
56
+ # --seed 1234
57
+ config.order = :random
58
+
59
+ # Seed global randomization in this process using the `--seed` CLI option.
60
+ # Setting this allows you to use `--seed` to deterministically reproduce
61
+ # test failures related to randomization by passing the same `--seed` value
62
+ # as the one that triggered the failure.
63
+ Kernel.srand config.seed
64
+
65
+ # rspec-expectations config goes here. You can use an alternate
66
+ # assertion/expectation library such as wrong or the stdlib/minitest
67
+ # assertions if you prefer.
68
+ config.expect_with :rspec do |expectations|
69
+ # Enable only the newer, non-monkey-patching expect syntax.
70
+ # For more details, see:
71
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
72
+ expectations.syntax = :expect
73
+ end
74
+
75
+ # rspec-mocks config goes here. You can use an alternate test double
76
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
77
+ config.mock_with :rspec do |mocks|
78
+ # Enable only the newer, non-monkey-patching expect syntax.
79
+ # For more details, see:
80
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
81
+ mocks.syntax = :expect
82
+
83
+ # Prevents you from mocking or stubbing a method that does not exist on
84
+ # a real object. This is generally recommended.
85
+ mocks.verify_partial_doubles = true
86
+ end
87
+ =end
88
+
89
+ config.order = :random
90
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-temp_dir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - sue445
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: create automatically temporary directory at each examples
84
+ email:
85
+ - sue445@sue445.net
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".coveralls.yml"
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - lib/rspec/temp_dir.rb
99
+ - lib/rspec/temp_dir/uses_temp_dir.rb
100
+ - lib/rspec/temp_dir/version.rb
101
+ - rspec-temp_dir.gemspec
102
+ - spec/rspec/uses_temp_dir_spec.rb
103
+ - spec/spec_helper.rb
104
+ homepage: https://github.com/sue445/rspec-temp_dir
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.2.2
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: create automatically temporary directory at each examples
128
+ test_files:
129
+ - spec/rspec/uses_temp_dir_spec.rb
130
+ - spec/spec_helper.rb