Sha256: 10592e687b3c31f36bd0e25a4bc3516d848aa8c43936d45f0f56769ffd3ea20b

Contents?: true

Size: 1.58 KB

Versions: 8

Compression:

Stored size: 1.58 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
require 'test_helper'
require 'rails/generators'
require 'generators/devise_invitable/devise_invitable_generator'

class GeneratorsTest < ActiveSupport::TestCase
  RAILS_APP_PATH = File.expand_path("../rails_app", __FILE__)

  test "rails g should include the 6 generators" do
    @output     = `cd #{RAILS_APP_PATH} && rails g`
    generators  = %w/devise_invitable devise_invitable:form_for devise_invitable:install devise_invitable:invitation_views devise_invitable:simple_form_for devise_invitable:views/

    generators.each do |generator|
      @output.include? generator
    end
  end

  test "rails g devise_invitable:install" do
    @output = `cd #{RAILS_APP_PATH} && rails g devise_invitable:install -p`
    puts @output
    assert @output.match(%r{(inject|insert|File unchanged! The supplied flag value not found!).*  config/initializers/devise\.rb\n})
    assert @output.match(%r|create.*  config/locales/devise_invitable\.en\.yml\n|)
  end

  test "rails g devise_invitable Octopussy" do
    @output = `cd #{RAILS_APP_PATH} && rails g devise_invitable Octopussy -p`
    assert @output.match(%r{(inject|insert|File unchanged! The supplied flag value not found!).*  app/models/octopussy\.rb\n})
    assert @output.match(%r|invoke.*  #{DEVISE_ORM}\n|)
    if DEVISE_ORM == :active_record
      assert @output.match(%r|create.*  db/migrate/\d{14}_devise_invitable_add_to_octopussies\.rb\n|)
    elsif DEVISE_ORM == :mongoid
      assert !@output.match(%r|create.*  db/migrate/\d{14}_devise_invitable_add_to_octopussies\.rb\n|)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/devise_invitable-2.0.9/test/generators_test.rb
devise_invitable-2.0.9 test/generators_test.rb
devise_invitable-2.0.8 test/generators_test.rb
devise_invitable-2.0.7 test/generators_test.rb
devise_invitable-2.0.6 test/generators_test.rb
devise_invitable-2.0.5 test/generators_test.rb
devise_invitable-2.0.4 test/generators_test.rb
devise_invitable-2.0.3 test/generators_test.rb