1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
require 'guard/compat/test/template'
require 'guard/compat/example'
RSpec.describe Guard::MyPlugin do
describe 'template' do
subject { Guard::Compat::Test::Template.new(described_class) }
# Stub the template, because we are testing the helper, not the plugin
let(:template_contents) do
<<-EOS
guard :myplugin do
watch(/(foo).rb/) { |m| "spec/\#{m[1]}_spec.rb" }
watch(/bar.rb/)
end
EOS
end
before do
allow(IO).to receive(:read)
.with('lib/guard/myplugin/templates/Guardfile')
.and_return(template_contents)
end
it 'translates changes' do
expect(subject.changed('foo.rb')).to eq(['spec/foo_spec.rb'])
expect(subject.changed('bar.rb')).to eq(['bar.rb'])
end
end
end
|