Skip to content

Commit

Permalink
Merge pull request #606 from maheshm/destroy_spec
Browse files Browse the repository at this point in the history
Destroy spec
  • Loading branch information
jodosha committed Jul 9, 2016
2 parents 3cef2c6 + 7235122 commit 6988d6a
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions test/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,37 @@

describe 'destroy' do
describe 'action' do
let(:default_options) { {'skip_view' => false} }
describe 'for container application' do
before { setup_container_app }

it 'raises an error when app and controller name are missing' do
ARGV.replace(%w{destroy action})

Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do
_, err = capture_io { Hanami::Cli.start }
assert_match 'ERROR', err
end
end

it 'raises an error when controller name is missing' do
ARGV.replace(%w{destroy action foo})

Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do
_, err = capture_io { Hanami::Cli.start }
assert_match 'ERROR', err
end
end

it 'raises an error when app name is missing' do
ARGV.replace(%w{destroy action controller#action})

Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do
_, err = capture_io { Hanami::Cli.start }
assert_match 'ERROR', err
end
end
end

describe 'for app application' do
before do
setup_app_app
Expand All @@ -168,7 +198,11 @@
end

it 'raises error when controller name is missing' do
skip()
ARGV.replace(%w{destroy action})
Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do
_, err = capture_io { Hanami::Cli.start }
assert_match 'ERROR', err
end
end
end
end
Expand Down

0 comments on commit 6988d6a

Please sign in to comment.