Sha256: 04939ba83f591dbc33e4b7ac4ca40f391edd080cf4fb5c143f88bc8fdd156784

Contents?: true

Size: 1.45 KB

Versions: 14

Compression:

Stored size: 1.45 KB

Contents

require 'generators/rspec'

module Rspec
  module Generators
    class OauthProviderGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)

      argument :name, :type => :string, :default => 'Oauth'
      class_option :fixture, :type => :boolean

      def copy_controller_spec_files
        template 'clients_controller_spec.rb',
          File.join('spec/controllers', class_path, "#{file_name}_clients_controller_spec.rb")
      end

      def copy_models_spec_files
        template 'client_application_spec.rb',  File.join('spec/models', 'client_application_spec.rb')
        template 'oauth_token_spec.rb',         File.join('spec/models', 'oauth_token_spec.rb')
        template 'oauth2_token_spec.rb',        File.join('spec/models', 'oauth2_token_spec.rb')
        template 'oauth2_verifier_spec.rb',     File.join('spec/models', 'oauth2_verifier_spec.rb')
        template 'oauth_nonce_spec.rb',         File.join('spec/models', 'oauth_nonce_spec.rb')
      end

      hook_for :fixture_replacement

      def create_fixture_file
        if options[:fixtures] && options[:fixture_replacement].nil?
          template 'client_applications.yml', File.join('test/fixtures', 'client_applications.yml')
          template 'oauth_tokens.yml',        File.join('test/fixtures', 'oauth_tokens.yml')
          template 'oauth_nonces.yml',        File.join('test/fixtures', 'oauth_nonces.yml')
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 5 rubygems

Version Path
houston-oauth-plugin-0.5.1 lib/generators/rspec/oauth_provider_generator.rb
panjiva-oauth-plugin-0.4.1 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.5.1 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.5.0 lib/generators/rspec/oauth_provider_generator.rb
oauth-provider-0.5.0rc1 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.4.1 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.4.0 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.4.0.rc2 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.4.0.rc1 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.4.0.pre7 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.4.0.pre6 lib/generators/rspec/oauth_provider_generator.rb
oauth-plugin-0.4.0.pre5 lib/generators/rspec/oauth_provider_generator.rb
insrc-oauth-plugin-0.4.0.pre6 lib/generators/rspec/oauth_provider_generator.rb
insrc-oauth-plugin-0.4.0.pre5 lib/generators/rspec/oauth_provider_generator.rb