forked from EugenMayer/docker-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance container synchronization custom matchers to check sync withi…
…n a time lapse without waiting for the full time ✨
- Loading branch information
1 parent
cc9337a
commit 33b2068
Showing
7 changed files
with
75 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ gemspec | |
group :test do | ||
gem 'rspec' | ||
gem 'rspec-bash' | ||
gem 'activesupport' | ||
gem 'os' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
require 'spec_helper' | ||
RSpec.shared_examples 'a synchronized directory' do |container_dir, options = {}| | ||
options[:within] ||= 1.second | ||
|
||
RSpec.shared_examples 'a synchronized directory' do |container_dir| | ||
it 'synchronizes on startup' do | ||
expect(host_app_path).to be_in_sync_with(container_dir).in_container('docker_sync_specs-sync') | ||
end | ||
|
||
it 'synchronizes files additions' do | ||
File.write(File.join(host_app_path, 'new_file.txt'), 'Hi, I am a new file') | ||
sleep 1 | ||
expect(host_app_path).to be_in_sync_with(container_dir).in_container('docker_sync_specs-sync') | ||
expect(host_app_path).to be_in_sync_with(container_dir).in_container('docker_sync_specs-sync').within(options[:within]) | ||
end | ||
|
||
it 'synchronizes files changes' do | ||
File.write(File.join(host_app_path, 'README.md'), 'Some new content', mode: 'a+') | ||
sleep 1 | ||
expect(host_app_path).to be_in_sync_with(container_dir).in_container('docker_sync_specs-sync') | ||
expect(host_app_path).to be_in_sync_with(container_dir).in_container('docker_sync_specs-sync').within(options[:within]) | ||
end | ||
|
||
it 'synchronizes files deletions' do | ||
File.delete(File.join(host_app_path, 'README.md')) | ||
sleep 1 | ||
expect(host_app_path).to be_in_sync_with(container_dir).in_container('docker_sync_specs-sync') | ||
expect(host_app_path).to be_in_sync_with(container_dir).in_container('docker_sync_specs-sync').within(options[:within]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters