rspec-file_fixtures 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d978a8476e823c5ce576c9c394496825de1c415fe257e18190f8ab8568649c29
4
- data.tar.gz: a1ef7422015b6d6be00907361d72b24c6587d8c078a0e344d81109bbcad0aa6e
3
+ metadata.gz: '093408a94e9e51ba94c4f4635a34074e49e4d1b7b10190a13507e57a3bf60141'
4
+ data.tar.gz: d53f862a7af51f91c39d60e540b40165e834f97404a6884a8c969d6b362c33e3
5
5
  SHA512:
6
- metadata.gz: 56a1fedb093df9f1729cda4d71477ed59e9016b72569bbc8a350b5e8c3008c448ecd18af9b7d17ab32a317f6d9bab5ecb0e26216875c4cfad3d7027177717b21
7
- data.tar.gz: 8ed1023046adbf09ab8a613bc4b43985fe0534e1c7df2487235426e11251c66c19225d1e3ccc2a044f07c07496948808b797511ae51ac3d3a5c7571b5fdb6f5d
6
+ metadata.gz: c888bf111292b125e6e8adeac538a0da5e94f861de1033e1154376210135cea3bf1622ef192bbecfa2d6a9de91c9b4e458edb6f998e91c6e9c8cc936431685e4
7
+ data.tar.gz: b3002dc69032e39af2e889ff7bfc8ea857dc66e355375150b98ca7ec35ef48c093df2a5d7af9c1d31cf118b5b20b597a24c9b38bfe9903c8e3bcfa11a050fd9b
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gemspec
7
7
 
8
8
  gem 'devpack', '~> 0.4.1'
9
9
  gem 'nokogiri', '~> 1.15'
10
+ gem 'rack-test', '~> 2.1'
10
11
  gem 'rake', '~> 13.0'
11
12
  gem 'rspec', '~> 3.12'
12
13
  gem 'rspec-documentation', '~> 0.0.5'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-file_fixtures (0.1.8)
4
+ rspec-file_fixtures (0.1.9)
5
5
  rspec (~> 3.12)
6
6
 
7
7
  GEM
@@ -29,6 +29,9 @@ GEM
29
29
  parser (3.2.2.1)
30
30
  ast (~> 2.4.1)
31
31
  racc (1.6.2)
32
+ rack (3.0.8)
33
+ rack-test (2.1.0)
34
+ rack (>= 1.3)
32
35
  rainbow (3.1.1)
33
36
  rake (13.0.6)
34
37
  regexp_parser (2.8.0)
@@ -95,6 +98,7 @@ PLATFORMS
95
98
  DEPENDENCIES
96
99
  devpack (~> 0.4.1)
97
100
  nokogiri (~> 1.15)
101
+ rack-test (~> 2.1)
98
102
  rake (~> 13.0)
99
103
  rspec (~> 3.12)
100
104
  rspec-documentation (~> 0.0.5)
@@ -16,6 +16,10 @@ module RSpecFileFixtures
16
16
  FileUtils.copy(pathname, destination)
17
17
  end
18
18
 
19
+ def upload(content_type:)
20
+ Rack::Test::UploadedFile.new(path, content_type)
21
+ end
22
+
19
23
  def from_xml
20
24
  require 'nokogiri'
21
25
  Nokogiri::XML.parse(read)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecFileFixtures
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
@@ -0,0 +1,11 @@
1
+ # Upload
2
+
3
+ Create a `Rack::Test::UploadedFile` instance by calling `#upload(content_type: 'image/png')` (e.g.).
4
+
5
+ The returned object can be passed as a parameter in a _request_ spec to simulate uploading a file.
6
+
7
+ ```rspec
8
+ subject { fixture('example.xml').upload(content_type: 'application/xml') }
9
+
10
+ it { is_expected.to be_a Rack::Test::UploadedFile }
11
+ ```
@@ -3,3 +3,4 @@
3
3
  require 'tempfile'
4
4
 
5
5
  require 'rspec/file_fixtures'
6
+ require 'rack/test/uploaded_file'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-file_fixtures
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-25 00:00:00.000000000 Z
11
+ date: 2023-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -54,6 +54,7 @@ files:
54
54
  - rspec-documentation/pages/010-Usage/030-XML.md
55
55
  - rspec-documentation/pages/010-Usage/040-Copy_to.md
56
56
  - rspec-documentation/pages/010-Usage/050-Pathname.md
57
+ - rspec-documentation/pages/010-Usage/060-Upload.md
57
58
  - rspec-documentation/pages/500-License.md
58
59
  - rspec-documentation/spec_helper.rb
59
60
  - rspec-file_fixtures.gemspec