logic_mappings_controller_spec.rb revision 23305f217b86a2ebf90a848af9036908e0070542
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksarequire 'spec_helper'
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa let!(:target_logic) { FactoryGirl.create :logic, user: user }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa let!(:source_logic) { FactoryGirl.create :logic, user: user }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa source: source_logic, target: target_logic, user: user
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { get :show, id: mapping.id, logic_id: source_logic.id }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa let!(:mapping_from_db) { LogicMapping.find_by_iri('http://test.de') }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(mapping_from_db.source).to eq(source_logic)
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(mapping_from_db.target).to eq(target_logic)
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa put :update, logic_id: source_logic.id, id: mapping.id,
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa let!(:mapping_from_db) { LogicMapping.find_by_iri('http://test2.de') }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(mapping_from_db.source).to eq(source_logic)
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(mapping_from_db.target).to eq(target_logic)
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { delete :destroy, id: mapping.id, logic_id: source_logic.id }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(LogicMapping.find_by_id(mapping.id)).to be_nil
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { get :edit, id: mapping.id, logic_id: source_logic.id }
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { get :show, id: mapping.id, logic_id: source_logic.id }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa let!(:mapping_from_db) { LogicMapping.find_by_iri('http://test.de') }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(mapping_from_db.source).to eq(source_logic)
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(mapping_from_db.target).to eq(target_logic)
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa put :update, logic_id: source_logic.id, id: mapping.id,
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(LogicMapping.find_by_iri('http://test2.de')).to be_nil
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { delete :destroy, id: mapping.id, logic_id: source_logic.id }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(LogicMapping.find_by_id(mapping.id)).to eq(mapping)
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { get :edit, id: mapping.id, logic_id: source_logic.id }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa it { should set_the_flash.to(/not authorized/i) }
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { get :show, id: mapping.id, logic_id: source_logic.id }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(LogicMapping.find_by_iri('http://test.de')).to be_nil
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa put :update, logic_id: source_logic.id, id: mapping.id,
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(LogicMapping.find_by_iri('http://test2.de')).to be_nil
23305f217b86a2ebf90a848af9036908e0070542Eugen Kuksa before { delete :destroy, id: mapping.id, logic_id: source_logic.id }