Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We investigated using the clipboard gem but it was deemed to be unnecessarily complicated, and made assumptions that we'd rather not be lumbered with.
- Loading branch information
Showing
7 changed files
with
112 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--color | ||
--format progress | ||
-r ./spec/spec_helper.rb |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
task :default => :test | ||
|
||
desc 'run the tests' # that's non-DRY | ||
task :test do | ||
sh 'rspec spec' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
describe '...' do | ||
before do | ||
@saved_path = ENV['PATH'] | ||
@bobo_url = 'http://example.com' | ||
end | ||
|
||
after do | ||
ENV['PATH'] = @saved_path | ||
end | ||
|
||
def ask_for_copy | ||
Jist.on_success({'html_url' => @bobo_url}.to_json, :copy => true ) | ||
end | ||
def jist_but_dont_ask_for_copy | ||
Jist.on_success({'html_url' => 'http://example.com/'}.to_json) | ||
end | ||
|
||
it 'should try to copy the url when the clipboard option is passed' do | ||
Jist.should_receive(:copy).with(@bobo_url) | ||
ask_for_copy | ||
end | ||
|
||
it "should not copy when not asked to" do | ||
Jist.should_not_receive(:copy).with(@bobo_url) | ||
jist_but_dont_ask_for_copy | ||
end | ||
|
||
it "should raise an error if no copying mechanisms are available" do | ||
ENV['PATH'] = '' | ||
lambda{ | ||
ask_for_copy | ||
}.should raise_error(/Could not find copy command/) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This file was generated by the `rspec --init` command. Conventionally, all | ||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. | ||
# Require this file using `require "spec_helper.rb"` to ensure that it is only | ||
# loaded once. | ||
# | ||
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration | ||
RSpec.configure do |config| | ||
config.treat_symbols_as_metadata_keys_with_true_values = true | ||
config.run_all_when_everything_filtered = true | ||
config.filter_run :focus | ||
end | ||
|
||
require_relative '../lib/jist' |