Fix warnings in specs

Ruby isn't OK with this anymore.
This commit is contained in:
Ryan Fitzgerald 2018-11-06 09:47:53 -08:00
parent 1c26dd5afd
commit 2b792b3175
3 changed files with 22 additions and 22 deletions

View File

@ -16,29 +16,29 @@ describe "find-route" do
it 'returns the route for a single action' do
output = mock_pry('find-route Admin::UsersController#show', 'exit-all')
output.must_match /show GET/
output.wont_match /index GET/
output.must_match(/show GET/)
output.wont_match(/index GET/)
end
it 'returns all the routes for a controller' do
output = mock_pry('find-route Admin::UsersController', 'exit-all')
output.must_match /index GET/
output.must_match /show GET/
output.must_match /new GET/
output.must_match /edit GET/
output.must_match /update (PATCH|PUT)/
output.must_match /update PUT/
output.must_match /destroy DELETE/
output.must_match(/index GET/)
output.must_match(/show GET/)
output.must_match(/new GET/)
output.must_match(/edit GET/)
output.must_match(/update (PATCH|PUT)/)
output.must_match(/update PUT/)
output.must_match(/destroy DELETE/)
end
it 'returns all routes for controllers under a namespace' do
output = mock_pry('find-route Admin', 'exit-all')
output.must_match /Routes for Admin::UsersController/
output.must_match /Routes for Admin::ImagesController/
output.must_match(/Routes for Admin::UsersController/)
output.must_match(/Routes for Admin::ImagesController/)
end
it 'returns no routes found when controller is not recognized' do
output = mock_pry('find-route Foo', 'exit-all')
output.must_match /No routes found/
output.must_match(/No routes found/)
end
end

View File

@ -28,21 +28,21 @@ describe "recognize-path" do
it "prints info about controller/action that is bound to the given path" do
output = mock_pry('recognize-path example.com', 'exit-all')
output.must_match /controller.+foo/
output.must_match /action.+index/
output.must_match(/controller.+foo/)
output.must_match(/action.+index/)
end
it "accepts short path" do
output = mock_pry('recognize-path /booms/1/edit', 'exit-all')
output.must_match /action.+edit/
output.must_match /controller.+booms/
output.must_match /id.+1/
output.must_match(/action.+edit/)
output.must_match(/controller.+booms/)
output.must_match(/id.+1/)
end
it "accepts -m switch" do
output = mock_pry('recognize-path example.com/booms -m post', 'exit-all')
output.must_match /controller.+booms/
output.must_match /action.+create/
output.must_match(/controller.+booms/)
output.must_match(/action.+create/)
end
it "doesn't accept unknown methods" do

View File

@ -32,8 +32,8 @@ Artist
embeds_many :instruments (validate)
MODEL
output.gsub! /^ *_type: String\n/, '' # mongoid 3.0 and 3.1 differ on this
output.gsub! /Moped::BSON/, 'BSON' # mongoid 3 and 4 differ on this
output.gsub!(/^ *_type: String\n/, '') # mongoid 3.0 and 3.1 differ on this
output.gsub!(/Moped::BSON/, 'BSON') # mongoid 3 and 4 differ on this
output.must_equal expected
end
end
@ -50,6 +50,6 @@ MODEL
it "should print help if no model name is given" do
output = mock_pry('show-model', 'exit-all')
output.must_match /Usage: show-model/
output.must_match(/Usage: show-model/)
end
end