Skip to content

Commit

Permalink
Readd spec for #1067
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Jan 19, 2017
1 parent 669f530 commit 39fe724
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/nanoc/regressions/gh_1067_spec.rb
@@ -0,0 +1,34 @@
describe 'GH-1067', site: true, stdio: true do
before do
File.write('nanoc.yaml', <<EOS)
environments:
default:
build: dev
prod:
build: prod
EOS

File.write('content/foo.erb', 'build=<%= @config[:build] %>')

File.write('Rules', <<EOS)
compile '/*' do
filter :erb
write item.identifier
end
EOS
end

it 'recompiles when env changes' do
ENV['NANOC_ENV'] = nil
Nanoc::CLI.run(%w(compile))
expect(File.read('output/foo.erb')).to eql('build=dev')

ENV['NANOC_ENV'] = nil
Nanoc::CLI.run(%w(compile -e prod))
expect(File.read('output/foo.erb')).to eql('build=prod')

ENV['NANOC_ENV'] = nil
Nanoc::CLI.run(%w(compile))
expect(File.read('output/foo.erb')).to eql('build=dev')
end
end

0 comments on commit 39fe724

Please sign in to comment.