rspec-rails 3.8.3 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +23 -0
- data/lib/generators/rspec/generators/generator_generator.rb +24 -0
- data/lib/generators/rspec/generators/templates/generator_spec.rb +6 -0
- data/lib/generators/rspec/install/templates/spec/rails_helper.rb +4 -0
- data/lib/generators/rspec/system/system_generator.rb +26 -0
- data/lib/generators/rspec/system/templates/system_spec.rb +9 -0
- data/lib/rspec/rails/matchers.rb +1 -0
- data/lib/rspec/rails/matchers/active_job.rb +1 -1
- data/lib/rspec/rails/matchers/base_matcher.rb +184 -0
- data/lib/rspec/rails/matchers/be_a_new.rb +1 -1
- data/lib/rspec/rails/matchers/be_new_record.rb +1 -1
- data/lib/rspec/rails/matchers/have_enqueued_mail.rb +174 -0
- data/lib/rspec/rails/matchers/have_http_status.rb +8 -17
- data/lib/rspec/rails/matchers/have_rendered.rb +1 -1
- data/lib/rspec/rails/matchers/redirect_to.rb +1 -1
- data/lib/rspec/rails/matchers/routing_matchers.rb +2 -2
- data/lib/rspec/rails/version.rb +1 -1
- metadata +17 -11
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6934e8851e24fed0bb722beb1fcfc8542dfbadf4d43578e9b85eee97d916322e
|
4
|
+
data.tar.gz: 459693e70621a4a4698d3103783e45ac99e21605ff7d10a292458c6972d54249
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b484534eb48a22a631f217760f2d983d2c4338131df0be2dc71f7b34933031ad8536a03cdcad7624a1e4d450ae374ad157e82995684965f2adff34bcae8d82d
|
7
|
+
data.tar.gz: 494a45f44892e9093ee1e9327163dd3a32ab88a4fb42600b8207031b36afaad30d250ce782e01b66f64fb937ee08bdd0114a17bb150ce335adbd1a21354f447a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
### Development
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.9.0...master)
|
3
|
+
|
4
|
+
### 3.9.0 / 2019-10-08
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.8.2...v3.9.0)
|
6
|
+
|
7
|
+
Enhancements
|
8
|
+
|
9
|
+
* Use `__dir__` instead of `__FILE__` in generated `rails_helper.rb` where
|
10
|
+
supported. (OKURA Masafumi, #2048)
|
11
|
+
* Add `have_enqueued` matcher as a "super" matcher to the `ActiveJob` matchers
|
12
|
+
making it easier to match on `ActiveJob` delivered emails. (Joel Lubrano, #2047)
|
13
|
+
* Add generator for system specs on Rails 5.1 and above. (Andrzej Sliwa, #1933)
|
14
|
+
* Add generator for generator specs. (@ConSou, #2085)
|
15
|
+
* Add option to generate routes when generating controller specs. (David Revelo, #2134)
|
16
|
+
|
17
|
+
Bug Fixes:
|
18
|
+
|
19
|
+
* Make the `ActiveJob` matchers fail when multiple jobs are queued for negated
|
20
|
+
matches. e.g. `expect { job; job; }.to_not have_enqueued_job.
|
21
|
+
(Emric Istanful, #2069)
|
22
|
+
|
1
23
|
### 3.8.3 / 2019-10-03
|
2
24
|
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.8.2...master)
|
3
25
|
|
@@ -60,6 +82,7 @@ Bug Fixes:
|
|
60
82
|
(Laurent Cobos, #1943)
|
61
83
|
* Allow custom template resolvers in view specs. (@ahorek, #1941)
|
62
84
|
|
85
|
+
|
63
86
|
### 3.7.2 / 2017-11-20
|
64
87
|
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.7.1...v3.7.2)
|
65
88
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'generators/rspec'
|
2
|
+
|
3
|
+
module Rspec
|
4
|
+
module Generators
|
5
|
+
# @private
|
6
|
+
class GeneratorsGenerator < Base
|
7
|
+
class_option :generator_specs, :type => :boolean, :default => false, :desc => "Generate generator specs"
|
8
|
+
|
9
|
+
def generate_generator_spec
|
10
|
+
return unless options[:generator_specs]
|
11
|
+
|
12
|
+
template template_name, File.join('spec/generator', class_path, filename)
|
13
|
+
end
|
14
|
+
|
15
|
+
def template_name
|
16
|
+
'generator_spec.rb'
|
17
|
+
end
|
18
|
+
|
19
|
+
def filename
|
20
|
+
"#{table_name}_generator_spec.rb"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
2
|
require 'spec_helper'
|
3
3
|
ENV['RAILS_ENV'] ||= 'test'
|
4
|
+
<% if RUBY_VERSION >= '2.0.0' %>
|
5
|
+
require File.expand_path('../config/environment', __dir__)
|
6
|
+
<% else %>
|
4
7
|
require File.expand_path('../../config/environment', __FILE__)
|
8
|
+
<% end %>
|
5
9
|
# Prevent database truncation if the environment is production
|
6
10
|
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
7
11
|
require 'rspec/rails'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'generators/rspec'
|
2
|
+
|
3
|
+
if ::Rails::VERSION::STRING >= '5.1'
|
4
|
+
module Rspec
|
5
|
+
module Generators
|
6
|
+
# @private
|
7
|
+
class SystemGenerator < Base
|
8
|
+
class_option :system_specs, :type => :boolean, :default => true, :desc => "Generate system specs"
|
9
|
+
|
10
|
+
def generate_system_spec
|
11
|
+
return unless options[:system_specs]
|
12
|
+
|
13
|
+
template template_name, File.join('spec/system', class_path, filename)
|
14
|
+
end
|
15
|
+
|
16
|
+
def template_name
|
17
|
+
'system_spec.rb'
|
18
|
+
end
|
19
|
+
|
20
|
+
def filename
|
21
|
+
"#{table_name}_spec.rb"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/rspec/rails/matchers.rb
CHANGED
@@ -0,0 +1,184 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Rails
|
3
|
+
module Matchers
|
4
|
+
# @ api private
|
5
|
+
class BaseMatcher
|
6
|
+
include RSpec::Matchers::Composable
|
7
|
+
|
8
|
+
# @api private
|
9
|
+
# Used to detect when no arg is passed to `initialize`.
|
10
|
+
# `nil` cannot be used because it's a valid value to pass.
|
11
|
+
UNDEFINED = Object.new.freeze
|
12
|
+
|
13
|
+
# @private
|
14
|
+
attr_reader :actual, :expected, :rescued_exception
|
15
|
+
|
16
|
+
# @private
|
17
|
+
attr_writer :matcher_name
|
18
|
+
|
19
|
+
def initialize(expected = UNDEFINED)
|
20
|
+
@expected = expected unless UNDEFINED.equal?(expected)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @api private
|
24
|
+
# Indicates if the match is successful. Delegates to `match`, which
|
25
|
+
# should be defined on a subclass. Takes care of consistently
|
26
|
+
# initializing the `actual` attribute.
|
27
|
+
def matches?(actual)
|
28
|
+
@actual = actual
|
29
|
+
match(expected, actual)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @api private
|
33
|
+
# Used to wrap a block of code that will indicate failure by
|
34
|
+
# raising one of the named exceptions.
|
35
|
+
#
|
36
|
+
# This is used by rspec-rails for some of its matchers that
|
37
|
+
# wrap rails' assertions.
|
38
|
+
def match_unless_raises(*exceptions)
|
39
|
+
exceptions.unshift Exception if exceptions.empty?
|
40
|
+
begin
|
41
|
+
yield
|
42
|
+
true
|
43
|
+
rescue *exceptions => @rescued_exception
|
44
|
+
false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# @api private
|
49
|
+
# Generates a description using {RSpec::Matchers::EnglishPhrasing}.
|
50
|
+
# @return [String]
|
51
|
+
def description
|
52
|
+
desc = RSpec::Matchers::EnglishPhrasing.split_words(self.class.matcher_name)
|
53
|
+
desc << RSpec::Matchers::EnglishPhrasing.list(@expected) if defined?(@expected)
|
54
|
+
desc
|
55
|
+
end
|
56
|
+
|
57
|
+
# @api private
|
58
|
+
# Matchers are not diffable by default. Override this to make your
|
59
|
+
# subclass diffable.
|
60
|
+
def diffable?
|
61
|
+
false
|
62
|
+
end
|
63
|
+
|
64
|
+
# @api private
|
65
|
+
# Most matchers are value matchers (i.e. meant to work with `expect(value)`)
|
66
|
+
# rather than block matchers (i.e. meant to work with `expect { }`), so
|
67
|
+
# this defaults to false. Block matchers must override this to return true.
|
68
|
+
def supports_block_expectations?
|
69
|
+
false
|
70
|
+
end
|
71
|
+
|
72
|
+
# @api private
|
73
|
+
def expects_call_stack_jump?
|
74
|
+
false
|
75
|
+
end
|
76
|
+
|
77
|
+
# @private
|
78
|
+
def expected_formatted
|
79
|
+
RSpec::Support::ObjectFormatter.format(@expected)
|
80
|
+
end
|
81
|
+
|
82
|
+
# @private
|
83
|
+
def actual_formatted
|
84
|
+
RSpec::Support::ObjectFormatter.format(@actual)
|
85
|
+
end
|
86
|
+
|
87
|
+
# @private
|
88
|
+
def self.matcher_name
|
89
|
+
@matcher_name ||= underscore(name.split('::').last)
|
90
|
+
end
|
91
|
+
|
92
|
+
# @private
|
93
|
+
def matcher_name
|
94
|
+
if defined?(@matcher_name)
|
95
|
+
@matcher_name
|
96
|
+
else
|
97
|
+
self.class.matcher_name
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# @private
|
102
|
+
# Borrowed from ActiveSupport.
|
103
|
+
def self.underscore(camel_cased_word)
|
104
|
+
word = camel_cased_word.to_s.dup
|
105
|
+
word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
106
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
107
|
+
word.tr!('-', '_')
|
108
|
+
word.downcase!
|
109
|
+
word
|
110
|
+
end
|
111
|
+
private_class_method :underscore
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def assert_ivars(*expected_ivars)
|
116
|
+
return unless (expected_ivars - present_ivars).any?
|
117
|
+
ivar_list = RSpec::Matchers::EnglishPhrasing.list(expected_ivars)
|
118
|
+
raise "#{self.class.name} needs to supply#{ivar_list}"
|
119
|
+
end
|
120
|
+
|
121
|
+
if RUBY_VERSION.to_f < 1.9
|
122
|
+
# :nocov:
|
123
|
+
def present_ivars
|
124
|
+
instance_variables.map(&:to_sym)
|
125
|
+
end
|
126
|
+
# :nocov:
|
127
|
+
else
|
128
|
+
alias present_ivars instance_variables
|
129
|
+
end
|
130
|
+
|
131
|
+
# @private
|
132
|
+
module HashFormatting
|
133
|
+
# `{ :a => 5, :b => 2 }.inspect` produces:
|
134
|
+
#
|
135
|
+
# {:a=>5, :b=>2}
|
136
|
+
#
|
137
|
+
# ...but it looks much better as:
|
138
|
+
#
|
139
|
+
# {:a => 5, :b => 2}
|
140
|
+
#
|
141
|
+
# This is idempotent and safe to run on a string multiple times.
|
142
|
+
def improve_hash_formatting(inspect_string)
|
143
|
+
inspect_string.gsub(/(\S)=>(\S)/, '\1 => \2')
|
144
|
+
end
|
145
|
+
module_function :improve_hash_formatting
|
146
|
+
end
|
147
|
+
|
148
|
+
include HashFormatting
|
149
|
+
|
150
|
+
# @api private
|
151
|
+
# Provides default implementations of failure messages, based on the `description`.
|
152
|
+
module DefaultFailureMessages
|
153
|
+
# @api private
|
154
|
+
# Provides a good generic failure message. Based on `description`.
|
155
|
+
# When subclassing, if you are not satisfied with this failure message
|
156
|
+
# you often only need to override `description`.
|
157
|
+
# @return [String]
|
158
|
+
def failure_message
|
159
|
+
"expected #{description_of @actual} to #{description}".dup
|
160
|
+
end
|
161
|
+
|
162
|
+
# @api private
|
163
|
+
# Provides a good generic negative failure message. Based on `description`.
|
164
|
+
# When subclassing, if you are not satisfied with this failure message
|
165
|
+
# you often only need to override `description`.
|
166
|
+
# @return [String]
|
167
|
+
def failure_message_when_negated
|
168
|
+
"expected #{description_of @actual} not to #{description}".dup
|
169
|
+
end
|
170
|
+
|
171
|
+
# @private
|
172
|
+
def self.has_default_failure_messages?(matcher)
|
173
|
+
matcher.method(:failure_message).owner == self &&
|
174
|
+
matcher.method(:failure_message_when_negated).owner == self
|
175
|
+
rescue NameError
|
176
|
+
false
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
include DefaultFailureMessages
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
@@ -6,7 +6,7 @@ module RSpec
|
|
6
6
|
# Matcher class for `be_a_new`. Should not be instantiated directly.
|
7
7
|
#
|
8
8
|
# @see RSpec::Rails::Matchers#be_a_new
|
9
|
-
class BeANew < RSpec::Matchers::
|
9
|
+
class BeANew < RSpec::Rails::Matchers::BaseMatcher
|
10
10
|
# @private
|
11
11
|
def initialize(expected)
|
12
12
|
@expected = expected
|
@@ -0,0 +1,174 @@
|
|
1
|
+
require "rspec/mocks"
|
2
|
+
require "rspec/rails/matchers/active_job"
|
3
|
+
|
4
|
+
module RSpec
|
5
|
+
module Rails
|
6
|
+
module Matchers
|
7
|
+
# Matcher class for `have_enqueued_mail`. Should not be instantiated directly.
|
8
|
+
#
|
9
|
+
# rubocop: disable Style/ClassLength
|
10
|
+
# @private
|
11
|
+
# @see RSpec::Rails::Matchers#have_enqueued_mail
|
12
|
+
class HaveEnqueuedMail < ActiveJob::HaveEnqueuedJob
|
13
|
+
MAILER_JOB_METHOD = 'deliver_now'.freeze
|
14
|
+
|
15
|
+
include RSpec::Mocks::ExampleMethods
|
16
|
+
|
17
|
+
def initialize(mailer_class, method_name)
|
18
|
+
super(mailer_job)
|
19
|
+
@mailer_class = mailer_class
|
20
|
+
@method_name = method_name
|
21
|
+
@mail_args = []
|
22
|
+
@args = mailer_args
|
23
|
+
end
|
24
|
+
|
25
|
+
def description
|
26
|
+
"enqueues #{@mailer_class.name}.#{@method_name}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def with(*args, &block)
|
30
|
+
@mail_args = args
|
31
|
+
block.nil? ? super(*mailer_args) : super(*mailer_args, &yield_mail_args(block))
|
32
|
+
end
|
33
|
+
|
34
|
+
def matches?(block)
|
35
|
+
raise ArgumentError, 'have_enqueued_mail and enqueue_mail only work with block arguments' unless block.respond_to?(:call)
|
36
|
+
check_active_job_adapter
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
def failure_message
|
41
|
+
"expected to enqueue #{base_message}".tap do |msg|
|
42
|
+
msg << "\n#{unmatching_mail_jobs_message}" if unmatching_mail_jobs.any?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def failure_message_when_negated
|
47
|
+
"expected not to enqueue #{base_message}"
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def base_message
|
53
|
+
"#{@mailer_class.name}.#{@method_name}".tap do |msg|
|
54
|
+
msg << " #{expected_count_message}"
|
55
|
+
msg << " with #{@mail_args}," if @mail_args.any?
|
56
|
+
msg << " on queue #{@queue}," if @queue
|
57
|
+
msg << " at #{@at.inspect}," if @at
|
58
|
+
msg << " but enqueued #{@matching_jobs.size}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def expected_count_message
|
63
|
+
"#{message_expectation_modifier} #{@expected_number} #{@expected_number == 1 ? 'time' : 'times'}"
|
64
|
+
end
|
65
|
+
|
66
|
+
def mailer_args
|
67
|
+
if @mail_args.any?
|
68
|
+
base_mailer_args + @mail_args
|
69
|
+
else
|
70
|
+
mailer_method_arity = @mailer_class.instance_method(@method_name).arity
|
71
|
+
|
72
|
+
number_of_args = if mailer_method_arity < 0
|
73
|
+
(mailer_method_arity + 1).abs
|
74
|
+
else
|
75
|
+
mailer_method_arity
|
76
|
+
end
|
77
|
+
|
78
|
+
base_mailer_args + Array.new(number_of_args) { anything }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def base_mailer_args
|
83
|
+
[@mailer_class.name, @method_name.to_s, MAILER_JOB_METHOD]
|
84
|
+
end
|
85
|
+
|
86
|
+
def yield_mail_args(block)
|
87
|
+
Proc.new { |*job_args| block.call(*(job_args - base_mailer_args)) }
|
88
|
+
end
|
89
|
+
|
90
|
+
def check_active_job_adapter
|
91
|
+
return if ::ActiveJob::QueueAdapters::TestAdapter === ::ActiveJob::Base.queue_adapter
|
92
|
+
raise StandardError, "To use HaveEnqueuedMail matcher set `ActiveJob::Base.queue_adapter = :test`"
|
93
|
+
end
|
94
|
+
|
95
|
+
def unmatching_mail_jobs
|
96
|
+
@unmatching_jobs.select do |job|
|
97
|
+
job[:job] == mailer_job
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def unmatching_mail_jobs_message
|
102
|
+
msg = "Queued deliveries:"
|
103
|
+
|
104
|
+
unmatching_mail_jobs.each do |job|
|
105
|
+
msg << "\n #{mail_job_message(job)}"
|
106
|
+
end
|
107
|
+
|
108
|
+
msg
|
109
|
+
end
|
110
|
+
|
111
|
+
def mail_job_message(job)
|
112
|
+
mailer_method = job[:args][0..1].join('.')
|
113
|
+
|
114
|
+
mailer_args = job[:args][3..-1]
|
115
|
+
msg_parts = []
|
116
|
+
msg_parts << "with #{mailer_args}" if mailer_args.any?
|
117
|
+
msg_parts << "on queue #{job[:queue]}" if job[:queue] && job[:queue] != 'mailers'
|
118
|
+
msg_parts << "at #{Time.at(job[:at])}" if job[:at]
|
119
|
+
|
120
|
+
"#{mailer_method} #{msg_parts.join(', ')}".strip
|
121
|
+
end
|
122
|
+
|
123
|
+
def mailer_job
|
124
|
+
ActionMailer::DeliveryJob
|
125
|
+
end
|
126
|
+
end
|
127
|
+
# rubocop: enable Style/ClassLength
|
128
|
+
|
129
|
+
# @api public
|
130
|
+
# Passes if an email has been enqueued inside block.
|
131
|
+
# May chain with to specify expected arguments.
|
132
|
+
# May chain at_least, at_most or exactly to specify a number of times.
|
133
|
+
# May chain at to specify a send time.
|
134
|
+
# May chain on_queue to specify a queue.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# expect {
|
138
|
+
# MyMailer.welcome(user).deliver_later
|
139
|
+
# }.to have_enqueued_mail(MyMailer, :welcome)
|
140
|
+
#
|
141
|
+
# # Using alias
|
142
|
+
# expect {
|
143
|
+
# MyMailer.welcome(user).deliver_later
|
144
|
+
# }.to enqueue_mail(MyMailer, :welcome)
|
145
|
+
#
|
146
|
+
# expect {
|
147
|
+
# MyMailer.welcome(user).deliver_later
|
148
|
+
# }.to have_enqueued_mail(MyMailer, :welcome).with(user)
|
149
|
+
#
|
150
|
+
# expect {
|
151
|
+
# MyMailer.welcome(user).deliver_later
|
152
|
+
# MyMailer.welcome(user).deliver_later
|
153
|
+
# }.to have_enqueued_mail(MyMailer, :welcome).at_least(:once)
|
154
|
+
#
|
155
|
+
# expect {
|
156
|
+
# MyMailer.welcome(user).deliver_later
|
157
|
+
# }.to have_enqueued_mail(MyMailer, :welcome).at_most(:twice)
|
158
|
+
#
|
159
|
+
# expect {
|
160
|
+
# MyMailer.welcome(user).deliver_later(wait_until: Date.tomorrow.noon)
|
161
|
+
# }.to have_enqueued_mail(MyMailer, :welcome).at(Date.tomorrow.noon)
|
162
|
+
#
|
163
|
+
# expect {
|
164
|
+
# MyMailer.welcome(user).deliver_later(queue: :urgent_mail)
|
165
|
+
# }.to have_enqueued_mail(MyMailer, :welcome).on_queue(:urgent_mail)
|
166
|
+
def have_enqueued_mail(mailer_class, mail_method_name)
|
167
|
+
HaveEnqueuedMail.new(mailer_class, mail_method_name)
|
168
|
+
end
|
169
|
+
alias_method :have_enqueued_email, :have_enqueued_mail
|
170
|
+
alias_method :enqueue_mail, :have_enqueued_mail
|
171
|
+
alias_method :enqueue_email, :have_enqueued_mail
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -73,7 +73,7 @@ module RSpec
|
|
73
73
|
# expect(response).to have_http_status(404)
|
74
74
|
#
|
75
75
|
# @see RSpec::Rails::Matchers.have_http_status
|
76
|
-
class NumericCode < RSpec::Matchers::
|
76
|
+
class NumericCode < RSpec::Rails::Matchers::BaseMatcher
|
77
77
|
include HaveHttpStatus
|
78
78
|
|
79
79
|
def initialize(code)
|
@@ -124,7 +124,7 @@ module RSpec
|
|
124
124
|
#
|
125
125
|
# @see RSpec::Rails::Matchers.have_http_status
|
126
126
|
# @see https://github.com/rack/rack/blob/master/lib/rack/utils.rb `Rack::Utils::SYMBOL_TO_STATUS_CODE`
|
127
|
-
class SymbolicStatus < RSpec::Matchers::
|
127
|
+
class SymbolicStatus < RSpec::Rails::Matchers::BaseMatcher
|
128
128
|
include HaveHttpStatus
|
129
129
|
|
130
130
|
def initialize(status)
|
@@ -236,7 +236,7 @@ module RSpec
|
|
236
236
|
#
|
237
237
|
# @see RSpec::Rails::Matchers.have_http_status
|
238
238
|
# @see ActionDispatch::TestResponse
|
239
|
-
class GenericStatus < RSpec::Matchers::
|
239
|
+
class GenericStatus < RSpec::Rails::Matchers::BaseMatcher
|
240
240
|
include HaveHttpStatus
|
241
241
|
|
242
242
|
# @return [Array<Symbol>] of status codes which represent a HTTP status
|
@@ -289,20 +289,11 @@ module RSpec
|
|
289
289
|
|
290
290
|
protected
|
291
291
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
:missing => 'not_found'
|
298
|
-
}.freeze
|
299
|
-
else
|
300
|
-
RESPONSE_METHODS = {
|
301
|
-
:successful => 'success',
|
302
|
-
:server_error => 'error',
|
303
|
-
:not_found => 'missing'
|
304
|
-
}.freeze
|
305
|
-
end
|
292
|
+
RESPONSE_METHODS = {
|
293
|
+
:success => 'successful',
|
294
|
+
:error => 'server_error',
|
295
|
+
:missing => 'not_found'
|
296
|
+
}.freeze
|
306
297
|
|
307
298
|
def check_expected_status(test_response, expected)
|
308
299
|
test_response.send(
|
@@ -4,7 +4,7 @@ module RSpec
|
|
4
4
|
# Matcher for template rendering.
|
5
5
|
module RenderTemplate
|
6
6
|
# @private
|
7
|
-
class RenderTemplateMatcher < RSpec::Matchers::
|
7
|
+
class RenderTemplateMatcher < RSpec::Rails::Matchers::BaseMatcher
|
8
8
|
def initialize(scope, expected, message = nil)
|
9
9
|
@expected = Symbol === expected ? expected.to_s : expected
|
10
10
|
@message = message
|
@@ -6,7 +6,7 @@ module RSpec
|
|
6
6
|
extend RSpec::Matchers::DSL
|
7
7
|
|
8
8
|
# @private
|
9
|
-
class RouteToMatcher < RSpec::Matchers::
|
9
|
+
class RouteToMatcher < RSpec::Rails::Matchers::BaseMatcher
|
10
10
|
def initialize(scope, *expected)
|
11
11
|
@scope = scope
|
12
12
|
@expected = expected[1] || {}
|
@@ -63,7 +63,7 @@ module RSpec
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# @private
|
66
|
-
class BeRoutableMatcher < RSpec::Matchers::
|
66
|
+
class BeRoutableMatcher < RSpec::Rails::Matchers::BaseMatcher
|
67
67
|
def initialize(scope)
|
68
68
|
@scope = scope
|
69
69
|
end
|
data/lib/rspec/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chelimsky
|
@@ -44,7 +44,7 @@ cert_chain:
|
|
44
44
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
45
45
|
F3MdtaDehhjC
|
46
46
|
-----END CERTIFICATE-----
|
47
|
-
date: 2019-10-
|
47
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
48
48
|
dependencies:
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: activesupport
|
@@ -94,56 +94,56 @@ dependencies:
|
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 3.
|
97
|
+
version: 3.9.0
|
98
98
|
type: :runtime
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 3.
|
104
|
+
version: 3.9.0
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: rspec-expectations
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 3.
|
111
|
+
version: 3.9.0
|
112
112
|
type: :runtime
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 3.
|
118
|
+
version: 3.9.0
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: rspec-mocks
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 3.
|
125
|
+
version: 3.9.0
|
126
126
|
type: :runtime
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 3.
|
132
|
+
version: 3.9.0
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: rspec-support
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 3.
|
139
|
+
version: 3.9.0
|
140
140
|
type: :runtime
|
141
141
|
prerelease: false
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 3.
|
146
|
+
version: 3.9.0
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: cucumber
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,6 +205,8 @@ files:
|
|
205
205
|
- lib/generators/rspec/feature/feature_generator.rb
|
206
206
|
- lib/generators/rspec/feature/templates/feature_singular_spec.rb
|
207
207
|
- lib/generators/rspec/feature/templates/feature_spec.rb
|
208
|
+
- lib/generators/rspec/generators/generator_generator.rb
|
209
|
+
- lib/generators/rspec/generators/templates/generator_spec.rb
|
208
210
|
- lib/generators/rspec/helper/helper_generator.rb
|
209
211
|
- lib/generators/rspec/helper/templates/helper_spec.rb
|
210
212
|
- lib/generators/rspec/install/install_generator.rb
|
@@ -231,6 +233,8 @@ files:
|
|
231
233
|
- lib/generators/rspec/scaffold/templates/new_spec.rb
|
232
234
|
- lib/generators/rspec/scaffold/templates/routing_spec.rb
|
233
235
|
- lib/generators/rspec/scaffold/templates/show_spec.rb
|
236
|
+
- lib/generators/rspec/system/system_generator.rb
|
237
|
+
- lib/generators/rspec/system/templates/system_spec.rb
|
234
238
|
- lib/generators/rspec/view/templates/view_spec.rb
|
235
239
|
- lib/generators/rspec/view/view_generator.rb
|
236
240
|
- lib/rspec-rails.rb
|
@@ -258,9 +262,11 @@ files:
|
|
258
262
|
- lib/rspec/rails/fixture_support.rb
|
259
263
|
- lib/rspec/rails/matchers.rb
|
260
264
|
- lib/rspec/rails/matchers/active_job.rb
|
265
|
+
- lib/rspec/rails/matchers/base_matcher.rb
|
261
266
|
- lib/rspec/rails/matchers/be_a_new.rb
|
262
267
|
- lib/rspec/rails/matchers/be_new_record.rb
|
263
268
|
- lib/rspec/rails/matchers/be_valid.rb
|
269
|
+
- lib/rspec/rails/matchers/have_enqueued_mail.rb
|
264
270
|
- lib/rspec/rails/matchers/have_http_status.rb
|
265
271
|
- lib/rspec/rails/matchers/have_rendered.rb
|
266
272
|
- lib/rspec/rails/matchers/redirect_to.rb
|
@@ -278,7 +284,7 @@ licenses:
|
|
278
284
|
- MIT
|
279
285
|
metadata:
|
280
286
|
bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
|
281
|
-
changelog_uri: https://github.com/rspec/rspec-rails/blob/v3.
|
287
|
+
changelog_uri: https://github.com/rspec/rspec-rails/blob/v3.9.0/Changelog.md
|
282
288
|
documentation_uri: https://rspec.info/documentation/
|
283
289
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
284
290
|
source_code_uri: https://github.com/rspec/rspec-rails
|
metadata.gz.sig
CHANGED
Binary file
|