nginx_test_helper 0.4.0 → 0.4.2

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
- SHA1:
3
- metadata.gz: 78a4974a32a0e57c0f6dcdf50600c34045085665
4
- data.tar.gz: 012ca812a9689d695f1e39761aee4bd595f74eb3
2
+ SHA256:
3
+ metadata.gz: e31f8e2148e3e7f128f75c8e6d5bd28eeb8900371ff95328f667d7b4ad32badf
4
+ data.tar.gz: 6e76902d9bd656693a7efb1be699afb88282b6c277876a45fce814aaf778ac11
5
5
  SHA512:
6
- metadata.gz: 08f2d07609dea934f5013edfc80bf259402fda0e67170913b4b4a73a7ec7cecaf17b8fc333f2083b43562f15156b86e7ed96af7f52e2316122f2d2956780db10
7
- data.tar.gz: 5d61fcb9ce455966da624bcb0833a4bd99c5febffe54b25d5a66a08e634528eecf1b6f3865f8d60ec5db08d28e367cbd6273d79aedba62b08f874e9350096966
6
+ metadata.gz: e4ae47cad9159ed43590ffad5760db5c58f141dd7c94e04355462c020b03ac5530f6e01393b3fd0847661241c7c83bc561e2cea0dfe6fa4909d318594c6b7a02
7
+ data.tar.gz: 46753bf5294e3682c1305279cea745b76878861fea197aa38b70dc9e1c8a262d9c2a8ce102b82c1bd8472bfc80f3672feb5e0bf27f8b8260387e3647eddc4008
@@ -32,13 +32,15 @@ module NginxTestHelper
32
32
  self
33
33
  end
34
34
 
35
- def failure_message_for_should
35
+ def failure_message
36
36
  "expected that the '#{request.method}' to '#{request.uri}' to #{description}"
37
37
  end
38
+ alias :failure_message_for_should :failure_message
38
39
 
39
- def failure_message_for_should_not
40
+ def failure_message_when_negated
40
41
  "expected that the '#{request.method}' to '#{request.uri}' not to #{description}"
41
42
  end
43
+ alias :failure_message_for_should_not :failure_message_when_negated
42
44
 
43
45
  def description
44
46
  about_content = ""
@@ -1,3 +1,3 @@
1
1
  module NginxTestHelper
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -25,7 +25,7 @@ module NginxTestHelper
25
25
  config = Config.new(config_id, configuration)
26
26
  stderr_msg = start_server(config)
27
27
  stop_server(config)
28
- "#{stderr_msg}\n#{File.read(config.error_log) if File.exists?(config.error_log)}"
28
+ "#{stderr_msg}\n#{File.read(config.error_log) if File.exist?(config.error_log)}"
29
29
  end
30
30
 
31
31
  def open_socket(host, port)
@@ -25,9 +25,9 @@ describe NginxTestHelper::CommandLineTool do
25
25
 
26
26
  it "should create example files showing how to use the gem" do
27
27
  NginxTestHelper::CommandLineTool.new.process ["init"]
28
- expect(File.exists?('tmp/spec/nginx_configuration.rb')).to be true
29
- expect(File.exists?('tmp/spec/example_spec.rb')).to be true
30
- expect(File.exists?('tmp/spec/spec_helper.rb')).to be true
28
+ expect(File.exist?('tmp/spec/nginx_configuration.rb')).to be true
29
+ expect(File.exist?('tmp/spec/example_spec.rb')).to be true
30
+ expect(File.exist?('tmp/spec/spec_helper.rb')).to be true
31
31
 
32
32
  expect(File.read('tmp/spec/nginx_configuration.rb')).to eql(File.read('templates/spec/nginx_configuration.rb'))
33
33
  expect(File.read('tmp/spec/example_spec.rb')).to eql(File.read('templates/spec/example_spec.rb'))
@@ -30,8 +30,8 @@ describe NginxTestHelper::Config do
30
30
 
31
31
  it "should create dirs where logs and client_body_temp will be stored" do
32
32
  NginxTestHelper::Config.new("config_id", {})
33
- expect(File.exists?("/tmp/nginx_tests/logs")).to be true
34
- expect(File.exists?("/tmp/nginx_tests/client_body_temp")).to be true
33
+ expect(File.exist?("/tmp/nginx_tests/logs")).to be true
34
+ expect(File.exist?("/tmp/nginx_tests/client_body_temp")).to be true
35
35
  end
36
36
 
37
37
  it "should create the configuration file using the template configuration" do
@@ -48,10 +48,10 @@ describe NginxTestHelper::Config do
48
48
 
49
49
  it "should has a method to delete config and log files" do
50
50
  NginxTestHelper::Config.delete_config_and_log_files(subject.config_id)
51
- expect(File.exists?(subject.configuration[:configuration_filename])).to be false
52
- expect(File.exists?(subject.configuration[:access_log])).to be false
53
- expect(File.exists?(subject.configuration[:error_log])).to be false
54
- expect(File.exists?(subject.configuration[:client_body_temp])).to be false
51
+ expect(File.exist?(subject.configuration[:configuration_filename])).to be false
52
+ expect(File.exist?(subject.configuration[:access_log])).to be false
53
+ expect(File.exist?(subject.configuration[:error_log])).to be false
54
+ expect(File.exist?(subject.configuration[:client_body_temp])).to be false
55
55
  end
56
56
 
57
57
  it "should expose configurations keys as methods" do
@@ -253,9 +253,21 @@ describe NginxTestHelper do
253
253
 
254
254
  expect(subject.send(:config_id)).to eql("test_config_id_by___name__")
255
255
  end
256
+
257
+ context "for rspec 3.0+" do
258
+ before { |ex| Thread.current[:current_example] = ex }
259
+
260
+ it "should use example metadata if available" do
261
+ allow(Thread.current[:current_example]).to receive(:location).and_return("./spec/test_config_id_spec.rb:101")
262
+ expect(subject.send(:config_id)).to eql("test_config_id_spec_rb_101")
263
+ end
264
+ end
256
265
  end
257
266
 
258
267
  context "and check if the test has passed" do
268
+ before { Thread.current[:current_example] = nil }
269
+ after { |ex| Thread.current[:current_example] = ex }
270
+
259
271
  context "using example exception if available" do
260
272
  it "should be 'true' if exception is 'nil'" do
261
273
  allow(subject.example).to receive(:exception).and_return(nil)
@@ -266,6 +278,20 @@ describe NginxTestHelper do
266
278
  allow(subject.example).to receive(:exception).and_return("")
267
279
  expect(subject.send(:has_passed?)).to be false
268
280
  end
281
+
282
+ context "for rspec 3.0+" do
283
+ before { |ex| Thread.current[:current_example] = ex }
284
+
285
+ it "should be 'true' if exception is 'nil'" do
286
+ allow(Thread.current[:current_example]).to receive(:exception).and_return(nil)
287
+ expect(subject.send(:has_passed?)).to be true
288
+ end
289
+
290
+ it "should be 'false' if exception is not 'nil'" do
291
+ allow(Thread.current[:current_example]).to receive(:exception).and_return("")
292
+ expect(subject.send(:has_passed?)).to be false
293
+ end
294
+ end
269
295
  end
270
296
 
271
297
  context "using 'test_passed' attribute if example exception is not available" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nginx_test_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wandenberg Peixoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-24 00:00:00.000000000 Z
11
+ date: 2023-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: popen4
@@ -117,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
- rubyforge_project:
121
- rubygems_version: 2.2.2
120
+ rubygems_version: 3.4.1
122
121
  signing_key:
123
122
  specification_version: 4
124
123
  summary: A collection of helper methods to test your nginx module.