Sha256: f64e317064a3eff920694e62f450660851d8fc90833bc3fd70b2dcdccf0e4903
Contents?: true
Size: 1.55 KB
Versions: 3
Compression:
Stored size: 1.55 KB
Contents
RSpec.describe Card::Set::Type::NotificationTemplate do include ActionController::TestCase::Behavior before do @routes = Decko::Engine.routes @controller = CardController.new login_as "joe_user" create "A+*self+*on update", type_id: Card::PointerID, content: "[[success]]" end def notify Card::Auth.as_bot do post :update, params: { mark: "A", card: { "content" => "change" } }, xhr: true end end context "without fields" do before do create "success", type_id: Card::NotificationTemplateID, content: "success" end describe "#deliver" do it "is called on update" do notify_card = Card["success"] allow(notify_card).to receive(:deliver) Card["A"].update! content: "change" expect(notify_card).to have_received(:deliver).once end end it "shows notification" do notify expect(response.body).to have_tag "div.alert.alert-success" do with_text(/success/) end end end context "with fields" do before do create "success", type_id: Card::NotificationTemplateID, content: "success", subfields: { contextual_class: "danger", disappear: "1", message: "failed" } end it "shows notification" do notify expect(response.body).to have_tag "div.alert.alert-danger._disappear" do with_text(/failed/) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems