Sha256: f84c2c56f532fe1688a4d2985f730a72e733ca0192d8f48a8499dc325345eb02

Contents?: true

Size: 1.46 KB

Versions: 7

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

7 entries across 7 versions & 1 rubygems

Version Path
devise_invitable-1.3.5 test/generators_test.rb
devise_invitable-1.3.4 test/generators_test.rb
devise_invitable-1.3.3 test/generators_test.rb
devise_invitable-1.3.2 test/generators_test.rb
devise_invitable-1.3.1 test/generators_test.rb
devise_invitable-1.3.0 test/generators_test.rb
devise_invitable-1.2.1 test/generators_test.rb