Sha256: 5aa524537b32ec54471faa98c48516c825d69fc18e92756dd68898c9694c3256

Contents?: true

Size: 1008 Bytes

Versions: 7

Compression:

Stored size: 1008 Bytes

Contents

require 'test_helper'
require 'generators/shopify_app/routes/routes_generator'

class ControllerGeneratorTest < Rails::Generators::TestCase
  tests ShopifyApp::Generators::RoutesGenerator
  destination File.expand_path("../tmp", File.dirname(__FILE__))

  setup do
    prepare_destination
    provide_existing_routes_file
    provide_existing_initializer_file
  end

  test "copies ShopifyApp routes to the host application" do
    run_generator

    assert_file "config/routes.rb" do |routes|
      assert_match "get 'login' => :new, :as => :login", routes
      assert_match "post 'login' => :create, :as => :authenticate", routes
      assert_match "get 'auth/shopify/callback' => :callback", routes
      assert_match "get 'logout' => :destroy, :as => :logout", routes
    end
  end

  test "adds routes false to ShopifyApp initializer" do
    run_generator

    assert_file "config/initializers/shopify_app.rb" do |initializer|
      assert_match "config.routes = false", initializer
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shopify_app-6.0.6 test/generators/routes_generator_test.rb
shopify_app-6.0.5 test/generators/routes_generator_test.rb
shopify_app-6.0.4 test/generators/routes_generator_test.rb
shopify_app-6.0.3 test/generators/routes_generator_test.rb
shopify_app-6.0.2 test/generators/routes_generator_test.rb
shopify_app-6.0.1 test/generators/routes_generator_test.rb
shopify_app-6.0.0 test/generators/routes_generator_test.rb