Skip to content

Commit

Permalink
move to rspec; add ruby tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros committed Jul 5, 2020
1 parent 23982d8 commit f51882c
Show file tree
Hide file tree
Showing 18 changed files with 291 additions and 271 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
tag: ["~dependency" "dependency:ruby"]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
Expand All @@ -27,4 +28,4 @@ jobs:
- name: Bundle Install
run: bundle install
- name: Integration Tests
run: rake test
run: bundle exec rspec --tag ${{ matrix.tag }}
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source 'https://rubygems.org'

gem 'minitest', '~> 5.14.1'
gem 'minitest-hooks', '~> 1.5.0'
gem 'rake', '~> 13.0.1'
gem 'byebug', '~> 11.1.3'
gem 'rspec', '~> 3.9.0'
27 changes: 17 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
GEM
remote: https://rubygems.org/
specs:
minispec-metadata (3.3.1)
minitest
minitest (5.14.1)
minitest-hooks (1.5.0)
minitest (> 5.3)
rake (13.0.1)
byebug (11.1.3)
diff-lcs (1.4.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)

PLATFORMS
ruby

DEPENDENCIES
minispec-metadata (~> 3.3.1)
minitest (~> 5.14.1)
minitest-hooks (~> 1.5.0)
rake (~> 13.0.1)
byebug (~> 11.1.3)
rspec (~> 3.9.0)

BUNDLED WITH
2.1.4
9 changes: 0 additions & 9 deletions Rakefile

This file was deleted.

10 changes: 0 additions & 10 deletions integration/commands/cd_test.rb

This file was deleted.

33 changes: 0 additions & 33 deletions integration/commands/clone_test.rb

This file was deleted.

28 changes: 0 additions & 28 deletions integration/commands/doctor_test.rb

This file was deleted.

32 changes: 0 additions & 32 deletions integration/dependencies/ruby_test.rb

This file was deleted.

143 changes: 0 additions & 143 deletions integration/test_helper.rb

This file was deleted.

2 changes: 1 addition & 1 deletion internal/catalog/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/task/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func Run(ctx context.Context, ui ui.UI, p *project.Project, name string, fun fun
if err := te.Resolve(ctx, p); err != nil {
s.Fail()
errs <- err
return
} else {
done, err := te.Check(ctx, p)
if err != nil {
Expand Down
5 changes: 4 additions & 1 deletion loon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ tasks:
command: go test ./... -v -bench=. $@
integration:
description: Runs integration tests
command: rake test
command: bundle exec rspec --tag "~dependency"
integration:dependency:
description: Runs integration tests (with dependencies)
command: bundle exec rspec
10 changes: 10 additions & 0 deletions spec/commands/cd_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe 'Commands' do
describe 'cd' do
it 'should emit a finisher' do
loon %w(cd andremedeiros/loon)

assert_status 0
assert_finalizer 'chdir', "#{ENV['HOME']}/src/github.com/andremedeiros/loon"
end
end
end
32 changes: 32 additions & 0 deletions spec/commands/clone_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
describe 'Commands' do
describe 'clone' do
around(:each) do |example|
with_environment(home: Dir.mktmpdir) do
example.run
end
end

it 'should respect source tree setting' do
with_config(source_tree: '$HOME/{owner}/{name}') do
loon %w(clone andremedeiros/ruby-demo)

assert_status 0
assert_path "#{ENV['HOME']}/andremedeiros/ruby-demo/.git"
end
end

it 'should check out a repo' do
loon %w(clone andremedeiros/ruby-demo)

assert_status 0
assert_path "#{ENV['HOME']}/src/github.com/andremedeiros/ruby-demo/.git"
end

it 'should emit a finisher' do
loon %w(clone andremedeiros/ruby-demo)

assert_status 0
assert_finalizer 'chdir', "#{ENV['HOME']}/src/github.com/andremedeiros/ruby-demo"
end
end
end
Loading

0 comments on commit f51882c

Please sign in to comment.