Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator specs clean up after themselves. #3353

Merged
merged 1 commit into from
Mar 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
require 'spec_helper'
require 'fileutils'
require 'generator_spec/test_case'
require 'generators/refinery/engine/engine_generator'
require 'tmpdir'

module Refinery
describe EngineGenerator do
include GeneratorSpec::TestCase
destination Dir.mktmpdir
destination File.expand_path("../../../../../../tmp", __FILE__)

before do
prepare_destination
run_generator %w{ rspec_product_test title:string description:text image:image brochure:resource }
end

after do
FileUtils.rm_r destination_root
end

context "when generating a resource without passing a namespace" do
before do
run_generator %w{ rspec_item_test title:string --extension rspec_product_tests --skip }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'fileutils'
require 'generator_spec/test_case'
require 'generators/refinery/engine/engine_generator'

Expand All @@ -12,6 +13,10 @@ module Refinery
run_generator %w{ rspec_product_test title:string description:text image:image brochure:resource }
end

after do
FileUtils.rm_r destination_root
end

it "uses reference columns for image and resource attributes" do
File.open("#{destination_root}/vendor/extensions/rspec_product_tests/app/controllers/refinery/rspec_product_tests/admin/rspec_product_tests_controller.rb") do |file|
content = file.read
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'fileutils'
require 'generator_spec/test_case'
require 'generators/refinery/engine/engine_generator'

Expand All @@ -12,6 +13,10 @@ module Refinery
run_generator %w{ rspec_product_test title:string description:text image:image brochure:resource --authors Author1 Author2 }
end

after do
FileUtils.rm_r destination_root
end

it "uses reference columns for image and resource attributes" do
File.open("#{destination_root}/vendor/extensions/rspec_product_tests/refinerycms-rspec_product_tests.gemspec") do |file|
content = file.read
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'fileutils'
require 'generator_spec/test_case'
require 'generators/refinery/engine/engine_generator'

Expand All @@ -12,6 +13,10 @@ module Refinery
run_generator %w{ rspec_product_test title:string description:text image:image brochure:resource --i18n title description }
end

after do
FileUtils.rm_r destination_root
end

specify do
expect(destination_root).to have_structure {
directory "vendor" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'fileutils'
require 'generator_spec/test_case'
require 'generators/refinery/engine/engine_generator'

Expand All @@ -12,6 +13,10 @@ module Refinery
run_generator %w{ rspec_product_test title:string description:text image:image brochure:resource --skip-frontend }
end

after do
FileUtils.rm_r destination_root
end

specify do
expect(destination_root).to have_structure {
directory "vendor" do
Expand Down