1
0

scenario_imports_controller_spec.rb 757 B

1234567891011121314151617181920212223242526
  1. require 'rails_helper'
  2. describe ScenarioImportsController do
  3. before do
  4. sign_in users(:bob)
  5. end
  6. describe "GET new" do
  7. it "initializes a new ScenarioImport and renders new" do
  8. get :new
  9. expect(assigns(:scenario_import)).to be_a(ScenarioImport)
  10. expect(response).to render_template(:new)
  11. end
  12. end
  13. describe "POST create" do
  14. it "initializes a ScenarioImport for current_user, passing in params" do
  15. post :create, params: {:scenario_import => { :url => "bad url" }}
  16. expect(assigns(:scenario_import).user).to eq(users(:bob))
  17. expect(assigns(:scenario_import).url).to eq("bad url")
  18. expect(assigns(:scenario_import)).not_to be_valid
  19. expect(response).to render_template(:new)
  20. end
  21. end
  22. end