rspec-parameterized-table-syntax-1.0.1/0000775000175000017500000000000014525750046017102 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/CHANGELOG.md0000644000175000017500000000106514525750046020713 0ustar lucaslucas## [Unreleased] [full changelog](https://github.com/rspec-parameterized/rspec-parameterized-table_syntax/compare/v1.0.1...main) ## [1.0.1] - 2023-09-26 [full changelog](https://github.com/rspec-parameterized/rspec-parameterized-table_syntax/compare/v1.0.0...v1.0.1) - Suppress unnecessary deprecation warning for Ruby v3.1. - https://github.com/rspec-parameterized/rspec-parameterized-table_syntax/pull/7 ## [1.0.0] - 2022-12-31 - https://github.com/tomykaira/rspec-parameterized/blob/master/CHANGELOG.md#v100-2022-12-31 - Drop support Ruby < 2.6 (explicitly) rspec-parameterized-table-syntax-1.0.1/lib/0000775000175000017500000000000014525750046017650 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/lib/rspec-parameterized-table_syntax.rb0000644000175000017500000000005314525750046026632 0ustar lucaslucasrequire "rspec/parameterized/table_syntax" rspec-parameterized-table-syntax-1.0.1/lib/rspec/0000775000175000017500000000000014525750046020764 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/lib/rspec/parameterized/0000775000175000017500000000000014525750046023620 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/lib/rspec/parameterized/table_syntax/0000775000175000017500000000000014525750046026315 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/lib/rspec/parameterized/table_syntax/table.rb0000644000175000017500000000164414525750046027734 0ustar lucaslucasmodule RSpec module Parameterized module TableSyntax class Table attr_reader :last_row def initialize @rows = [] @last_row = nil end def add_row(row) unless @rows.find {|r| r.object_id == row.object_id} @rows << row @last_row = row end self end def add_param_to_last_row(param) last_row.add_param(param) self end alias :| :add_param_to_last_row def to_a @rows.map(&:to_a) end alias :to_params :to_a class Row def initialize(param) @params = [param] end def add_param(param) @params << param end def to_a @params end def to_params [@params] end end end end end end ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootrspec-parameterized-table-syntax-1.0.1/lib/rspec/parameterized/table_syntax/table_syntax_implement.rbrspec-parameterized-table-syntax-1.0.1/lib/rspec/parameterized/table_syntax/table_syntax_implement.r0000644000175000017500000000140414525750046033244 0ustar lucaslucasmodule RSpec module Parameterized module TableSyntax module TableSyntaxImplement def |(other) where_binding = binding.of_caller(1) # get where block binding caller_instance = eval("self", where_binding) # get caller instance (ExampleGroup) if caller_instance.instance_variable_defined?(:@__parameter_table) table = caller_instance.instance_variable_get(:@__parameter_table) else table = RSpec::Parameterized::TableSyntax::Table.new caller_instance.instance_variable_set(:@__parameter_table, table) end row = Table::Row.new(self) table.add_row(row) row.add_param(other) table end end end end end rspec-parameterized-table-syntax-1.0.1/lib/rspec/parameterized/table_syntax/version.rb0000644000175000017500000000020414525750046030321 0ustar lucaslucas# frozen_string_literal: true module Rspec module Parameterized module TableSyntax VERSION = "1.0.1" end end end rspec-parameterized-table-syntax-1.0.1/lib/rspec/parameterized/table_syntax.rb0000644000175000017500000000261014525750046026637 0ustar lucaslucas# frozen_string_literal: true require "rspec/parameterized/table_syntax/version" require 'rspec/parameterized/table_syntax/table' require 'rspec/parameterized/table_syntax/table_syntax_implement' require "rspec/parameterized/core" require 'binding_of_caller' module RSpec module Parameterized module TableSyntax if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.1.0') refine Object do import_methods TableSyntaxImplement end refine Integer do import_methods TableSyntaxImplement end refine Array do import_methods TableSyntaxImplement end refine NilClass do import_methods TableSyntaxImplement end refine TrueClass do import_methods TableSyntaxImplement end refine FalseClass do import_methods TableSyntaxImplement end else refine Object do include TableSyntaxImplement end refine Integer do include TableSyntaxImplement end refine Array do include TableSyntaxImplement end refine NilClass do include TableSyntaxImplement end refine TrueClass do include TableSyntaxImplement end refine FalseClass do include TableSyntaxImplement end end end end end rspec-parameterized-table-syntax-1.0.1/.rspec0000644000175000017500000000006514525750046020216 0ustar lucaslucas--format documentation --color --require spec_helper rspec-parameterized-table-syntax-1.0.1/sig/0000775000175000017500000000000014525750046017664 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/sig/rspec/0000775000175000017500000000000014525750046021000 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/sig/rspec/parameterized/0000775000175000017500000000000014525750046023634 5ustar lucaslucasrspec-parameterized-table-syntax-1.0.1/sig/rspec/parameterized/table_syntax.rbs0000644000175000017500000000025414525750046027040 0ustar lucaslucasmodule Rspec module Parameterized module TableSyntax VERSION: String # See the writing guide of rbs: https://github.com/ruby/rbs#guides end end end rspec-parameterized-table-syntax-1.0.1/Rakefile0000644000175000017500000000022414525750046020543 0ustar lucaslucas# frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) task default: %i[spec] rspec-parameterized-table-syntax-1.0.1/README.md0000644000175000017500000000356014525750046020363 0ustar lucaslucas# Rspec::Parameterized::TableSyntax `rspec-parameterized-table_syntax` provides table syntax extension for [rspec-parameterized](https://github.com/tomykaira/rspec-parameterized). [![Gem Version](https://badge.fury.io/rb/rspec-parameterized-table_syntax.svg)](https://badge.fury.io/rb/rspec-parameterized-table_syntax) [![RSpec](https://github.com/rspec-parameterized/rspec-parameterized-table_syntax/actions/workflows/rspec.yml/badge.svg)](https://github.com/rspec-parameterized/rspec-parameterized-table_syntax/actions/workflows/rspec.yml) ## Installation ```ruby # Install all components group :test do gem "rspec-parameterized", ">= 1.0.0" end # Install only rspec-parameterized-table_syntax group :test do gem "rspec-parameterized-table_syntax", ">= 1.0.0" end ``` ## Usage ### Table Syntax Style (like Groovy spock) ```ruby describe "plus" do using RSpec::Parameterized::TableSyntax where(:a, :b, :answer) do 1 | 2 | 3 5 | 8 | 13 0 | 0 | 0 end with_them do it "should do additions" do expect(a + b).to eq answer end end end ``` ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/rspec-parameterized/rspec-parameterized-table_syntax. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). rspec-parameterized-table-syntax-1.0.1/rspec-parameterized-table_syntax.gemspec0000644000175000017500000000342614525750046027113 0ustar lucaslucas# frozen_string_literal: true require_relative "lib/rspec/parameterized/table_syntax/version" Gem::Specification.new do |spec| spec.name = "rspec-parameterized-table_syntax" spec.version = Rspec::Parameterized::TableSyntax::VERSION spec.authors = ["sue445", "tomykaira", "joker1007"] spec.email = ["sue445@sue445.net", "tomykaira@gmail.com"] spec.description = %q{RSpec::Parameterized supports simple parameterized test syntax in rspec.} spec.summary = %q{RSpec::Parameterized supports simple parameterized test syntax in rspec. I was inspired by [udzura's mock](https://gist.github.com/1881139).} spec.homepage = "https://github.com/rspec-parameterized/rspec-parameterized-table_syntax" spec.license = "MIT" spec.required_ruby_version = ">= 2.6.0" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md" spec.metadata["rubygems_mfa_required"] = "true" # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. spec.files = Dir.chdir(__dir__) do `git ls-files -z`.split("\x0").reject do |f| (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)}) end end spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_dependency "binding_of_caller" spec.add_dependency "rspec-parameterized-core", "< 2" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" # For more information and examples about making a new gem, check out our # guide at: https://bundler.io/guides/creating_gem.html end rspec-parameterized-table-syntax-1.0.1/LICENSE.txt0000644000175000017500000000206114525750046020722 0ustar lucaslucasThe MIT License (MIT) Copyright (c) 2022 sue445 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. rspec-parameterized-table-syntax-1.0.1/Gemfile0000644000175000017500000000022414525750046020371 0ustar lucaslucas# frozen_string_literal: true source "https://rubygems.org" # Specify your gem's dependencies in rspec-parameterized-table_syntax.gemspec gemspec