spec/controllers/naf/applications_controller_spec.rb in naf-2.0.4 vs spec/controllers/naf/applications_controller_spec.rb in naf-2.1.0
- old
+ new
@@ -14,57 +14,9 @@
Application.should_receive(:find).with("5").and_return(nil)
get :show, id: id
response.should be_success
end
- context "with regard to the edit action" do
-
- it "should build a new application schedule if it was destroyed" do
- @id = 5
- controller.stub(:check_application_run_group_name).and_return(nil)
- app_mock = mock_model(Application)
- schedule_mock = mock_model(ApplicationSchedule)
- schedule_prerequisites = mock_model(ApplicationSchedulePrerequisite)
- Application.should_receive(:find).with("5").and_return(app_mock)
- app_mock.should_receive(:application_schedule).and_return(nil)
- app_mock.should_receive(:build_application_schedule).and_return(schedule_mock)
- schedule_mock.should_receive(:application_schedule_prerequisites).and_return(schedule_prerequisites)
- schedule_prerequisites.should_receive(:build).and_return(nil)
- end
-
- it "should respond without building a new application schedule" do
- @id = 5
- controller.stub(:check_application_run_group_name).and_return(nil)
- app_mock = mock_model(Application)
- schedule_mock = mock_model(ApplicationSchedule)
- schedule_prerequisites = mock_model(ApplicationSchedulePrerequisite)
- app_mock.should_receive(:application_schedule).and_return(schedule_mock)
- Application.should_receive(:find).with("5").and_return(app_mock)
- schedule_mock.should_receive(:application_schedule_prerequisites).and_return(schedule_prerequisites)
- schedule_prerequisites.should_not_receive(:build)
- app_mock.should_not_receive(:build_application_schedule)
- end
-
- after(:each) do
- get :edit, id: @id
- response.should render_template("naf/applications/edit")
- response.should be_success
- end
- end
-
- it "should respond with affinity new" do
- app = double('app')
- app_schedule = double('application_schedule')
- schedule_prerequisites = double('schedule_prerequisites')
- Application.should_receive(:new).and_return(app)
- app.should_receive(:build_application_schedule).and_return(app_schedule)
- app_schedule.should_receive(:application_schedule_prerequisites).and_return(schedule_prerequisites)
- schedule_prerequisites.should_receive(:build).and_return(nil)
- get :new
- response.should render_template("naf/applications/new")
- response.should be_success
- end
-
context "on the create action" do
let(:application_schedule) { mock_model(ApplicationSchedule, application_run_group_name: 'command', prerequisites: []) }
let(:valid_app) { mock_model(Application, save: true, id: 5, update_attributes: true, application_schedule: application_schedule) }
let(:invalid_app) { mock_model(Application, save: false, update_attributes: false, application_schedule: application_schedule) }