-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
clipboard_spec.rb
27 lines (23 loc) 路 1.01 KB
/
clipboard_spec.rb
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
describe FastlaneCore do
describe FastlaneCore::Clipboard do
describe '#copy and paste' do
before(:each) do
@test_message = "_fastlane_ is awesome"
end
it 'should work on supported environments', if: FastlaneCore::Clipboard.is_supported? do
# Save clipboard
clipboard = FastlaneCore::Clipboard.paste
# Test copy and paste
FastlaneCore::Clipboard.copy(content: @test_message)
expect(FastlaneCore::Clipboard.paste).to eq(@test_message)
# Restore clipboard
FastlaneCore::Clipboard.copy(content: clipboard)
expect(FastlaneCore::Clipboard.paste).to eq(clipboard)
end
it 'should throw on non-supported environment', if: !FastlaneCore::Clipboard.is_supported? do
expect { FastlaneCore::Clipboard.copy(content: @test_message) }.to raise_error("'pbcopy' or 'pbpaste' command not found.")
expect { FastlaneCore::Clipboard.paste }.to raise_error("'pbcopy' or 'pbpaste' command not found.")
end
end
end
end