Sha256: 94daf1cacd694bd53643b0d8692cd50ac889a25f3e091f200271092c784b8705

Contents?: true

Size: 1.46 KB

Versions: 20

Compression:

Stored size: 1.46 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`
    assert @output.match(%r{(inject|insert).*  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).*  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

20 entries across 20 versions & 1 rubygems

Version Path
devise_invitable-2.0.2 test/generators_test.rb
devise_invitable-2.0.1 test/generators_test.rb
devise_invitable-2.0.0 test/generators_test.rb
devise_invitable-1.7.5 test/generators_test.rb
devise_invitable-1.7.4 test/generators_test.rb
devise_invitable-1.7.3 test/generators_test.rb
devise_invitable-1.7.2 test/generators_test.rb
devise_invitable-1.7.1 test/generators_test.rb
devise_invitable-1.7.0 test/generators_test.rb
devise_invitable-1.6.1 test/generators_test.rb
devise_invitable-1.6.0 test/generators_test.rb
devise_invitable-1.5.5 test/generators_test.rb
devise_invitable-1.5.3 test/generators_test.rb
devise_invitable-1.5.2 test/generators_test.rb
devise_invitable-1.5.1 test/generators_test.rb
devise_invitable-1.5.0 test/generators_test.rb
devise_invitable-1.4.2 test/generators_test.rb
devise_invitable-1.4.1 test/generators_test.rb
devise_invitable-1.4.0 test/generators_test.rb
devise_invitable-1.3.6 test/generators_test.rb