Sha256: 0495ebd9a3d0b6c1efa56dc8ba0ddc46d7733303d41ab6a32c913d8c99340ed7

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

class InstallGeneratorTest < Rails::Generators::TestCase
  tests Maestrano::Generators::InstallGenerator
  destination File.expand_path("../../tmp", __FILE__)
  
  setup do
    prepare_destination
    copy_routes
  end
  
  should "create the maestrano initializer" do
    run_generator
    assert_file "config/initializers/maestrano.rb"
  end
  
  should "create the maestrano/auth/saml controller" do
    run_generator
    assert_file "app/controllers/maestrano/auth/saml_controller.rb"
  end
  
  should "create the maestrano routes" do
    
    run_generator
    match = /namespace\s+:maestrano\s+do\n\s*namespace\s+:auth\s+do\n\s*resources\s+:saml,\s+only:\[\]\s+do\n\s*get 'init',\son:\s:collection\n\s*post\s'consume',\s+on:\s+:collection(\n\s*end){3}/
    assert_file "config/routes.rb", match
  end
  
  def copy_routes
    routes = File.expand_path("../../test_files/config/routes.rb", __FILE__)
    destination = File.join(destination_root, "config")

    FileUtils.mkdir_p(destination)
    FileUtils.cp routes, destination
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
maestrano-rails-0.4.0 test/generators/install_generator_test.rb
maestrano-rails-0.3.0 test/generators/install_generator_test.rb
maestrano-rails-0.2.0 test/generators/install_generator_test.rb
maestrano-rails-0.1.0 test/generators/install_generator_test.rb