spec/lib/coach/middleware_spec.rb in coach-1.0.0 vs spec/lib/coach/middleware_spec.rb in coach-2.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require "coach/middleware"
describe Coach::Middleware do
let(:middleware_class) { Class.new(described_class) }
let(:context_) { {} }
@@ -28,9 +30,32 @@
before { middleware_class.provides(:foo) }
it "returns false" do
# rubocop:disable RSpec/PredicateMatcher
expect(middleware_class.provides?(:baz)).to be_falsy
+ # rubocop:enable RSpec/PredicateMatcher
+ end
+ end
+ end
+
+ describe ".requires?" do
+ context "given names it does require" do
+ before { middleware_class.requires(:foo, :bar) }
+
+ it "returns true" do
+ # rubocop:disable RSpec/PredicateMatcher
+ expect(middleware_class.requires?(:foo)).to be_truthy
+ expect(middleware_class.requires?(:bar)).to be_truthy
+ # rubocop:enable RSpec/PredicateMatcher
+ end
+ end
+
+ context "given names it doesn't require" do
+ before { middleware_class.requires(:foo) }
+
+ it "returns false" do
+ # rubocop:disable RSpec/PredicateMatcher
+ expect(middleware_class.requires?(:bar)).to be_falsy
# rubocop:enable RSpec/PredicateMatcher
end
end
end