├── .rspec ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── spec ├── assets │ ├── symlink.txt │ ├── file.txt │ └── file2.txt ├── support │ ├── models │ │ ├── job_offer.rb │ │ ├── people │ │ │ └── actor.rb │ │ ├── machinist_model.rb │ │ ├── uuid_user.rb │ │ ├── opera.rb │ │ ├── user.rb │ │ ├── payment.rb │ │ ├── plain_ruby_class.rb │ │ └── movie.rb │ ├── uploaders │ │ └── attachment_uploader.rb │ ├── database.sample.yml │ ├── database.github.yml │ ├── database.rb │ ├── factories │ │ └── factories.rb │ └── cucumber_helper.rb ├── spec_helper.rb └── cucumber_factory │ ├── factory │ └── build_strategy_spec.rb │ └── steps_spec.rb ├── lib ├── cucumber_factory │ ├── add_steps.rb │ ├── version.rb │ ├── update_strategy.rb │ ├── switcher.rb │ ├── build_strategy.rb │ └── factory.rb └── cucumber_factory.rb ├── .gitignore ├── Rakefile ├── Gemfile.cucumber-3.1 ├── Gemfile.cucumber-3.0 ├── Gemfile.rails-8 ├── Gemfile.cucumber-10.1 ├── Gemfile.cucumber-4.1 ├── Gemfile.cucumber-5.3 ├── Gemfile.cucumber-1.3 ├── Gemfile.cucumber-2.4 ├── Gemfile.rails-7 ├── LICENSE ├── cucumber_factory.gemspec ├── Gemfile.cucumber-1.3.lock ├── Gemfile.cucumber-2.4.lock ├── .github └── workflows │ └── test.yml ├── Gemfile.cucumber-3.1.lock ├── Gemfile.cucumber-3.0.lock ├── Gemfile.rails-7.lock ├── media ├── logo.light.text.svg ├── logo.dark.text.svg ├── makandra-with-bottom-margin.dark.svg ├── makandra-with-bottom-margin.light.svg ├── logo.light.shapes.svg └── logo.dark.shapes.svg ├── Gemfile.cucumber-5.3.lock ├── Gemfile.cucumber-4.1.lock ├── Gemfile.rails-8.lock ├── Gemfile.cucumber-10.1.lock ├── CHANGELOG.md └── README.md /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.4.1 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | Gemfile.rails-8 -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | Gemfile.rails-8.lock -------------------------------------------------------------------------------- /spec/assets/symlink.txt: -------------------------------------------------------------------------------- 1 | file.txt -------------------------------------------------------------------------------- /spec/assets/file.txt: -------------------------------------------------------------------------------- 1 | This is a test file. 2 | -------------------------------------------------------------------------------- /spec/assets/file2.txt: -------------------------------------------------------------------------------- 1 | This is the second test file. 2 | -------------------------------------------------------------------------------- /lib/cucumber_factory/add_steps.rb: -------------------------------------------------------------------------------- 1 | CucumberFactory::Factory.add_steps(self) 2 | -------------------------------------------------------------------------------- /spec/support/models/job_offer.rb: -------------------------------------------------------------------------------- 1 | class JobOffer < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /lib/cucumber_factory/version.rb: -------------------------------------------------------------------------------- 1 | module CucumberFactory 2 | VERSION = '2.7.0' 3 | end 4 | -------------------------------------------------------------------------------- /spec/support/models/people/actor.rb: -------------------------------------------------------------------------------- 1 | module People 2 | class Actor < ActiveRecord::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /spec/support/models/machinist_model.rb: -------------------------------------------------------------------------------- 1 | class MachinistModel 2 | 3 | def self.make 4 | end 5 | 6 | end 7 | -------------------------------------------------------------------------------- /spec/support/models/uuid_user.rb: -------------------------------------------------------------------------------- 1 | class UuidUser < ActiveRecord::Base 2 | 3 | self.primary_key = 'id' 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/support/uploaders/attachment_uploader.rb: -------------------------------------------------------------------------------- 1 | class AttachmentUploader < CarrierWave::Uploader::Base 2 | storage :file 3 | end 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | doc 2 | pkg 3 | *.gem 4 | .bundle 5 | .idea 6 | .rvmrc 7 | log/*.log 8 | spec/support/database.yml 9 | uploads/ 10 | -------------------------------------------------------------------------------- /spec/support/models/opera.rb: -------------------------------------------------------------------------------- 1 | class Opera < ActiveRecord::Base 2 | has_many :movies, as: :premiere_site, inverse_of: :premiere_site 3 | end 4 | -------------------------------------------------------------------------------- /spec/support/database.sample.yml: -------------------------------------------------------------------------------- 1 | postgres: 2 | database: cucumber_factory_test 3 | host: localhost 4 | username: postgres 5 | password: postgres 6 | -------------------------------------------------------------------------------- /spec/support/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | 3 | has_many :reviewed_movies, :class_name => 'Movie', :foreign_key => 'reviewer_id' 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/support/database.github.yml: -------------------------------------------------------------------------------- 1 | postgresql: 2 | database: cucumber_factory_test 3 | host: localhost 4 | username: postgres 5 | password: postgres 6 | port: 5432 7 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | require 'bundler/gem_tasks' 3 | 4 | begin 5 | require 'gemika/tasks' 6 | rescue LoadError 7 | puts 'Run `gem install gemika` for additional tasks' 8 | end 9 | 10 | task :default => 'matrix:spec' 11 | -------------------------------------------------------------------------------- /spec/support/models/payment.rb: -------------------------------------------------------------------------------- 1 | class Payment < ActiveRecord::Base 2 | class AttachmentUploader < CarrierWave::Uploader::Base 3 | storage :file 4 | end 5 | 6 | mount_uploader :attachment, AttachmentUploader 7 | 8 | if ActiveRecord::VERSION::MAJOR <= 3 9 | # Only the comment is accessible, amount isn't 10 | attr_accessible :comment 11 | end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /spec/support/models/plain_ruby_class.rb: -------------------------------------------------------------------------------- 1 | class PlainRubyClass 2 | def initialize(attributes) 3 | @attributes = attributes 4 | self.class.last = self 5 | end 6 | 7 | attr_reader :attributes 8 | 9 | def self.last 10 | @last 11 | end 12 | 13 | def self.last=(instance) 14 | @last = instance 15 | end 16 | 17 | def self.reset 18 | @last = nil 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/support/models/movie.rb: -------------------------------------------------------------------------------- 1 | class Movie < ActiveRecord::Base 2 | 3 | belongs_to :prequel, :class_name => "Movie" 4 | belongs_to :reviewer, :class_name => "User" 5 | belongs_to :uuid_reviewer, :class_name => "UuidUser" 6 | belongs_to :premiere_site, polymorphic: true, required: false 7 | 8 | validate do |record| 9 | record.errors.add(:reviewer, 'may not be deleted') if record.reviewer and record.reviewer.deleted? 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /Gemfile.cucumber-3.1: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 3.1.0' 5 | gem 'activesupport', '~> 5.1.0' 6 | gem 'activerecord', '~> 5.1.0' 7 | gem 'pg' 8 | 9 | # Development dependencies 10 | gem 'rspec', '~> 3.0' 11 | gem 'rake' 12 | gem 'database_cleaner' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot' 17 | gem 'carrierwave' 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.cucumber-3.0: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 3.0.0' 5 | gem 'activesupport', '~> 5.0.0' 6 | gem 'activerecord', '~> 5.0.0' 7 | gem 'pg', ' < 1' 8 | 9 | # Development dependencies 10 | gem 'rspec', '~> 3.0' 11 | gem 'rake' 12 | gem 'database_cleaner' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot' 17 | gem 'carrierwave' 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.rails-8: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 9.2.1' 5 | gem 'activesupport', '~> 8.0.0' 6 | gem 'activerecord', '~> 8.0.0' 7 | gem 'pg', '> 1.2.3' 8 | 9 | # Development dependencies 10 | gem 'rspec', '~> 3.0' 11 | gem 'rake', '> 10.0' 12 | gem 'database_cleaner' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot' 17 | gem 'carrierwave' 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.cucumber-10.1: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 10.1.0' 5 | gem 'activesupport', '~> 8.0.0' 6 | gem 'activerecord', '~> 8.0.0' 7 | gem 'pg', '> 1.2.3' 8 | 9 | # Development dependencies 10 | gem 'rspec', '~> 3.0' 11 | gem 'rake', '> 10.0' 12 | gem 'database_cleaner' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot' 17 | gem 'carrierwave' 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.cucumber-4.1: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 4.1.0' 5 | gem 'activesupport', '~> 6.0.0' 6 | gem 'activerecord', '~> 6.0.0' 7 | gem 'pg', '> 1.2.3' 8 | 9 | # Development dependencies 10 | gem 'rspec', '~> 3.0' 11 | gem 'rake', '> 10.0' 12 | gem 'database_cleaner' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot' 17 | gem 'carrierwave' 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.cucumber-5.3: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 5.3.0' 5 | gem 'activesupport', '~> 6.1.0' 6 | gem 'activerecord', '~> 6.1.0' 7 | gem 'pg', '> 1.2.3' 8 | 9 | # Development dependencies 10 | gem 'rspec', '~> 3.0' 11 | gem 'rake', '> 10.0' 12 | gem 'database_cleaner' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot' 17 | gem 'carrierwave' 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.cucumber-1.3: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 1.3.20' 5 | gem 'activesupport', '~> 4.2.0' 6 | gem 'activerecord', '~> 4.2.0' 7 | gem 'pg', ' < 1' 8 | 9 | # Development dependencies 10 | gem 'rspec', '> 3.0' 11 | gem 'rake', '>=10.0.4' 12 | gem 'database_cleaner', '~>1.0.0' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot', '< 5' 17 | gem 'carrierwave', '~> 1.0' 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.cucumber-2.4: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Runtime dependencies 4 | gem 'cucumber', '~> 2.4.0' 5 | gem 'activesupport', '~> 4.2.0' 6 | gem 'activerecord', '~> 4.2.0' 7 | gem 'pg', ' < 1' 8 | 9 | # Development dependencies 10 | gem 'rspec', '~> 3.0' 11 | gem 'rake' 12 | gem 'database_cleaner' 13 | gem 'gemika', '>= 0.8.1' 14 | 15 | # Test dependencies 16 | gem 'factory_bot', '< 5' # 5.0 requires Ruby >= 2.3 17 | gem 'carrierwave', '~> 1.0' # 2.0 requires Rails >= 5 and Ruby >= 2.2 18 | 19 | # Gem under test 20 | gem 'cucumber_factory', :path => '.' 21 | -------------------------------------------------------------------------------- /Gemfile.rails-7: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Former standard gems, see https://stdgems.org/ 4 | gem 'bigdecimal' # Bundled gem since Ruby 3.4 5 | gem 'mutex_m' # Bundled gem since Ruby 3.4 6 | gem 'base64' # Bundled gem since Ruby 3.4 7 | gem 'logger' # Default gem since Ruby 3.4 8 | 9 | # Runtime dependencies 10 | gem 'cucumber', '~> 9.2.1' 11 | gem 'activesupport', '~> 7.0.1' 12 | gem 'activerecord', '~> 7.0.1' 13 | gem 'pg', '> 1.2.3' 14 | 15 | # Development dependencies 16 | gem 'rspec', '~> 3.0' 17 | gem 'rake', '> 10.0' 18 | gem 'database_cleaner' 19 | gem 'gemika', '>= 0.8.1' 20 | 21 | # Test dependencies 22 | gem 'factory_bot' 23 | gem 'carrierwave' 24 | 25 | # Gem under test 26 | gem 'cucumber_factory', :path => '.' 27 | -------------------------------------------------------------------------------- /lib/cucumber_factory/update_strategy.rb: -------------------------------------------------------------------------------- 1 | module CucumberFactory 2 | 3 | class UpdateStrategy 4 | 5 | def initialize(record) 6 | @record = record 7 | end 8 | 9 | def assign_attributes(attributes) 10 | active_record_strategy(attributes) || 11 | ruby_object_strategy(attributes) 12 | end 13 | 14 | private 15 | 16 | def active_record_strategy(attributes) 17 | return unless @record.respond_to?(:save!) 18 | 19 | CucumberFactory::Switcher.assign_attributes(@record, attributes) 20 | @record.save! 21 | end 22 | 23 | def ruby_object_strategy(attributes) 24 | attributes.each do |name, value| 25 | @record.send("#{name}=".to_sym, value) 26 | end 27 | end 28 | 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/cucumber_factory.rb: -------------------------------------------------------------------------------- 1 | # Runtime dependencies 2 | require 'active_support/all' 3 | require 'active_record' 4 | 5 | require 'cucumber' 6 | if Gem::Version.new(Cucumber::VERSION) >= Gem::Version.new('3.0') 7 | require 'cucumber/glue/registry_and_more' 8 | else 9 | require 'cucumber/rb_support/rb_language' 10 | end 11 | 12 | require 'cucumber_priority' 13 | 14 | # Gem 15 | require 'cucumber_factory/build_strategy' 16 | require 'cucumber_factory/update_strategy' 17 | require 'cucumber_factory/factory' 18 | require 'cucumber_factory/switcher' 19 | 20 | module Cucumber 21 | module Factory 22 | module_function 23 | 24 | def add_steps(main) 25 | warn "Using `Cucumber::Factory.add_steps(self)` is deprecated. Use `require 'cucumber_factory/add_steps'` instead." 26 | 27 | add_steps_filepath = File.join(File.dirname(__FILE__), 'cucumber_factory/add_steps.rb') 28 | main.instance_eval(File.read(add_steps_filepath)) 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $: << File.join(File.dirname(__FILE__), "/../../lib" ) 2 | 3 | require 'logger' 4 | require 'cucumber_factory' 5 | require 'gemika' 6 | require 'factory_bot' 7 | require 'carrierwave' 8 | require 'carrierwave/orm/activerecord' 9 | 10 | if ActiveRecord.respond_to?(:default_timezone=) 11 | ActiveRecord.default_timezone = :local 12 | else 13 | # Legacy method that was removed in Rails 7.1: 14 | ActiveRecord::Base.default_timezone = :local 15 | end 16 | 17 | Dir["#{File.dirname(__FILE__)}/support/uploaders/*.rb"].sort.each {|f| require f} 18 | Dir["#{File.dirname(__FILE__)}/support/models/*.rb"].sort.each {|f| require f} 19 | Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each {|f| require f} 20 | Dir["#{File.dirname(__FILE__)}/shared_examples/**/*.rb"].sort.each {|f| require f} 21 | 22 | Gemika::RSpec.configure_clean_database_before_example 23 | 24 | Gemika::RSpec.configure_should_syntax 25 | 26 | Gemika::RSpec.configure do |config| 27 | config.before(:each) do 28 | PlainRubyClass.reset 29 | end 30 | config.include FactoryBot::Syntax::Methods 31 | end 32 | -------------------------------------------------------------------------------- /spec/support/database.rb: -------------------------------------------------------------------------------- 1 | Gemika::Database.new.rewrite_schema! do 2 | 3 | create_table :movies do |t| 4 | t.string :title 5 | t.integer :year 6 | t.integer :prequel_id 7 | t.integer :reviewer_id 8 | t.string :uuid_reviewer_id 9 | t.integer :box_office_result 10 | t.string :premiere_site_type 11 | t.bigint :premiere_site_id 12 | end 13 | 14 | create_table :users do |t| 15 | t.string :email 16 | t.string :name 17 | t.boolean :deleted 18 | t.boolean :locked 19 | t.boolean :subscribed 20 | t.boolean :scared 21 | t.boolean :scared_by_spiders 22 | t.datetime :created_at 23 | end 24 | 25 | create_table :uuid_users, :id => false do |t| 26 | t.string :id 27 | t.string :email 28 | t.string :name 29 | t.datetime :created_at 30 | end 31 | 32 | create_table :payments do |t| 33 | t.text :comment 34 | t.integer :amount 35 | t.string :attachment 36 | end 37 | 38 | create_table :actors do |t| 39 | end 40 | 41 | create_table :job_offers do |t| 42 | end 43 | 44 | create_table :operas do |t| 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2016 Henning Koch 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /spec/support/factories/factories.rb: -------------------------------------------------------------------------------- 1 | FactoryBot.define do 2 | factory :job_offer, :class => ::JobOffer do 3 | transient do 4 | my_transient_attribute { nil } 5 | end 6 | 7 | trait :tempting_job_offer do 8 | transient do 9 | other_transient_attribute { nil } 10 | end 11 | end 12 | trait :risky 13 | trait :lucrative 14 | end 15 | 16 | factory :user, :class => User do 17 | transient do 18 | movie { nil } 19 | film { nil } 20 | end 21 | 22 | after(:build) do |user, evaluator| 23 | if user.reviewed_movies.blank? && (evaluator.movie || evaluator.film) 24 | user.reviewed_movies << (evaluator.movie || evaluator.film) 25 | end 26 | end 27 | end 28 | 29 | factory :movie, :class => Movie do 30 | transient do 31 | user { nil } 32 | user_id { nil } 33 | end 34 | 35 | after(:build) do |movie, evaluator| 36 | movie.reviewer = evaluator.user if evaluator.user 37 | movie.reviewer_id = evaluator.user_id if evaluator.user_id 38 | end 39 | 40 | trait :parent_movie_trait 41 | 42 | factory :subgenre_movie, traits: [:parent_movie_trait] 43 | end 44 | factory :opera, :class => Opera 45 | factory :payment, :class => Payment 46 | factory :uuid_user, :class => UuidUser 47 | factory :film, :class => Movie 48 | end 49 | -------------------------------------------------------------------------------- /lib/cucumber_factory/switcher.rb: -------------------------------------------------------------------------------- 1 | module CucumberFactory 2 | module Switcher 3 | extend self 4 | 5 | def find_last(klass) 6 | # Don't use class.last, in sqlite that is not always the last inserted element 7 | # If created_at is available prefer it over id as column for ordering so that we can handle UUIDs 8 | primary_key = klass.primary_key 9 | has_numeric_primary_key = klass.columns_hash[primary_key].type == :integer 10 | order_column = if has_numeric_primary_key || !klass.column_names.include?('created_at') 11 | primary_key 12 | else 13 | "created_at, #{primary_key}" 14 | end 15 | if active_record_version < 4 16 | klass.find(:last, :order => order_column) 17 | else 18 | klass.order(order_column).last 19 | end 20 | end 21 | 22 | def assign_attributes(model, attributes) 23 | if active_record_version < 3 24 | model.send(:attributes=, attributes, false) # ignore attr_accessible 25 | elsif active_record_version < 4 26 | model.send(:assign_attributes, attributes, :without_protection => true) 27 | else 28 | model.send(:assign_attributes, attributes) 29 | end 30 | end 31 | 32 | private 33 | 34 | def active_record_version 35 | ActiveRecord::VERSION::MAJOR 36 | end 37 | 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /cucumber_factory.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | require "cucumber_factory/version" 4 | 5 | Gem::Specification.new do |spec| 6 | spec.name = %q{cucumber_factory} 7 | spec.version = CucumberFactory::VERSION 8 | spec.authors = ["Henning Koch"] 9 | spec.email = %q{github@makandra.de} 10 | spec.homepage = %q{https://github.com/makandra/cucumber_factory} 11 | spec.summary = %q{Create records from Cucumber features without writing step definition.} 12 | spec.description = %q{Cucumber Factory allows you to create ActiveRecord models from your Cucumber features without writing step definitions for each model.} 13 | spec.license = 'MIT' 14 | spec.metadata = { 15 | 'source_code_uri' => 'https://github.com/makandra/cucumber_factory', 16 | 'bug_tracker_uri' => 'https://github.com/makandra/cucumber_factory/issues', 17 | 'changelog_uri' => 'https://github.com/makandra/cucumber_factory/blob/master/CHANGELOG.md', 18 | 'rubygems_mfa_required' => 'true', 19 | } 20 | 21 | spec.files = `git ls-files`.split("\n") 22 | spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 23 | spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } 24 | spec.require_paths = ["lib"] 25 | 26 | spec.add_dependency('cucumber') 27 | spec.add_dependency('activesupport') 28 | spec.add_dependency('activerecord') 29 | spec.add_dependency('cucumber_priority', '>=1.1.0') 30 | 31 | end 32 | -------------------------------------------------------------------------------- /spec/support/cucumber_helper.rb: -------------------------------------------------------------------------------- 1 | def prepare_cucumber_example 2 | if Gem::Version.new(Cucumber::VERSION) >= Gem::Version.new('3.0') 3 | @runtime = Cucumber::Runtime.new 4 | scenario = double('scenario', :language => 'en', :accept_hook? => true) 5 | @runtime.send(:begin_scenario, scenario) 6 | @main = Object.new 7 | @main.extend(Cucumber::Glue::Dsl) 8 | else 9 | @runtime = Cucumber::Runtime.new 10 | language = support_code.ruby if support_code.respond_to?(:ruby) 11 | language ||= support_code.load_programming_language('rb') 12 | language 13 | scenario = double('scenario', :language => 'en', :accept_hook? => true) 14 | language.send(:begin_scenario, scenario) 15 | @world = language.current_world 16 | @main = Object.new 17 | @main.extend(Cucumber::RbSupport::RbDsl) 18 | end 19 | 20 | add_steps_filepath = File.expand_path(File.join(File.dirname(__FILE__), '../../lib/cucumber_factory/add_steps.rb')) 21 | @main.instance_eval(File.read(add_steps_filepath)) 22 | end 23 | 24 | def invoke_cucumber_step(step, doc_string = nil, data_table = nil) 25 | if Gem::Version.new(Cucumber::VERSION) >= Gem::Version.new('2.0') 26 | multiline_argument = Cucumber::MultilineArgument::None.new 27 | 28 | if doc_string.present? 29 | multiline_argument = Cucumber::MultilineArgument::DocString.new(doc_string) 30 | end 31 | 32 | if data_table.present? 33 | multiline_argument = Cucumber::MultilineArgument::DataTable.from(data_table) 34 | end 35 | else 36 | multiline_argument = nil 37 | 38 | if doc_string.present? 39 | multiline_argument = Cucumber::Ast::DocString.new(doc_string, '') 40 | end 41 | 42 | if data_table.present? 43 | multiline_argument = Cucumber::Ast::Table.parse(data_table, nil, nil) 44 | end 45 | end 46 | 47 | first_step_match(step).invoke(multiline_argument) 48 | end 49 | 50 | def support_code 51 | @runtime.instance_variable_get(:@support_code) 52 | end 53 | 54 | def first_step_match(*args) 55 | support_code.send(:step_matches, *args).first 56 | end 57 | -------------------------------------------------------------------------------- /spec/cucumber_factory/factory/build_strategy_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe CucumberFactory::BuildStrategy do 4 | 5 | # most of the behaviour is integration tested in steps_spec.rb 6 | 7 | describe '.from_prose' do 8 | 9 | context 'when describing a factory_bot factory' do 10 | it 'returns a strategy and transient attributes corresponding to the factories model' do 11 | strategy, transient_attributes = described_class.from_prose('job offer', nil) 12 | 13 | strategy.should be_a(described_class) 14 | strategy.model_class.should == JobOffer 15 | transient_attributes.should == [:my_transient_attribute] 16 | end 17 | 18 | it 'uses the variant for the factory name if present' do 19 | strategy, transient_attributes = described_class.from_prose('job offer', '(tempting_job_offer)') 20 | 21 | strategy.should be_a(described_class) 22 | strategy.model_class.should == JobOffer 23 | transient_attributes.should == [:my_transient_attribute, :other_transient_attribute] 24 | end 25 | end 26 | 27 | context 'when describing a non factory_bot model' do 28 | before do 29 | hide_const("FactoryBot") 30 | end 31 | 32 | it "should return a strategy for the class matching a natural language expression" do 33 | described_class.from_prose("movie", nil).first.model_class.should == Movie 34 | described_class.from_prose("job offer", nil).first.model_class.should == JobOffer 35 | end 36 | 37 | it "should ignore variants for the class name" do 38 | described_class.from_prose("movie", "(job offer)").first.model_class.should == Movie 39 | end 40 | 41 | it "should allow namespaced models" do 42 | described_class.from_prose("people/actor", nil).first.model_class.should == People::Actor 43 | end 44 | end 45 | 46 | end 47 | 48 | describe '.class_from_factory' do 49 | it 'returns the class associated with a factory_bot factory' do 50 | described_class.class_from_factory('film').should == Movie 51 | end 52 | end 53 | 54 | end 55 | -------------------------------------------------------------------------------- /Gemfile.cucumber-1.3.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 0.2.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (4.2.11.1) 14 | activesupport (= 4.2.11.1) 15 | builder (~> 3.1) 16 | activerecord (4.2.11.1) 17 | activemodel (= 4.2.11.1) 18 | activesupport (= 4.2.11.1) 19 | arel (~> 6.0) 20 | activesupport (4.2.11.1) 21 | i18n (~> 0.7) 22 | minitest (~> 5.1) 23 | thread_safe (~> 0.3, >= 0.3.4) 24 | tzinfo (~> 1.1) 25 | arel (6.0.4) 26 | builder (3.2.4) 27 | carrierwave (1.2.3) 28 | activemodel (>= 4.0.0) 29 | activesupport (>= 4.0.0) 30 | mime-types (>= 1.16) 31 | concurrent-ruby (1.1.6) 32 | cucumber (1.3.20) 33 | builder (>= 2.1.2) 34 | diff-lcs (>= 1.1.3) 35 | gherkin (~> 2.12) 36 | multi_json (>= 1.7.5, < 2.0) 37 | multi_test (>= 0.1.2) 38 | cucumber_priority (0.3.2) 39 | cucumber 40 | database_cleaner (1.0.1) 41 | diff-lcs (1.3) 42 | factory_bot (4.11.1) 43 | activesupport (>= 3.0.0) 44 | gemika (0.8.3) 45 | gherkin (2.12.2) 46 | multi_json (~> 1.3) 47 | i18n (0.9.5) 48 | concurrent-ruby (~> 1.0) 49 | mime-types (3.2.2) 50 | mime-types-data (~> 3.2015) 51 | mime-types-data (3.2018.0812) 52 | minitest (5.12.0) 53 | multi_json (1.14.1) 54 | multi_test (0.1.2) 55 | pg (0.21.0) 56 | rake (12.3.3) 57 | rspec (3.9.0) 58 | rspec-core (~> 3.9.0) 59 | rspec-expectations (~> 3.9.0) 60 | rspec-mocks (~> 3.9.0) 61 | rspec-core (3.9.1) 62 | rspec-support (~> 3.9.1) 63 | rspec-expectations (3.9.0) 64 | diff-lcs (>= 1.2.0, < 2.0) 65 | rspec-support (~> 3.9.0) 66 | rspec-mocks (3.9.1) 67 | diff-lcs (>= 1.2.0, < 2.0) 68 | rspec-support (~> 3.9.0) 69 | rspec-support (3.9.2) 70 | thread_safe (0.3.6) 71 | tzinfo (1.2.6) 72 | thread_safe (~> 0.1) 73 | 74 | PLATFORMS 75 | ruby 76 | 77 | DEPENDENCIES 78 | activerecord (~> 4.2.0) 79 | activesupport (~> 4.2.0) 80 | carrierwave (~> 1.0) 81 | cucumber (~> 1.3.20) 82 | cucumber_factory! 83 | database_cleaner (~> 1.0.0) 84 | factory_bot (< 5) 85 | gemika (>= 0.8.1) 86 | pg (< 1) 87 | rake (>= 10.0.4) 88 | rspec (> 3.0) 89 | 90 | BUNDLED WITH 91 | 1.17.3 92 | -------------------------------------------------------------------------------- /Gemfile.cucumber-2.4.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 0.2.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (4.2.10) 14 | activesupport (= 4.2.10) 15 | builder (~> 3.1) 16 | activerecord (4.2.10) 17 | activemodel (= 4.2.10) 18 | activesupport (= 4.2.10) 19 | arel (~> 6.0) 20 | activesupport (4.2.10) 21 | i18n (~> 0.7) 22 | minitest (~> 5.1) 23 | thread_safe (~> 0.3, >= 0.3.4) 24 | tzinfo (~> 1.1) 25 | arel (6.0.4) 26 | builder (3.2.3) 27 | carrierwave (1.2.3) 28 | activemodel (>= 4.0.0) 29 | activesupport (>= 4.0.0) 30 | mime-types (>= 1.16) 31 | concurrent-ruby (1.0.5) 32 | cucumber (2.4.0) 33 | builder (>= 2.1.2) 34 | cucumber-core (~> 1.5.0) 35 | cucumber-wire (~> 0.0.1) 36 | diff-lcs (>= 1.1.3) 37 | gherkin (~> 4.0) 38 | multi_json (>= 1.7.5, < 2.0) 39 | multi_test (>= 0.1.2) 40 | cucumber-core (1.5.0) 41 | gherkin (~> 4.0) 42 | cucumber-wire (0.0.1) 43 | cucumber_priority (0.3.2) 44 | cucumber 45 | database_cleaner (1.6.2) 46 | diff-lcs (1.3) 47 | factory_bot (4.11.1) 48 | activesupport (>= 3.0.0) 49 | gemika (0.8.2) 50 | gherkin (4.1.3) 51 | i18n (0.9.5) 52 | concurrent-ruby (~> 1.0) 53 | mime-types (3.2.2) 54 | mime-types-data (~> 3.2015) 55 | mime-types-data (3.2018.0812) 56 | minitest (5.11.3) 57 | multi_json (1.13.1) 58 | multi_test (0.1.2) 59 | pg (0.21.0) 60 | rake (12.3.0) 61 | rspec (3.7.0) 62 | rspec-core (~> 3.7.0) 63 | rspec-expectations (~> 3.7.0) 64 | rspec-mocks (~> 3.7.0) 65 | rspec-core (3.7.1) 66 | rspec-support (~> 3.7.0) 67 | rspec-expectations (3.7.0) 68 | diff-lcs (>= 1.2.0, < 2.0) 69 | rspec-support (~> 3.7.0) 70 | rspec-mocks (3.7.0) 71 | diff-lcs (>= 1.2.0, < 2.0) 72 | rspec-support (~> 3.7.0) 73 | rspec-support (3.7.1) 74 | thread_safe (0.3.6) 75 | tzinfo (1.2.5) 76 | thread_safe (~> 0.1) 77 | 78 | PLATFORMS 79 | ruby 80 | 81 | DEPENDENCIES 82 | activerecord (~> 4.2.0) 83 | activesupport (~> 4.2.0) 84 | carrierwave (~> 1.0) 85 | cucumber (~> 2.4.0) 86 | cucumber_factory! 87 | database_cleaner 88 | factory_bot (< 5) 89 | gemika (>= 0.8.1) 90 | pg (< 1) 91 | rake 92 | rspec (~> 3.0) 93 | 94 | BUNDLED WITH 95 | 1.17.3 96 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Tests 3 | 'on': 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | jobs: 11 | test: 12 | runs-on: ubuntu-22.04 13 | services: 14 | postgres: 15 | image: postgres:14.15 16 | env: 17 | POSTGRES_PASSWORD: postgres 18 | options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 19 | ports: 20 | - 5432:5432 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | include: 25 | - ruby: 2.5.3 26 | gemfile: Gemfile.cucumber-1.3 27 | bundler: 1.17.3 28 | - ruby: 2.5.3 29 | gemfile: Gemfile.cucumber-2.4 30 | bundler: 1.17.3 31 | - ruby: 2.5.3 32 | gemfile: Gemfile.cucumber-3.0 33 | bundler: 1.17.3 34 | - ruby: 2.5.3 35 | gemfile: Gemfile.cucumber-3.1 36 | bundler: 1.17.3 37 | 38 | - ruby: 2.6.6 39 | gemfile: Gemfile.cucumber-4.1 40 | bundler: 2.4.22 41 | 42 | - ruby: 2.7.2 43 | gemfile: Gemfile.cucumber-5.3 44 | bundler: 2.4.22 45 | 46 | - ruby: 3.2.0 47 | gemfile: Gemfile.cucumber-4.1 48 | bundler: 2.4.22 49 | - ruby: 3.2.0 50 | gemfile: Gemfile.cucumber-5.3 51 | bundler: 2.4.22 52 | - ruby: 3.2.0 53 | gemfile: Gemfile.rails-7 54 | bundler: 2.6.3 55 | - ruby: 3.2.0 56 | gemfile: Gemfile.rails-8 57 | bundler: 2.6.3 58 | - ruby: 3.4.1 59 | gemfile: Gemfile.rails-7 60 | bundler: 2.6.3 61 | - ruby: 3.4.1 62 | gemfile: Gemfile.rails-8 63 | bundler: 2.6.3 64 | 65 | - ruby: 3.4.1 66 | gemfile: Gemfile.cucumber-10.1 67 | bundler: 2.6.3 68 | 69 | env: 70 | BUNDLE_GEMFILE: "${{ matrix.gemfile }}" 71 | steps: 72 | - uses: actions/checkout@v2 73 | - name: Install ruby 74 | uses: ruby/setup-ruby@v1 75 | with: 76 | ruby-version: "${{ matrix.ruby }}" 77 | - name: Setup database 78 | run: | 79 | sudo apt-get install -y postgresql-client 80 | PGPASSWORD=postgres psql -c 'create database cucumber_factory_test;' -U postgres -p 5432 -h localhost 81 | - name: Bundle 82 | run: | 83 | gem install bundler:${{ matrix.bundler }} 84 | bundle _${{ matrix.bundler }}_ install --no-deployment 85 | - name: Run tests 86 | run: bundle _${{ matrix.bundler }}_ exec rspec 87 | -------------------------------------------------------------------------------- /Gemfile.cucumber-3.1.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 0.2.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (5.1.5) 14 | activesupport (= 5.1.5) 15 | activerecord (5.1.5) 16 | activemodel (= 5.1.5) 17 | activesupport (= 5.1.5) 18 | arel (~> 8.0) 19 | activesupport (5.1.5) 20 | concurrent-ruby (~> 1.0, >= 1.0.2) 21 | i18n (~> 0.7) 22 | minitest (~> 5.1) 23 | tzinfo (~> 1.1) 24 | arel (8.0.0) 25 | backports (3.11.1) 26 | builder (3.2.3) 27 | carrierwave (1.2.3) 28 | activemodel (>= 4.0.0) 29 | activesupport (>= 4.0.0) 30 | mime-types (>= 1.16) 31 | concurrent-ruby (1.0.5) 32 | cucumber (3.1.0) 33 | builder (>= 2.1.2) 34 | cucumber-core (~> 3.1.0) 35 | cucumber-expressions (~> 5.0.4) 36 | cucumber-wire (~> 0.0.1) 37 | diff-lcs (~> 1.3) 38 | gherkin (~> 5.0) 39 | multi_json (>= 1.7.5, < 2.0) 40 | multi_test (>= 0.1.2) 41 | cucumber-core (3.1.0) 42 | backports (>= 3.8.0) 43 | cucumber-tag_expressions (~> 1.1.0) 44 | gherkin (>= 5.0.0) 45 | cucumber-expressions (5.0.13) 46 | cucumber-tag_expressions (1.1.1) 47 | cucumber-wire (0.0.1) 48 | cucumber_priority (0.3.2) 49 | cucumber 50 | database_cleaner (1.6.2) 51 | diff-lcs (1.3) 52 | factory_bot (5.1.1) 53 | activesupport (>= 4.2.0) 54 | gemika (0.8.3) 55 | gherkin (5.0.0) 56 | i18n (0.9.5) 57 | concurrent-ruby (~> 1.0) 58 | mime-types (3.2.2) 59 | mime-types-data (~> 3.2015) 60 | mime-types-data (3.2018.0812) 61 | minitest (5.11.3) 62 | multi_json (1.13.1) 63 | multi_test (0.1.2) 64 | pg (1.5.4) 65 | rake (12.3.0) 66 | rspec (3.7.0) 67 | rspec-core (~> 3.7.0) 68 | rspec-expectations (~> 3.7.0) 69 | rspec-mocks (~> 3.7.0) 70 | rspec-core (3.7.1) 71 | rspec-support (~> 3.7.0) 72 | rspec-expectations (3.7.0) 73 | diff-lcs (>= 1.2.0, < 2.0) 74 | rspec-support (~> 3.7.0) 75 | rspec-mocks (3.7.0) 76 | diff-lcs (>= 1.2.0, < 2.0) 77 | rspec-support (~> 3.7.0) 78 | rspec-support (3.7.1) 79 | thread_safe (0.3.6) 80 | tzinfo (1.2.5) 81 | thread_safe (~> 0.1) 82 | 83 | PLATFORMS 84 | ruby 85 | 86 | DEPENDENCIES 87 | activerecord (~> 5.1.0) 88 | activesupport (~> 5.1.0) 89 | carrierwave 90 | cucumber (~> 3.1.0) 91 | cucumber_factory! 92 | database_cleaner 93 | factory_bot 94 | gemika (>= 0.8.1) 95 | pg 96 | rake 97 | rspec (~> 3.0) 98 | 99 | BUNDLED WITH 100 | 1.17.3 101 | -------------------------------------------------------------------------------- /Gemfile.cucumber-3.0.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 0.2.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (5.0.6) 14 | activesupport (= 5.0.6) 15 | activerecord (5.0.6) 16 | activemodel (= 5.0.6) 17 | activesupport (= 5.0.6) 18 | arel (~> 7.0) 19 | activesupport (5.0.6) 20 | concurrent-ruby (~> 1.0, >= 1.0.2) 21 | i18n (~> 0.7) 22 | minitest (~> 5.1) 23 | tzinfo (~> 1.1) 24 | arel (7.1.4) 25 | backports (3.11.1) 26 | builder (3.2.3) 27 | carrierwave (1.2.3) 28 | activemodel (>= 4.0.0) 29 | activesupport (>= 4.0.0) 30 | mime-types (>= 1.16) 31 | concurrent-ruby (1.0.5) 32 | cucumber (3.0.2) 33 | builder (>= 2.1.2) 34 | cucumber-core (~> 3.0.0) 35 | cucumber-expressions (~> 4.0.3) 36 | cucumber-wire (~> 0.0.1) 37 | diff-lcs (~> 1.3) 38 | gherkin (~> 4.0) 39 | multi_json (>= 1.7.5, < 2.0) 40 | multi_test (>= 0.1.2) 41 | cucumber-core (3.0.0) 42 | backports (>= 3.8.0) 43 | cucumber-tag_expressions (>= 1.0.1) 44 | gherkin (>= 4.1.3) 45 | cucumber-expressions (4.0.4) 46 | cucumber-tag_expressions (1.1.1) 47 | cucumber-wire (0.0.1) 48 | cucumber_priority (0.3.2) 49 | cucumber 50 | database_cleaner (1.6.2) 51 | diff-lcs (1.3) 52 | factory_bot (5.1.1) 53 | activesupport (>= 4.2.0) 54 | gemika (0.8.3) 55 | gherkin (4.1.3) 56 | i18n (0.9.5) 57 | concurrent-ruby (~> 1.0) 58 | mime-types (3.2.2) 59 | mime-types-data (~> 3.2015) 60 | mime-types-data (3.2018.0812) 61 | minitest (5.11.3) 62 | multi_json (1.13.1) 63 | multi_test (0.1.2) 64 | pg (0.21.0) 65 | rake (12.3.0) 66 | rspec (3.7.0) 67 | rspec-core (~> 3.7.0) 68 | rspec-expectations (~> 3.7.0) 69 | rspec-mocks (~> 3.7.0) 70 | rspec-core (3.7.1) 71 | rspec-support (~> 3.7.0) 72 | rspec-expectations (3.7.0) 73 | diff-lcs (>= 1.2.0, < 2.0) 74 | rspec-support (~> 3.7.0) 75 | rspec-mocks (3.7.0) 76 | diff-lcs (>= 1.2.0, < 2.0) 77 | rspec-support (~> 3.7.0) 78 | rspec-support (3.7.1) 79 | thread_safe (0.3.6) 80 | tzinfo (1.2.5) 81 | thread_safe (~> 0.1) 82 | 83 | PLATFORMS 84 | ruby 85 | 86 | DEPENDENCIES 87 | activerecord (~> 5.0.0) 88 | activesupport (~> 5.0.0) 89 | carrierwave 90 | cucumber (~> 3.0.0) 91 | cucumber_factory! 92 | database_cleaner 93 | factory_bot 94 | gemika (>= 0.8.1) 95 | pg (< 1) 96 | rake 97 | rspec (~> 3.0) 98 | 99 | BUNDLED WITH 100 | 1.17.3 101 | -------------------------------------------------------------------------------- /Gemfile.rails-7.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 1.1.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (7.0.8.7) 14 | activesupport (= 7.0.8.7) 15 | activerecord (7.0.8.7) 16 | activemodel (= 7.0.8.7) 17 | activesupport (= 7.0.8.7) 18 | activesupport (7.0.8.7) 19 | concurrent-ruby (~> 1.0, >= 1.0.2) 20 | i18n (>= 1.6, < 2) 21 | minitest (>= 5.1) 22 | tzinfo (~> 2.0) 23 | addressable (2.8.7) 24 | public_suffix (>= 2.0.2, < 7.0) 25 | base64 (0.2.0) 26 | bigdecimal (3.1.9) 27 | builder (3.3.0) 28 | carrierwave (3.1.1) 29 | activemodel (>= 6.0.0) 30 | activesupport (>= 6.0.0) 31 | addressable (~> 2.6) 32 | image_processing (~> 1.1) 33 | marcel (~> 1.0.0) 34 | ssrf_filter (~> 1.0) 35 | concurrent-ruby (1.3.5) 36 | cucumber (9.2.1) 37 | builder (~> 3.2) 38 | cucumber-ci-environment (> 9, < 11) 39 | cucumber-core (> 13, < 14) 40 | cucumber-cucumber-expressions (~> 17.0) 41 | cucumber-gherkin (> 24, < 28) 42 | cucumber-html-formatter (> 20.3, < 22) 43 | cucumber-messages (> 19, < 25) 44 | diff-lcs (~> 1.5) 45 | mini_mime (~> 1.1) 46 | multi_test (~> 1.1) 47 | sys-uname (~> 1.2) 48 | cucumber-ci-environment (10.0.1) 49 | cucumber-core (13.0.3) 50 | cucumber-gherkin (>= 27, < 28) 51 | cucumber-messages (>= 20, < 23) 52 | cucumber-tag-expressions (> 5, < 7) 53 | cucumber-cucumber-expressions (17.1.0) 54 | bigdecimal 55 | cucumber-gherkin (27.0.0) 56 | cucumber-messages (>= 19.1.4, < 23) 57 | cucumber-html-formatter (21.7.0) 58 | cucumber-messages (> 19, < 27) 59 | cucumber-messages (22.0.0) 60 | cucumber-tag-expressions (6.1.1) 61 | cucumber_priority (1.1.0) 62 | cucumber 63 | database_cleaner (2.1.0) 64 | database_cleaner-active_record (>= 2, < 3) 65 | database_cleaner-active_record (2.2.0) 66 | activerecord (>= 5.a) 67 | database_cleaner-core (~> 2.0.0) 68 | database_cleaner-core (2.0.1) 69 | diff-lcs (1.5.1) 70 | factory_bot (6.5.0) 71 | activesupport (>= 5.0.0) 72 | ffi (1.17.1-x86_64-linux-gnu) 73 | gemika (0.8.4) 74 | i18n (1.14.7) 75 | concurrent-ruby (~> 1.0) 76 | image_processing (1.13.0) 77 | mini_magick (>= 4.9.5, < 5) 78 | ruby-vips (>= 2.0.17, < 3) 79 | logger (1.6.5) 80 | marcel (1.0.4) 81 | mini_magick (4.13.2) 82 | mini_mime (1.1.5) 83 | minitest (5.25.4) 84 | multi_test (1.1.0) 85 | mutex_m (0.3.0) 86 | pg (1.5.9) 87 | public_suffix (6.0.1) 88 | rake (13.2.1) 89 | rspec (3.13.0) 90 | rspec-core (~> 3.13.0) 91 | rspec-expectations (~> 3.13.0) 92 | rspec-mocks (~> 3.13.0) 93 | rspec-core (3.13.2) 94 | rspec-support (~> 3.13.0) 95 | rspec-expectations (3.13.3) 96 | diff-lcs (>= 1.2.0, < 2.0) 97 | rspec-support (~> 3.13.0) 98 | rspec-mocks (3.13.2) 99 | diff-lcs (>= 1.2.0, < 2.0) 100 | rspec-support (~> 3.13.0) 101 | rspec-support (3.13.2) 102 | ruby-vips (2.2.2) 103 | ffi (~> 1.12) 104 | logger 105 | ssrf_filter (1.2.0) 106 | sys-uname (1.3.1) 107 | ffi (~> 1.1) 108 | tzinfo (2.0.6) 109 | concurrent-ruby (~> 1.0) 110 | 111 | PLATFORMS 112 | x86_64-linux 113 | 114 | DEPENDENCIES 115 | activerecord (~> 7.0.1) 116 | activesupport (~> 7.0.1) 117 | base64 118 | bigdecimal 119 | carrierwave 120 | cucumber (~> 9.2.1) 121 | cucumber_factory! 122 | database_cleaner 123 | factory_bot 124 | gemika (>= 0.8.1) 125 | logger 126 | mutex_m 127 | pg (> 1.2.3) 128 | rake (> 10.0) 129 | rspec (~> 3.0) 130 | 131 | BUNDLED WITH 132 | 2.6.3 133 | -------------------------------------------------------------------------------- /media/logo.light.text.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 108 | -------------------------------------------------------------------------------- /media/logo.dark.text.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 111 | -------------------------------------------------------------------------------- /Gemfile.cucumber-5.3.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 1.1.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (6.1.3.1) 14 | activesupport (= 6.1.3.1) 15 | activerecord (6.1.3.1) 16 | activemodel (= 6.1.3.1) 17 | activesupport (= 6.1.3.1) 18 | activesupport (6.1.3.1) 19 | concurrent-ruby (~> 1.0, >= 1.0.2) 20 | i18n (>= 1.6, < 2) 21 | minitest (>= 5.1) 22 | tzinfo (~> 2.0) 23 | zeitwerk (~> 2.3) 24 | addressable (2.7.0) 25 | public_suffix (>= 2.0.2, < 5.0) 26 | builder (3.2.4) 27 | carrierwave (2.2.1) 28 | activemodel (>= 5.0.0) 29 | activesupport (>= 5.0.0) 30 | addressable (~> 2.6) 31 | image_processing (~> 1.1) 32 | marcel (~> 1.0.0) 33 | mini_mime (>= 0.1.3) 34 | ssrf_filter (~> 1.0) 35 | concurrent-ruby (1.1.8) 36 | cucumber (5.3.0) 37 | builder (~> 3.2, >= 3.2.4) 38 | cucumber-core (~> 8.0, >= 8.0.1) 39 | cucumber-create-meta (~> 2.0, >= 2.0.2) 40 | cucumber-cucumber-expressions (~> 10.3, >= 10.3.0) 41 | cucumber-gherkin (~> 15.0, >= 15.0.2) 42 | cucumber-html-formatter (~> 9.0, >= 9.0.0) 43 | cucumber-messages (~> 13.1, >= 13.1.0) 44 | cucumber-wire (~> 4.0, >= 4.0.1) 45 | diff-lcs (~> 1.4, >= 1.4.4) 46 | multi_test (~> 0.1, >= 0.1.2) 47 | sys-uname (~> 1.2, >= 1.2.1) 48 | cucumber-core (8.0.1) 49 | cucumber-gherkin (~> 15.0, >= 15.0.2) 50 | cucumber-messages (~> 13.0, >= 13.0.1) 51 | cucumber-tag-expressions (~> 2.0, >= 2.0.4) 52 | cucumber-create-meta (2.0.4) 53 | cucumber-messages (~> 13.1, >= 13.1.0) 54 | sys-uname (~> 1.2, >= 1.2.1) 55 | cucumber-cucumber-expressions (10.3.0) 56 | cucumber-gherkin (15.0.2) 57 | cucumber-messages (~> 13.0, >= 13.0.1) 58 | cucumber-html-formatter (9.0.0) 59 | cucumber-messages (~> 13.0, >= 13.0.1) 60 | cucumber-messages (13.2.1) 61 | protobuf-cucumber (~> 3.10, >= 3.10.8) 62 | cucumber-tag-expressions (2.0.4) 63 | cucumber-wire (4.0.1) 64 | cucumber-core (~> 8.0, >= 8.0.1) 65 | cucumber-cucumber-expressions (~> 10.3, >= 10.3.0) 66 | cucumber-messages (~> 13.0, >= 13.0.1) 67 | cucumber_priority (1.1.0) 68 | cucumber 69 | database_cleaner (2.0.1) 70 | database_cleaner-active_record (~> 2.0.0) 71 | database_cleaner-active_record (2.0.0) 72 | activerecord (>= 5.a) 73 | database_cleaner-core (~> 2.0.0) 74 | database_cleaner-core (2.0.1) 75 | diff-lcs (1.4.4) 76 | factory_bot (6.1.0) 77 | activesupport (>= 5.0.0) 78 | ffi (1.15.0) 79 | gemika (0.8.3) 80 | i18n (1.8.9) 81 | concurrent-ruby (~> 1.0) 82 | image_processing (1.12.1) 83 | mini_magick (>= 4.9.5, < 5) 84 | ruby-vips (>= 2.0.17, < 3) 85 | marcel (1.0.0) 86 | middleware (0.1.0) 87 | mini_magick (4.11.0) 88 | mini_mime (1.0.3) 89 | minitest (5.14.4) 90 | multi_test (0.1.2) 91 | pg (1.5.4) 92 | protobuf-cucumber (3.10.8) 93 | activesupport (>= 3.2) 94 | middleware 95 | thor 96 | thread_safe 97 | public_suffix (4.0.6) 98 | rake (13.0.3) 99 | rspec (3.10.0) 100 | rspec-core (~> 3.10.0) 101 | rspec-expectations (~> 3.10.0) 102 | rspec-mocks (~> 3.10.0) 103 | rspec-core (3.10.1) 104 | rspec-support (~> 3.10.0) 105 | rspec-expectations (3.10.1) 106 | diff-lcs (>= 1.2.0, < 2.0) 107 | rspec-support (~> 3.10.0) 108 | rspec-mocks (3.10.2) 109 | diff-lcs (>= 1.2.0, < 2.0) 110 | rspec-support (~> 3.10.0) 111 | rspec-support (3.10.2) 112 | ruby-vips (2.1.0) 113 | ffi (~> 1.12) 114 | ssrf_filter (1.0.7) 115 | sys-uname (1.2.2) 116 | ffi (~> 1.1) 117 | thor (1.1.0) 118 | thread_safe (0.3.6) 119 | tzinfo (2.0.4) 120 | concurrent-ruby (~> 1.0) 121 | zeitwerk (2.4.2) 122 | 123 | PLATFORMS 124 | ruby 125 | 126 | DEPENDENCIES 127 | activerecord (~> 6.1.0) 128 | activesupport (~> 6.1.0) 129 | carrierwave 130 | cucumber (~> 5.3.0) 131 | cucumber_factory! 132 | database_cleaner 133 | factory_bot 134 | gemika (>= 0.8.1) 135 | pg (> 1.2.3) 136 | rake (> 10.0) 137 | rspec (~> 3.0) 138 | 139 | BUNDLED WITH 140 | 2.4.22 141 | -------------------------------------------------------------------------------- /Gemfile.cucumber-4.1.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 1.1.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (6.0.3.6) 14 | activesupport (= 6.0.3.6) 15 | activerecord (6.0.3.6) 16 | activemodel (= 6.0.3.6) 17 | activesupport (= 6.0.3.6) 18 | activesupport (6.0.3.6) 19 | concurrent-ruby (~> 1.0, >= 1.0.2) 20 | i18n (>= 0.7, < 2) 21 | minitest (~> 5.1) 22 | tzinfo (~> 1.1) 23 | zeitwerk (~> 2.2, >= 2.2.2) 24 | addressable (2.7.0) 25 | public_suffix (>= 2.0.2, < 5.0) 26 | builder (3.2.4) 27 | carrierwave (2.2.1) 28 | activemodel (>= 5.0.0) 29 | activesupport (>= 5.0.0) 30 | addressable (~> 2.6) 31 | image_processing (~> 1.1) 32 | marcel (~> 1.0.0) 33 | mini_mime (>= 0.1.3) 34 | ssrf_filter (~> 1.0) 35 | concurrent-ruby (1.1.8) 36 | cucumber (4.1.0) 37 | builder (~> 3.2, >= 3.2.3) 38 | cucumber-core (~> 7.1, >= 7.1.0) 39 | cucumber-create-meta (~> 1.0.0, >= 1.0.0) 40 | cucumber-cucumber-expressions (~> 10.1, >= 10.1.0) 41 | cucumber-gherkin (~> 14.0, >= 14.0.1) 42 | cucumber-html-formatter (~> 7.0, >= 7.0.0) 43 | cucumber-messages (~> 12.2, >= 12.2.0) 44 | cucumber-wire (~> 3.1, >= 3.1.0) 45 | diff-lcs (~> 1.3, >= 1.3, < 1.4) 46 | multi_test (~> 0.1, >= 0.1.2) 47 | sys-uname (~> 1.0, >= 1.0.2) 48 | cucumber-core (7.1.0) 49 | cucumber-gherkin (~> 14.0, >= 14.0.1) 50 | cucumber-messages (~> 12.2, >= 12.2.0) 51 | cucumber-tag-expressions (~> 2.0, >= 2.0.4) 52 | cucumber-create-meta (1.0.0) 53 | cucumber-messages (~> 12.2, >= 12.2.0) 54 | sys-uname (~> 1.2, >= 1.2.1) 55 | cucumber-cucumber-expressions (10.3.0) 56 | cucumber-gherkin (14.2.0) 57 | cucumber-messages (~> 12.4, >= 12.4.0) 58 | cucumber-html-formatter (7.2.0) 59 | cucumber-messages (~> 12.4, >= 12.4.0) 60 | cucumber-messages (12.4.0) 61 | protobuf-cucumber (~> 3.10, >= 3.10.8) 62 | cucumber-tag-expressions (2.0.4) 63 | cucumber-wire (3.1.0) 64 | cucumber-core (~> 7.1, >= 7.1.0) 65 | cucumber-cucumber-expressions (~> 10.1, >= 10.1.0) 66 | cucumber-messages (~> 12.2, >= 12.2.0) 67 | cucumber_priority (1.1.0) 68 | cucumber 69 | database_cleaner (2.0.1) 70 | database_cleaner-active_record (~> 2.0.0) 71 | database_cleaner-active_record (2.0.0) 72 | activerecord (>= 5.a) 73 | database_cleaner-core (~> 2.0.0) 74 | database_cleaner-core (2.0.1) 75 | diff-lcs (1.3) 76 | factory_bot (6.1.0) 77 | activesupport (>= 5.0.0) 78 | ffi (1.15.0) 79 | gemika (0.8.3) 80 | i18n (1.8.9) 81 | concurrent-ruby (~> 1.0) 82 | image_processing (1.12.1) 83 | mini_magick (>= 4.9.5, < 5) 84 | ruby-vips (>= 2.0.17, < 3) 85 | marcel (1.0.0) 86 | middleware (0.1.0) 87 | mini_magick (4.11.0) 88 | mini_mime (1.0.3) 89 | minitest (5.14.4) 90 | multi_test (0.1.2) 91 | pg (1.5.4) 92 | protobuf-cucumber (3.10.8) 93 | activesupport (>= 3.2) 94 | middleware 95 | thor 96 | thread_safe 97 | public_suffix (4.0.6) 98 | rake (13.0.3) 99 | rspec (3.10.0) 100 | rspec-core (~> 3.10.0) 101 | rspec-expectations (~> 3.10.0) 102 | rspec-mocks (~> 3.10.0) 103 | rspec-core (3.10.1) 104 | rspec-support (~> 3.10.0) 105 | rspec-expectations (3.10.1) 106 | diff-lcs (>= 1.2.0, < 2.0) 107 | rspec-support (~> 3.10.0) 108 | rspec-mocks (3.10.2) 109 | diff-lcs (>= 1.2.0, < 2.0) 110 | rspec-support (~> 3.10.0) 111 | rspec-support (3.10.2) 112 | ruby-vips (2.1.0) 113 | ffi (~> 1.12) 114 | ssrf_filter (1.0.7) 115 | sys-uname (1.2.2) 116 | ffi (~> 1.1) 117 | thor (1.1.0) 118 | thread_safe (0.3.6) 119 | tzinfo (1.2.9) 120 | thread_safe (~> 0.1) 121 | zeitwerk (2.4.2) 122 | 123 | PLATFORMS 124 | ruby 125 | 126 | DEPENDENCIES 127 | activerecord (~> 6.0.0) 128 | activesupport (~> 6.0.0) 129 | carrierwave 130 | cucumber (~> 4.1.0) 131 | cucumber_factory! 132 | database_cleaner 133 | factory_bot 134 | gemika (>= 0.8.1) 135 | pg (> 1.2.3) 136 | rake (> 10.0) 137 | rspec (~> 3.0) 138 | 139 | BUNDLED WITH 140 | 2.4.22 141 | -------------------------------------------------------------------------------- /Gemfile.rails-8.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 1.1.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (8.0.1) 14 | activesupport (= 8.0.1) 15 | activerecord (8.0.1) 16 | activemodel (= 8.0.1) 17 | activesupport (= 8.0.1) 18 | timeout (>= 0.4.0) 19 | activesupport (8.0.1) 20 | base64 21 | benchmark (>= 0.3) 22 | bigdecimal 23 | concurrent-ruby (~> 1.0, >= 1.3.1) 24 | connection_pool (>= 2.2.5) 25 | drb 26 | i18n (>= 1.6, < 2) 27 | logger (>= 1.4.2) 28 | minitest (>= 5.1) 29 | securerandom (>= 0.3) 30 | tzinfo (~> 2.0, >= 2.0.5) 31 | uri (>= 0.13.1) 32 | addressable (2.8.7) 33 | public_suffix (>= 2.0.2, < 7.0) 34 | base64 (0.2.0) 35 | benchmark (0.4.0) 36 | bigdecimal (3.1.9) 37 | builder (3.3.0) 38 | carrierwave (3.1.1) 39 | activemodel (>= 6.0.0) 40 | activesupport (>= 6.0.0) 41 | addressable (~> 2.6) 42 | image_processing (~> 1.1) 43 | marcel (~> 1.0.0) 44 | ssrf_filter (~> 1.0) 45 | concurrent-ruby (1.3.5) 46 | connection_pool (2.5.0) 47 | cucumber (9.2.1) 48 | builder (~> 3.2) 49 | cucumber-ci-environment (> 9, < 11) 50 | cucumber-core (> 13, < 14) 51 | cucumber-cucumber-expressions (~> 17.0) 52 | cucumber-gherkin (> 24, < 28) 53 | cucumber-html-formatter (> 20.3, < 22) 54 | cucumber-messages (> 19, < 25) 55 | diff-lcs (~> 1.5) 56 | mini_mime (~> 1.1) 57 | multi_test (~> 1.1) 58 | sys-uname (~> 1.2) 59 | cucumber-ci-environment (10.0.1) 60 | cucumber-core (13.0.3) 61 | cucumber-gherkin (>= 27, < 28) 62 | cucumber-messages (>= 20, < 23) 63 | cucumber-tag-expressions (> 5, < 7) 64 | cucumber-cucumber-expressions (17.1.0) 65 | bigdecimal 66 | cucumber-gherkin (27.0.0) 67 | cucumber-messages (>= 19.1.4, < 23) 68 | cucumber-html-formatter (21.7.0) 69 | cucumber-messages (> 19, < 27) 70 | cucumber-messages (22.0.0) 71 | cucumber-tag-expressions (6.1.1) 72 | cucumber_priority (1.1.0) 73 | cucumber 74 | database_cleaner (2.1.0) 75 | database_cleaner-active_record (>= 2, < 3) 76 | database_cleaner-active_record (2.2.0) 77 | activerecord (>= 5.a) 78 | database_cleaner-core (~> 2.0.0) 79 | database_cleaner-core (2.0.1) 80 | diff-lcs (1.5.1) 81 | drb (2.2.1) 82 | factory_bot (6.5.0) 83 | activesupport (>= 5.0.0) 84 | ffi (1.17.1) 85 | ffi (1.17.1-aarch64-linux-gnu) 86 | ffi (1.17.1-aarch64-linux-musl) 87 | ffi (1.17.1-arm-linux-gnu) 88 | ffi (1.17.1-arm-linux-musl) 89 | ffi (1.17.1-arm64-darwin) 90 | ffi (1.17.1-x86-linux-gnu) 91 | ffi (1.17.1-x86-linux-musl) 92 | ffi (1.17.1-x86_64-darwin) 93 | ffi (1.17.1-x86_64-linux-gnu) 94 | ffi (1.17.1-x86_64-linux-musl) 95 | gemika (0.8.4) 96 | i18n (1.14.7) 97 | concurrent-ruby (~> 1.0) 98 | image_processing (1.13.0) 99 | mini_magick (>= 4.9.5, < 5) 100 | ruby-vips (>= 2.0.17, < 3) 101 | logger (1.6.5) 102 | marcel (1.0.4) 103 | mini_magick (4.13.2) 104 | mini_mime (1.1.5) 105 | minitest (5.25.4) 106 | multi_test (1.1.0) 107 | pg (1.5.9) 108 | public_suffix (6.0.1) 109 | rake (13.2.1) 110 | rspec (3.13.0) 111 | rspec-core (~> 3.13.0) 112 | rspec-expectations (~> 3.13.0) 113 | rspec-mocks (~> 3.13.0) 114 | rspec-core (3.13.2) 115 | rspec-support (~> 3.13.0) 116 | rspec-expectations (3.13.3) 117 | diff-lcs (>= 1.2.0, < 2.0) 118 | rspec-support (~> 3.13.0) 119 | rspec-mocks (3.13.2) 120 | diff-lcs (>= 1.2.0, < 2.0) 121 | rspec-support (~> 3.13.0) 122 | rspec-support (3.13.2) 123 | ruby-vips (2.2.2) 124 | ffi (~> 1.12) 125 | logger 126 | securerandom (0.4.1) 127 | ssrf_filter (1.2.0) 128 | sys-uname (1.3.1) 129 | ffi (~> 1.1) 130 | timeout (0.4.3) 131 | tzinfo (2.0.6) 132 | concurrent-ruby (~> 1.0) 133 | uri (1.0.2) 134 | 135 | PLATFORMS 136 | aarch64-linux-gnu 137 | aarch64-linux-musl 138 | arm-linux-gnu 139 | arm-linux-musl 140 | arm64-darwin 141 | ruby 142 | x86-linux-gnu 143 | x86-linux-musl 144 | x86_64-darwin 145 | x86_64-linux-gnu 146 | x86_64-linux-musl 147 | 148 | DEPENDENCIES 149 | activerecord (~> 8.0.0) 150 | activesupport (~> 8.0.0) 151 | carrierwave 152 | cucumber (~> 9.2.1) 153 | cucumber_factory! 154 | database_cleaner 155 | factory_bot 156 | gemika (>= 0.8.1) 157 | pg (> 1.2.3) 158 | rake (> 10.0) 159 | rspec (~> 3.0) 160 | 161 | BUNDLED WITH 162 | 2.5.22 163 | -------------------------------------------------------------------------------- /Gemfile.cucumber-10.1.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | cucumber_factory (2.7.0) 5 | activerecord 6 | activesupport 7 | cucumber 8 | cucumber_priority (>= 1.1.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | activemodel (8.0.2.1) 14 | activesupport (= 8.0.2.1) 15 | activerecord (8.0.2.1) 16 | activemodel (= 8.0.2.1) 17 | activesupport (= 8.0.2.1) 18 | timeout (>= 0.4.0) 19 | activesupport (8.0.2.1) 20 | base64 21 | benchmark (>= 0.3) 22 | bigdecimal 23 | concurrent-ruby (~> 1.0, >= 1.3.1) 24 | connection_pool (>= 2.2.5) 25 | drb 26 | i18n (>= 1.6, < 2) 27 | logger (>= 1.4.2) 28 | minitest (>= 5.1) 29 | securerandom (>= 0.3) 30 | tzinfo (~> 2.0, >= 2.0.5) 31 | uri (>= 0.13.1) 32 | addressable (2.8.7) 33 | public_suffix (>= 2.0.2, < 7.0) 34 | base64 (0.3.0) 35 | benchmark (0.4.1) 36 | bigdecimal (3.2.2) 37 | builder (3.3.0) 38 | carrierwave (3.1.2) 39 | activemodel (>= 6.0.0) 40 | activesupport (>= 6.0.0) 41 | addressable (~> 2.6) 42 | image_processing (~> 1.1) 43 | marcel (~> 1.0.0) 44 | ssrf_filter (~> 1.0) 45 | concurrent-ruby (1.3.5) 46 | connection_pool (2.5.3) 47 | cucumber (10.1.0) 48 | base64 (~> 0.2) 49 | builder (~> 3.2) 50 | cucumber-ci-environment (> 9, < 11) 51 | cucumber-core (> 15, < 17) 52 | cucumber-cucumber-expressions (> 17, < 19) 53 | cucumber-html-formatter (> 20.3, < 22) 54 | diff-lcs (~> 1.5) 55 | logger (~> 1.6) 56 | mini_mime (~> 1.1) 57 | multi_test (~> 1.1) 58 | sys-uname (~> 1.3) 59 | cucumber-ci-environment (10.0.1) 60 | cucumber-core (15.2.1) 61 | cucumber-gherkin (> 27, < 33) 62 | cucumber-messages (> 26, < 30) 63 | cucumber-tag-expressions (> 5, < 7) 64 | cucumber-cucumber-expressions (18.0.1) 65 | bigdecimal 66 | cucumber-gherkin (32.2.0) 67 | cucumber-messages (> 25, < 28) 68 | cucumber-html-formatter (21.14.0) 69 | cucumber-messages (> 19, < 28) 70 | cucumber-messages (27.2.0) 71 | cucumber-tag-expressions (6.1.2) 72 | cucumber_priority (1.1.0) 73 | cucumber 74 | database_cleaner (2.1.0) 75 | database_cleaner-active_record (>= 2, < 3) 76 | database_cleaner-active_record (2.2.2) 77 | activerecord (>= 5.a) 78 | database_cleaner-core (~> 2.0) 79 | database_cleaner-core (2.0.1) 80 | diff-lcs (1.6.2) 81 | drb (2.2.3) 82 | factory_bot (6.5.5) 83 | activesupport (>= 6.1.0) 84 | ffi (1.17.2) 85 | ffi (1.17.2-aarch64-linux-gnu) 86 | ffi (1.17.2-aarch64-linux-musl) 87 | ffi (1.17.2-arm-linux-gnu) 88 | ffi (1.17.2-arm-linux-musl) 89 | ffi (1.17.2-arm64-darwin) 90 | ffi (1.17.2-x86-linux-gnu) 91 | ffi (1.17.2-x86-linux-musl) 92 | ffi (1.17.2-x86_64-darwin) 93 | ffi (1.17.2-x86_64-linux-gnu) 94 | ffi (1.17.2-x86_64-linux-musl) 95 | gemika (1.0.0) 96 | i18n (1.14.7) 97 | concurrent-ruby (~> 1.0) 98 | image_processing (1.14.0) 99 | mini_magick (>= 4.9.5, < 6) 100 | ruby-vips (>= 2.0.17, < 3) 101 | logger (1.7.0) 102 | marcel (1.0.4) 103 | memoist (0.16.2) 104 | mini_magick (5.3.1) 105 | logger 106 | mini_mime (1.1.5) 107 | minitest (5.25.5) 108 | multi_test (1.1.0) 109 | pg (1.6.1) 110 | pg (1.6.1-aarch64-linux) 111 | pg (1.6.1-aarch64-linux-musl) 112 | pg (1.6.1-aarch64-mingw-ucrt) 113 | pg (1.6.1-arm64-darwin) 114 | pg (1.6.1-x86_64-darwin) 115 | pg (1.6.1-x86_64-linux) 116 | pg (1.6.1-x86_64-linux-musl) 117 | public_suffix (6.0.2) 118 | rake (13.3.0) 119 | rspec (3.13.1) 120 | rspec-core (~> 3.13.0) 121 | rspec-expectations (~> 3.13.0) 122 | rspec-mocks (~> 3.13.0) 123 | rspec-core (3.13.5) 124 | rspec-support (~> 3.13.0) 125 | rspec-expectations (3.13.5) 126 | diff-lcs (>= 1.2.0, < 2.0) 127 | rspec-support (~> 3.13.0) 128 | rspec-mocks (3.13.5) 129 | diff-lcs (>= 1.2.0, < 2.0) 130 | rspec-support (~> 3.13.0) 131 | rspec-support (3.13.5) 132 | ruby-vips (2.2.5) 133 | ffi (~> 1.12) 134 | logger 135 | securerandom (0.4.1) 136 | ssrf_filter (1.3.0) 137 | sys-uname (1.4.0) 138 | ffi (~> 1.1) 139 | memoist (~> 0.16.2) 140 | timeout (0.4.3) 141 | tzinfo (2.0.6) 142 | concurrent-ruby (~> 1.0) 143 | uri (1.0.3) 144 | 145 | PLATFORMS 146 | aarch64-linux 147 | aarch64-linux-gnu 148 | aarch64-linux-musl 149 | aarch64-mingw-ucrt 150 | arm-linux-gnu 151 | arm-linux-musl 152 | arm64-darwin 153 | ruby 154 | x86-linux-gnu 155 | x86-linux-musl 156 | x86_64-darwin 157 | x86_64-linux-gnu 158 | x86_64-linux-musl 159 | 160 | DEPENDENCIES 161 | activerecord (~> 8.0.0) 162 | activesupport (~> 8.0.0) 163 | carrierwave 164 | cucumber (~> 10.1.0) 165 | cucumber_factory! 166 | database_cleaner 167 | factory_bot 168 | gemika (>= 0.8.1) 169 | pg (> 1.2.3) 170 | rake (> 10.0) 171 | rspec (~> 3.0) 172 | 173 | BUNDLED WITH 174 | 2.6.3 175 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 | 7 | 8 | ## Unreleased 9 | 10 | ### Breaking changes 11 | 12 | - 13 | 14 | ### Compatible changes 15 | 16 | 17 | ## 2.7.0 - 2025-08-28 18 | 19 | ### Compatible changes 20 | 21 | - Add Support for Cucumber >= 10 22 | 23 | ## 2.6.0 - 2025-01-21 24 | 25 | ### Compatible changes 26 | 27 | - Add Support for Ruby 3.4 28 | - This requires Cucumber 9+ 29 | 30 | ## 2.5.0 - 2022-09-15 31 | 32 | ### Compatible changes 33 | 34 | - Treat transient factory_bot attributes as associations if they are named like a factory. 35 | 36 | ## 2.4.1 - 2022-03-16 37 | 38 | ### Compatible changes 39 | 40 | - Enabled MFA for RubyGems 41 | 42 | ## 2.4.0 - 2021-03-30 43 | 44 | ### Compatible changes 45 | 46 | - Added support for ActiveRecord >= 6. 47 | 48 | ## 2.3.1 - 2020-10-01 49 | 50 | ### Compatible changes 51 | 52 | - Lowered the priority of all steps in this gem to avoid issues with overlapping steps. 53 | 54 | ## 2.3.0 - 2020-09-24 55 | 56 | ### Compatible changes 57 | 58 | - Added a step to add file objects to a model: 59 | ```cucumber 60 | Given there is a user with the avatar file:"path/to/avatar.jpg" 61 | ``` 62 | Both single and double quotes are supported. 63 | 64 | ## 2.2.0 - 2020-09-23 65 | 66 | ### Compatible changes 67 | 68 | - A step was added that allows modifying existing records with a similar syntax to creating new records: 69 | ```cucumber 70 | (Given "Bob" is a user) 71 | And "Bob" has the email "foo@bar.com" and is subscribed 72 | ``` 73 | - This step will also work with doc strings or tables: 74 | ```cucumber 75 | (Given "Bob" is a user) 76 | And the user above has these attributes: 77 | | name | Bob | 78 | | email | foo@bar.com | 79 | ``` 80 | 81 | ## 2.1.1 - 2020-05-20 82 | 83 | ### Compatible changes 84 | 85 | - Cucumber 2.1.0 introduced some regressions which are being addressed with this patch: 86 | - Fix the assignment of polymorphic associations. 87 | - Restore the support for inherited traits within nested factories. 88 | 89 | ## 2.1.0 - 2020-03-09 90 | 91 | ### Compatible changes 92 | 93 | - Allow associations to be set for [transient attributes](https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#transient-attributes) if they are named after the model. For example, when there is a `Role` model and the`user` factory has a transient attribute `role`, the following steps are now valid: 94 | ``` 95 | Given there is a role 96 | And there is a user with the role above 97 | ``` 98 | 99 | ## 2.0.2 - 2020-03-26 100 | 101 | ### Compatible changes 102 | 103 | - Removed development and test support for Ruby 1.8. Closes #32. 104 | 105 | ## 2.0.1 - 2020-02-27 106 | 107 | ### Compatible changes 108 | 109 | - Fix a bug that prevented created records to be named when using multiline attribute assignments 110 | ``` 111 | Given "Bob" is a user with these attributes: 112 | | email | foo@bar.com | 113 | ``` 114 | 115 | ## 2.0.0 - 2020-02-10 116 | 117 | ### Breaking changes 118 | 119 | - CucumberFactory now raises an `ArgumentError` if some parts of a matched step were not used. For example, while this step was accepted in recent versions, it will now complain with the message `Unable to parse attributes " and the ".`: 120 | ``` 121 | Given there is a user with the attribute 'foo' and the 122 | ``` 123 | 124 | 125 | ### Compatible changes 126 | 127 | - Single quoted attribute values and model names are now supported. Example: 128 | 129 | ``` 130 | Given 'jack' is a user with the first name 'Jack' 131 | ``` 132 | 133 | ## 1.15.1 - 2019-05-30 134 | 135 | ### Compatible changes 136 | 137 | - Fix: Allow to use array assignments within a doc string or table assignment 138 | 139 | Example: 140 | 141 | ``` 142 | Given there is a post with these attributes: 143 | |tags| ["urgent", "vip"] | 144 | ``` 145 | 146 | ## 1.15.0 - 2019-02-08 147 | 148 | ### Breaking changes 149 | 150 | - Moved gem's code from `Cucumber` module into `CucumberFactory` module. 151 | - Instead of calling `Cucumber::Factory.add_steps(self)`, `require 'cucumber_factory/add_steps'` instead. 152 | 153 | 154 | ## 1.14.2 - 2018-10-31 155 | 156 | ### Compatible changes 157 | 158 | - Replace deprecated `Fixnum` with `Integer` 159 | 160 | 161 | ## 1.14.1 - 2018-10-26 162 | 163 | ### Compatible changes 164 | 165 | - Allow to refer to previously set foreign keys 166 | 167 | 168 | ## 1.14.0 - 2018-10-26 169 | 170 | ### Compatible changes 171 | 172 | - Allow to set numbers without quotes 173 | - Support array fields out of the box 174 | - Allow to set has_many associations with square bracket notation 175 | 176 | 177 | ## 1.13.0 - 2018-04-26 178 | 179 | ### Compatible changes 180 | 181 | - Support multi line attribute assignment 182 | 183 | 184 | ## 1.12.0 - 2018-04-26 185 | 186 | ### Compatible changes 187 | 188 | - Support for Cucumber 3.0 and 3.1 189 | 190 | 191 | ## Previous releases 192 | 193 | - See [GitHub](https://github.com/makandra/cucumber_factory/commits/master) 194 | -------------------------------------------------------------------------------- /lib/cucumber_factory/build_strategy.rb: -------------------------------------------------------------------------------- 1 | module CucumberFactory 2 | 3 | # wraps machinist / factory_bot / ruby object logic 4 | 5 | class BuildStrategy 6 | 7 | class << self 8 | 9 | def from_prose(model_prose, variant_prose) 10 | variants = variants_from_prose(variant_prose) 11 | factory = factory_bot_factory(model_prose, variants) 12 | 13 | if factory 14 | factory.compile # Required to load inherited traits! 15 | strategy = factory_bot_strategy(factory, model_prose, variants) 16 | transient_attributes = factory_bot_transient_attributes(factory, variants) 17 | else 18 | strategy = alternative_strategy(model_prose, variants) 19 | transient_attributes = [] 20 | end 21 | 22 | [strategy, transient_attributes] 23 | end 24 | 25 | def class_from_factory(model_prose) 26 | if (factory = factory_bot_factory(model_prose, [])) 27 | factory.build_class 28 | end 29 | end 30 | 31 | def parse_model_class(model_prose) 32 | underscored_model_name(model_prose).camelize.constantize 33 | end 34 | 35 | private 36 | 37 | def variants_from_prose(variant_prose) 38 | if variant_prose.present? 39 | variants = /\((.*?)\)/.match(variant_prose)[1].split(/\s*,\s*/) 40 | variants.collect { |variant| variant.downcase.gsub(" ", "_").to_sym } 41 | else 42 | [] 43 | end 44 | end 45 | 46 | def factory_bot_factory(model_prose, variants) 47 | return unless factory_bot_class 48 | 49 | factories = factory_bot_class.factories 50 | 51 | factory_name = factory_name_from_prose(model_prose) 52 | factory = factories.registered?(factory_name) && factories[factory_name] 53 | 54 | if factory.nil? && variants.present? 55 | factory = factories.registered?(variants[0]) && factories[variants[0]] 56 | end 57 | 58 | factory 59 | end 60 | 61 | def factory_bot_strategy(factory, model_prose, variants) 62 | return unless factory 63 | 64 | factory_name = factory_name_from_prose(model_prose) 65 | if factory_bot_class.factories[factory_name].nil? && variants.present? 66 | factory_name, *variants = variants 67 | end 68 | 69 | new(factory.build_class) do |attributes| 70 | # Cannot have additional scalar args after a varargs 71 | # argument in Ruby 1.8 and 1.9 72 | args = [] 73 | args += variants 74 | args << attributes 75 | factory_bot_class.create(factory_name, *args) 76 | end 77 | end 78 | 79 | def factory_bot_transient_attributes(factory, variants) 80 | return [] unless factory 81 | 82 | factory_attributes = factory_bot_attributes(factory, variants) 83 | class_attributes = factory.build_class.attribute_names.map(&:to_sym) 84 | 85 | factory_attributes - class_attributes 86 | end 87 | 88 | def factory_bot_attributes(factory, variants) 89 | traits = factory_bot_traits(factory, variants) 90 | factory.with_traits(traits.map(&:name)).definition.attributes.names 91 | end 92 | 93 | def factory_bot_traits(factory, variants) 94 | factory.definition.defined_traits.select do |trait| 95 | variants.include?(trait.name.to_sym) 96 | end 97 | end 98 | 99 | def alternative_strategy(model_prose, variants) 100 | model_class = parse_model_class(model_prose) 101 | machinist_strategy(model_class, variants) || 102 | active_record_strategy(model_class) || 103 | ruby_object_strategy(model_class) 104 | end 105 | 106 | def machinist_strategy(model_class, variants) 107 | return unless model_class.respond_to?(:make) 108 | 109 | new(model_class) do |attributes| 110 | if variants.present? 111 | variants.size == 1 or raise 'Machinist only supports a single variant per blueprint' 112 | model_class.make(variants.first, attributes) 113 | else 114 | model_class.make(attributes) 115 | end 116 | end 117 | end 118 | 119 | def active_record_strategy(model_class) 120 | return unless model_class.respond_to?(:create!) 121 | 122 | new(model_class) do |attributes| 123 | model = model_class.new 124 | CucumberFactory::Switcher.assign_attributes(model, attributes) 125 | model.save! 126 | model 127 | end 128 | end 129 | 130 | def ruby_object_strategy(model_class) 131 | new(model_class) do |attributes| 132 | model_class.new(attributes) 133 | end 134 | end 135 | 136 | def factory_bot_class 137 | factory_class = ::FactoryBot if defined?(FactoryBot) 138 | factory_class ||= ::FactoryGirl if defined?(FactoryGirl) 139 | factory_class 140 | end 141 | 142 | def factory_name_from_prose(model_prose) 143 | underscored_model_name(model_prose).to_s.underscore.gsub('/', '_').to_sym 144 | end 145 | 146 | def underscored_model_name(model_prose) 147 | # don't use \w which depends on the system locale 148 | model_prose.gsub(/[^A-Za-z0-9_\/]+/, "_") 149 | end 150 | 151 | end 152 | 153 | 154 | attr_reader :model_class 155 | 156 | def initialize(model_class, &block) 157 | @model_class = model_class 158 | @create_proc = block 159 | end 160 | 161 | def create_record(attributes) 162 | @create_proc.call(attributes) 163 | end 164 | 165 | end 166 | 167 | end 168 | -------------------------------------------------------------------------------- /media/makandra-with-bottom-margin.dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /media/makandra-with-bottom-margin.light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
7 |
14 |