Skip to content

Commit

Permalink
Add spec for Clipboard::Java
Browse files Browse the repository at this point in the history
  • Loading branch information
janlelis committed Apr 5, 2024
1 parent 45a7ff7 commit 8f33057
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
ruby-version: ${{matrix.ruby}}
bundler-cache: true
- name: Run tests
run: bundle exec rake
uses: coactions/setup-xvfb@v1
with:
run: bundle exec rake

test-windows:
name: Ruby ${{ matrix.ruby }} (windows-latest)
Expand Down
25 changes: 25 additions & 0 deletions spec/clipboard_java_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require_relative "spec_helper"

if RUBY_ENGINE === "jruby"
require 'clipboard/java'

describe "Clipboard::Java" do
before :all do
Clipboard.implementation = Clipboard::Java
end

it "can copy & paste" do
expect( Clipboard.copy('example') ).to eq true
expect( Clipboard.paste ).to eq 'example'
end

it "can clear" do
expect( Clipboard.copy('example') ).to eq true
expect( Clipboard.paste ).to eq 'example'
Clipboard.clear
expect( Clipboard.paste ).to eq ''
end
end
end

0 comments on commit 8f33057

Please sign in to comment.