Sha256: bc7931abb9eb8722dfc8d46398609491861e79ffcd3dff4509bbd27588ec49f6

Contents?: true

Size: 1.77 KB

Versions: 3

Compression:

Stored size: 1.77 KB

Contents

require "generator_spec"
require File.expand_path('../../../../lib/generators/social_framework/views_generator', __FILE__)

module SocialFramework
  module Generators
    RSpec.describe ViewsGenerator, type: :generator do
      destination File.expand_path("../../tmp", __FILE__)

      before(:each) do
        prepare_destination
      end

      after(:each) do
        FileUtils.rm_rf("spec/generators/tmp")
      end

      describe "Add views" do
        it "Add all" do
          run_generator
          expect(File).to exist("#{destination_root}/app/views/devise/confirmations")
          expect(File).to exist("#{destination_root}/app/views/devise/passwords")
          expect(File).to exist("#{destination_root}/app/views/devise/registrations")
          expect(File).to exist("#{destination_root}/app/views/devise/sessions")
          expect(File).to exist("#{destination_root}/app/views/devise/unlocks")
          expect(File).to exist("#{destination_root}/app/views/devise/mailer")
          expect(File).to exist("#{destination_root}/app/views/devise/shared")
        end

        it "Add specific views" do
          run_generator %w(-v confirmations registrations)
          expect(File).to exist("#{destination_root}/app/views/devise/confirmations")
          expect(File).to exist("#{destination_root}/app/views/devise/registrations")
          expect(File).to exist("#{destination_root}/app/views/devise/shared")

          expect(File).not_to exist("#{destination_root}/app/views/devise/sessions")
          expect(File).not_to exist("#{destination_root}/app/views/devise/unlocks")
          expect(File).not_to exist("#{destination_root}/app/views/devise/mailer")
          expect(File).not_to exist("#{destination_root}/app/views/devise/passwords")
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
social_framework-1.0.1 spec/generators/social_framework/views_generator_spec.rb
social_framework-0.0.3 spec/generators/social_framework/views_generator_spec.rb
social_framework-0.0.2 spec/generators/social_framework/views_generator_spec.rb