Skip to content

Shared testing configuration for Piktur applications

License

Notifications You must be signed in to change notification settings

piktur/piktur_spec

Repository files navigation

Piktur Spec

Install the following gems globally:

  rvm gemset use ruby-2.5.1@global
  gem install dotenv
  gem install bundler

  rvm gemset use ruby-2.5.1@piktur
  bin/bundle install

Add gems piktur and piktur_spec to the Gemfile.

  gem 'piktur',                 git:    "https://github.com/piktur/piktur.git",
                                branch: 'master'

  group :test do
    gem 'piktur_spec',            git:    "https://github.com/piktur/piktur_spec.git",
                                  branch: 'master'
    gem 'rspec'
    gem 'simplecov',              require: false
  end

Configure Spring.application_root

  # ./config/spring.rb

  Spring.application_root = './spec/dummy'

Utilise the test application as follows.

  # ./spec/dummy/config/application.rb`
  # frozen_string_literal: true

  require 'piktur/spec'
  Piktur::Spec.define_rails_application!

  # OR

  require File.join(Gem.loaded_specs['piktur_spec'].gem_dir, 'config/environment')

  # ./spec/dummy/config/environment.rb
  # frozen_string_literal: true

  require 'piktur/spec'
  Piktur::Spec.init_rails_application!

  # OR

  require File.join(Gem.loaded_specs['piktur_spec'].gem_dir, 'config/application')

Ensure /bin/rspec exists and is executable chmod +x ./bin/rspec. If not add the file based on this snippet or copy the following:

  #!/usr/bin/env ruby
  # frozen_string_literal: true

  begin
    load Gem.bin_path('piktur', 'piktur')
  rescue Gem::Exception
    load File.expand_path('piktur/bin/test', ENV.fetch('PIKTUR_HOME'))
  end

About

Shared testing configuration for Piktur applications

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages