9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksarequire 'spec_helper'
7c7a19761235efff584ee65a1c6dc4aa1735ff64Eugen Kuksa let!(:target_logic) { create :logic, user: user }
7c7a19761235efff584ee65a1c6dc4aa1735ff64Eugen Kuksa let!(:source_logic) { create :logic, user: user }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa source: source_logic, target: target_logic, user: user
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { get :show, id: mapping.to_param, 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)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa put :update, logic_id: source_logic.id, id: mapping.to_param,
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)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { delete :destroy, id: mapping.to_param, logic_id: source_logic.id }
db149239590d2a39d399f12cd01609b190ea4763Eugen Kuksa expect(LogicMapping.find_by_id(mapping.id)).to be(nil)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { get :edit, id: mapping.to_param, logic_id: source_logic.id }
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { get :show, id: mapping.to_param, 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)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa put :update, logic_id: source_logic.id, id: mapping.to_param,
db149239590d2a39d399f12cd01609b190ea4763Eugen Kuksa expect(LogicMapping.find_by_iri('http://test2.de')).to be(nil)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { delete :destroy, id: mapping.to_param, logic_id: source_logic.id }
9721f58c0c6959fae3a048672ad4eacc6a1123e7Eugen Kuksa expect(LogicMapping.find_by_id(mapping.id)).to eq(mapping)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { get :edit, id: mapping.to_param, logic_id: source_logic.id }
7ca38d75d045fade73b81bff6fdf34f4755d75fbEugen Kuksa expect(flash[:alert]).to match(/not authorized/)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { get :show, id: mapping.to_param, logic_id: source_logic.id }
7ca38d75d045fade73b81bff6fdf34f4755d75fbEugen Kuksa expect(flash[:alert]).to match(/not authorized/)
db149239590d2a39d399f12cd01609b190ea4763Eugen Kuksa expect(LogicMapping.find_by_iri('http://test.de')).to be(nil)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa put :update, logic_id: source_logic.id, id: mapping.to_param,
db149239590d2a39d399f12cd01609b190ea4763Eugen Kuksa expect(LogicMapping.find_by_iri('http://test2.de')).to be(nil)
1d2776811d0d5362a7aaaa09be8c80eb09b3a9e4Eugen Kuksa before { delete :destroy, id: mapping.to_param, logic_id: source_logic.id }