Sha256: e4d8c2ebaa5b1ff264489c121da0d38446ad6f47b6f5b9598d1aad4ad236c10b
Contents?: true
Size: 942 Bytes
Versions: 4
Compression:
Stored size: 942 Bytes
Contents
require "rails_helper" RSpec.describe ArticlesController, type: :controller do describe "PaperTrail.enabled_for_controller?" do context "PaperTrail.enabled? == true" do before { PaperTrail.enabled = true } it "returns true" do assert PaperTrail.enabled? post :create, params_wrapper(article: { title: "Doh", content: FFaker::Lorem.sentence }) expect(assigns(:article)).not_to be_nil assert PaperTrail.enabled_for_controller? assert_equal 1, assigns(:article).versions.length end after { PaperTrail.enabled = false } end context "PaperTrail.enabled? == false" do it "returns false" do assert !PaperTrail.enabled? post :create, params_wrapper(article: { title: "Doh", content: FFaker::Lorem.sentence }) assert !PaperTrail.enabled_for_controller? assert_equal 0, assigns(:article).versions.length end end end end
Version data entries
4 entries across 4 versions & 2 rubygems