From 9b748da6b710aff66bd2698acfe47d73dc51a312 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 2 Aug 2023 18:53:51 +0200 Subject: [PATCH] Fix typos in readme and correct name --- README.md | 50 ++++++++++----------- httprb_rspec.gemspec | 14 +++--- lib/http/rspec.rb | 3 ++ lib/{httprb_rspec => http_rspec}/version.rb | 2 +- 4 files changed, 35 insertions(+), 34 deletions(-) create mode 100644 lib/http/rspec.rb rename lib/{httprb_rspec => http_rspec}/version.rb (74%) diff --git a/README.md b/README.md index bf28004..a914433 100644 --- a/README.md +++ b/README.md @@ -9,40 +9,38 @@ ## About HTTP (The Gem! a.k.a. http.rb) is an easy-to-use client library for making requests -from Ruby. Behaviour Driven Development for Ruby. Making TDD Productive and Fun. +from Ruby. RSpec is a Behaviour Driven Development spec libary for Ruby. Making TDD +Productive and Fun. This gem adds custom matchers to make it easier to check http requests. ## Installation -Add the gem you you gemfile - +Add the gem to your gemfile with bundler ```bash -$ bunlde add httprb_rspec +$ bunlde add http_rspec ``` Inside of your spec helper (default spec_helper.rb): - ```ruby -require "http/support/rspec_matchers" +require "http/rspec" ``` -Now you have to include the matchers you wand for the blocks you want - +Now you have to include the matchers you want for the blocks you want ```ruby # in spec_helper.rb to include matchers everywhere RSpec.configure do |config| - config.include HTTP::Support::RspecMatches + config.include HTTP::Support::RspecMatchers end # in spec_helper.rb to include where the type is service RSpec.configure do |config| - config.include HTTP::Support::RspecMatches, type: :service + config.include HTTP::Support::RspecMatchers, type: :service end # in the individual describe blocks RSpec.describe Service do - include HTTP::Support::RspecMatches + include HTTP::Support::RspecMatchers it "makes request" do expect(response).to have_httprb_status(200) @@ -55,7 +53,7 @@ end Most things are documented here in the readme The following API documentation is also available: -- [YARD API documentation](https://www.rubydoc.info/github/httprb/httprb_rspec) +- [YARD API documentation](https://www.rubydoc.info/github/httprb/http_rspec) ### Basic Usage @@ -64,16 +62,16 @@ Here's some simple examples to get you started: ```ruby it "has successful response" do response = HTTP.get("www.nrk.no") - expect(response).to have_http_status(:success) # will match 2xx status code - expect(response).to have_http_status(:redirect) # will match 3xx status code - expect(response).to have_http_status(:error) # will match 3xx status code + expect(response).to have_httprb_status(:success) # will match 2xx status code + expect(response).to have_httprb_status(:redirect) # will match 3xx status code + expect(response).to have_httprb_status(:error) # will match 3xx status code - expect(response).to have_http_status(:ok) # require 200 status code - expect(response).to have_http_status(200) # require 200 status code - expect(response).to have_http_status(:not_found) # require 404 status code - expect(response).to have_http_status(404) # require 404 status code + expect(response).to have_httprb_status(:ok) # require 200 status code + expect(response).to have_httprb_status(200) # require 200 status code + expect(response).to have_httprb_status(:not_found) # require 404 status code + expect(response).to have_httprb_status(404) # require 404 status code - # you can access HTTP::Support::RspecMatches::STATUS_CODE_TO_SYMBOL to see the full + # you can access HTTP::Support::RspecMatchers::STATUS_CODE_TO_SYMBOL to see the full # mapping between code and symbol end ``` @@ -101,7 +99,7 @@ exist at the time of a major release, support for that Ruby version may be dropped. -## Contributing to http.rb +## Contributing to http.rb rspec - Fork http.rb on GitHub - Make your changes @@ -120,14 +118,14 @@ See LICENSE.txt for further details. [//]: # (badges) [gem-image]: https://img.shields.io/gem/v/httprb_status?logo=ruby -[gem-link]: https://rubygems.org/gems/httprb_rspec +[gem-link]: https://rubygems.org/gems/http_rspec [license-image]: https://img.shields.io/badge/license-MIT-blue.svg -[license-link]: https://github.com/httprb/httprb_rspec/blob/main/LICENSE.txt -[build-image]: https://github.com/httprb/httprb_rspec/workflows/CI/badge.svg -[build-link]: https://github.com/httprb/httprb_rspec/actions/workflows/ci.yml +[license-link]: https://github.com/httprb/http_rspec/blob/main/LICENSE.txt +[build-image]: https://github.com/httprb/http_rspec/workflows/CI/badge.svg +[build-link]: https://github.com/httprb/http_rspec/actions/workflows/ci.yml [//]: # (links) -[documentation]: https://github.com/httprb/httprb_rspec/wiki +[documentation]: https://github.com/httprb/http_rspec/wiki [requests]: https://docs.python-requests.org/en/latest/ [llhttp]: https://llhttp.org/ diff --git a/httprb_rspec.gemspec b/httprb_rspec.gemspec index d458006..94e121f 100644 --- a/httprb_rspec.gemspec +++ b/httprb_rspec.gemspec @@ -2,7 +2,7 @@ lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require "httprb_rspec/version" +require "http_rspec/version" Gem::Specification.new do |gem| gem.authors = ["Simon Toivo Telhaug"] @@ -13,23 +13,23 @@ Gem::Specification.new do |gem| DESCRIPTION gem.summary = "HTTP Rspec matchers" - gem.homepage = "https://github.com/httprb/httprb_rspec" + gem.homepage = "https://github.com/httprb/http-rspec" gem.licenses = ["MIT"] gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } gem.files = `git ls-files`.split("\n") - gem.name = "httprb_rspec" + gem.name = "http-rspec" gem.require_paths = ["lib"] - gem.version = HttprbRspec::VERSION + gem.version = HttpRspec::VERSION gem.required_ruby_version = ">= 3.0" gem.add_runtime_dependency "http", ">= 4.0" gem.metadata = { - "source_code_uri" => "https://github.com/httprb/httprb_rspec", - "bug_tracker_uri" => "https://github.com/httprb/httprb_rspec/issues", - "changelog_uri" => "https://github.com/httprb/httprb_rspec/blob/v#{HttprbRspec::VERSION}/CHANGES.md", + "source_code_uri" => "https://github.com/httprb/http-rspec", + "bug_tracker_uri" => "https://github.com/httprb/http-rspec/issues", + "changelog_uri" => "https://github.com/httprb/http-rspec/blob/v#{HttpRspec::VERSION}/CHANGES.md", "rubygems_mfa_required" => "true" } diff --git a/lib/http/rspec.rb b/lib/http/rspec.rb new file mode 100644 index 0000000..3627a0c --- /dev/null +++ b/lib/http/rspec.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require_relative "support/support/matchers" diff --git a/lib/httprb_rspec/version.rb b/lib/http_rspec/version.rb similarity index 74% rename from lib/httprb_rspec/version.rb rename to lib/http_rspec/version.rb index 7fae04a..6b7dc2e 100644 --- a/lib/httprb_rspec/version.rb +++ b/lib/http_rspec/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module HttprbRspec +module HttpRspec VERSION = "0.1.0" end