-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run RSpec tests on rails and non-rails environments
- Loading branch information
Showing
21 changed files
with
127 additions
and
71 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,26 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'pathname' | ||
|
||
describe UberTask::Internal::Path do | ||
describe '.shorten' do | ||
let(:paths) do | ||
[ | ||
'/foo/bar/baz/gems/bar', | ||
'/foo/bar/rubygems/baz', | ||
] | ||
end | ||
|
||
it 'shortens paths' do | ||
shortened = paths.map do |path| | ||
described_class.shorten(path) | ||
end | ||
expect(shortened).to eq( | ||
%w[ | ||
[GEM]/bar | ||
[GEM]/baz | ||
], | ||
) | ||
end | ||
end | ||
end |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,25 @@ | ||
# frozen_string_literal: true | ||
|
||
DUMMY_RAILS_APP_PATH = 'tmp/test/dummy/' | ||
|
||
namespace :rails do | ||
desc 'Generate dummy rails application' | ||
task :generate_dummy_app, [:app_path] do |_t, args| | ||
app_path = args.fetch(:app_path, DUMMY_RAILS_APP_PATH) | ||
|
||
if Dir.exist?(app_path) | ||
puts "Using Rails application at #{app_path} for tests..." | ||
next | ||
end | ||
|
||
puts "Generating dummy Rails application at #{app_path}..." | ||
system( | ||
"rails new #{app_path} " \ | ||
'--skip-git --skip-asset-pipeline --skip-action-cable ' \ | ||
'--skip-action-mailer --skip-action-mailbox --skip-action-text ' \ | ||
'--skip-active-record --skip-active-job --skip-active-storage ' \ | ||
'--skip-javascript --skip-hotwire --skip-jbuilder ' \ | ||
'--skip-test --skip-system-test --skip-bootsnap ', | ||
) | ||
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,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'pathname' | ||
|
||
describe UberTask::Internal::Path do | ||
describe '.shorten' do | ||
let(:paths) do | ||
[ | ||
Rails.root.join('abc').to_s, | ||
'/foo/bar/baz/gems/bar', | ||
'/foo/bar/rubygems/baz', | ||
] | ||
end | ||
|
||
it 'shortens paths' do | ||
shortened = paths.map do |path| | ||
described_class.shorten(path) | ||
end | ||
expect(shortened).to eq( | ||
%w[ | ||
[PROJECT]/abc | ||
[GEM]/bar | ||
[GEM]/baz | ||
], | ||
) | ||
end | ||
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
describe UberTask do | ||
before do | ||
described_class.instance_variable_set(:@logger, nil) | ||
end | ||
|
||
describe '.logger' do | ||
subject(:logger) { described_class.logger } | ||
|
||
it 'uses Rails logger by default' do | ||
expect(Rails.logger).to receive(:info).with('some message') | ||
|
||
logger.info('some message') | ||
end | ||
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
This file was deleted.
Oops, something went wrong.