From e5eb44191c21f8af81b007421cfd9107d3faf6de Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Fri, 21 Sep 2018 17:31:28 +0700 Subject: [PATCH] Use RSpec.describe to fix IRB context warning in Rails console --- .../spec/generators/rswag/specs/install_generator_spec.rb | 2 +- rswag-specs/spec/rswag/specs/configuration_spec.rb | 2 +- rswag-specs/spec/rswag/specs/example_group_helpers_spec.rb | 2 +- rswag-specs/spec/rswag/specs/example_helpers_spec.rb | 4 ++-- rswag-specs/spec/rswag/specs/request_factory_spec.rb | 4 ++-- rswag-specs/spec/rswag/specs/response_validator_spec.rb | 4 ++-- rswag-specs/spec/rswag/specs/swagger_formatter_spec.rb | 6 +++--- test-app/spec/features/swagger_ui_spec.rb | 2 +- test-app/spec/integration/auth_tests_spec.rb | 2 +- test-app/spec/integration/blogs_spec.rb | 2 +- test-app/spec/rake/rswag_specs_swaggerize_spec.rb | 4 ++-- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/rswag-specs/spec/generators/rswag/specs/install_generator_spec.rb b/rswag-specs/spec/generators/rswag/specs/install_generator_spec.rb index 39dc6fe..809e4f6 100644 --- a/rswag-specs/spec/generators/rswag/specs/install_generator_spec.rb +++ b/rswag-specs/spec/generators/rswag/specs/install_generator_spec.rb @@ -4,7 +4,7 @@ require 'generators/rswag/specs/install/install_generator' module Rswag module Specs - describe InstallGenerator do + RSpec.describe InstallGenerator do include GeneratorSpec::TestCase destination File.expand_path('../tmp', __FILE__) diff --git a/rswag-specs/spec/rswag/specs/configuration_spec.rb b/rswag-specs/spec/rswag/specs/configuration_spec.rb index b75d843..30da333 100644 --- a/rswag-specs/spec/rswag/specs/configuration_spec.rb +++ b/rswag-specs/spec/rswag/specs/configuration_spec.rb @@ -3,7 +3,7 @@ require 'rswag/specs/configuration' module Rswag module Specs - describe Configuration do + RSpec.describe Configuration do subject { described_class.new(rspec_config) } let(:rspec_config) { OpenStruct.new(swagger_root: swagger_root, swagger_docs: swagger_docs) } diff --git a/rswag-specs/spec/rswag/specs/example_group_helpers_spec.rb b/rswag-specs/spec/rswag/specs/example_group_helpers_spec.rb index c870bfc..ed667ca 100644 --- a/rswag-specs/spec/rswag/specs/example_group_helpers_spec.rb +++ b/rswag-specs/spec/rswag/specs/example_group_helpers_spec.rb @@ -3,7 +3,7 @@ require 'rswag/specs/example_group_helpers' module Rswag module Specs - describe ExampleGroupHelpers do + RSpec.describe ExampleGroupHelpers do subject { double('example_group') } before do diff --git a/rswag-specs/spec/rswag/specs/example_helpers_spec.rb b/rswag-specs/spec/rswag/specs/example_helpers_spec.rb index 3b22af4..283d4fd 100644 --- a/rswag-specs/spec/rswag/specs/example_helpers_spec.rb +++ b/rswag-specs/spec/rswag/specs/example_helpers_spec.rb @@ -3,7 +3,7 @@ require 'rswag/specs/example_helpers' module Rswag module Specs - describe ExampleHelpers do + RSpec.describe ExampleHelpers do subject { double('example') } before do @@ -12,7 +12,7 @@ module Rswag allow(config).to receive(:get_swagger_doc).and_return(swagger_doc) stub_const('Rswag::Specs::RAILS_VERSION', 3) end - let(:config) { double('config') } + let(:config) { double('config') } let(:swagger_doc) do { securityDefinitions: { diff --git a/rswag-specs/spec/rswag/specs/request_factory_spec.rb b/rswag-specs/spec/rswag/specs/request_factory_spec.rb index f883952..0a70f19 100644 --- a/rswag-specs/spec/rswag/specs/request_factory_spec.rb +++ b/rswag-specs/spec/rswag/specs/request_factory_spec.rb @@ -3,13 +3,13 @@ require 'rswag/specs/request_factory' module Rswag module Specs - describe RequestFactory do + RSpec.describe RequestFactory do subject { RequestFactory.new(config) } before do allow(config).to receive(:get_swagger_doc).and_return(swagger_doc) end - let(:config) { double('config') } + let(:config) { double('config') } let(:swagger_doc) { {} } let(:example) { double('example') } let(:metadata) do diff --git a/rswag-specs/spec/rswag/specs/response_validator_spec.rb b/rswag-specs/spec/rswag/specs/response_validator_spec.rb index 1d05427..9f52b5b 100644 --- a/rswag-specs/spec/rswag/specs/response_validator_spec.rb +++ b/rswag-specs/spec/rswag/specs/response_validator_spec.rb @@ -3,13 +3,13 @@ require 'rswag/specs/response_validator' module Rswag module Specs - describe ResponseValidator do + RSpec.describe ResponseValidator do subject { ResponseValidator.new(config) } before do allow(config).to receive(:get_swagger_doc).and_return(swagger_doc) end - let(:config) { double('config') } + let(:config) { double('config') } let(:swagger_doc) { {} } let(:example) { double('example') } let(:metadata) do diff --git a/rswag-specs/spec/rswag/specs/swagger_formatter_spec.rb b/rswag-specs/spec/rswag/specs/swagger_formatter_spec.rb index f904fa5..b5b7ad8 100644 --- a/rswag-specs/spec/rswag/specs/swagger_formatter_spec.rb +++ b/rswag-specs/spec/rswag/specs/swagger_formatter_spec.rb @@ -3,8 +3,8 @@ require 'ostruct' module Rswag module Specs - - describe SwaggerFormatter do + + RSpec.describe SwaggerFormatter do subject { described_class.new(output, config) } # Mock out some infrastructure @@ -47,7 +47,7 @@ module Rswag end describe '#stop' do - before do + before do FileUtils.rm_r(swagger_root) if File.exists?(swagger_root) allow(config).to receive(:swagger_docs).and_return( 'v1/swagger.json' => { info: { version: 'v1' } }, diff --git a/test-app/spec/features/swagger_ui_spec.rb b/test-app/spec/features/swagger_ui_spec.rb index 7faa14e..24d5790 100644 --- a/test-app/spec/features/swagger_ui_spec.rb +++ b/test-app/spec/features/swagger_ui_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'swagger-ui', js: true do +RSpec.feature 'swagger-ui', js: true do scenario 'browsing api-docs' do visit '/api-docs' diff --git a/test-app/spec/integration/auth_tests_spec.rb b/test-app/spec/integration/auth_tests_spec.rb index 8e47d2e..573219e 100644 --- a/test-app/spec/integration/auth_tests_spec.rb +++ b/test-app/spec/integration/auth_tests_spec.rb @@ -1,6 +1,6 @@ require 'swagger_helper' -describe 'Auth Tests API', type: :request, swagger_doc: 'v1/swagger.json' do +RSpec.describe 'Auth Tests API', type: :request, swagger_doc: 'v1/swagger.json' do path '/auth-tests/basic' do post 'Authenticates with basic auth' do diff --git a/test-app/spec/integration/blogs_spec.rb b/test-app/spec/integration/blogs_spec.rb index abca570..28ee892 100644 --- a/test-app/spec/integration/blogs_spec.rb +++ b/test-app/spec/integration/blogs_spec.rb @@ -1,6 +1,6 @@ require 'swagger_helper' -describe 'Blogs API', type: :request, swagger_doc: 'v1/swagger.json' do +RSpec.describe 'Blogs API', type: :request, swagger_doc: 'v1/swagger.json' do let(:api_key) { 'fake_key' } path '/blogs' do diff --git a/test-app/spec/rake/rswag_specs_swaggerize_spec.rb b/test-app/spec/rake/rswag_specs_swaggerize_spec.rb index 0a590ee..27fc195 100644 --- a/test-app/spec/rake/rswag_specs_swaggerize_spec.rb +++ b/test-app/spec/rake/rswag_specs_swaggerize_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' require 'rake' -describe 'rswag:specs:swaggerize' do +RSpec.describe 'rswag:specs:swaggerize' do let(:swagger_root) { Rails.root.to_s + '/swagger' } - before do + before do TestApp::Application.load_tasks FileUtils.rm_r(swagger_root) if File.exists?(swagger_root) end