Sha256: ffc9cd292067eefc7052c8a13a5a611d1857d618a7ac76e268a4c7ca01879485
Contents?: true
Size: 1.21 KB
Versions: 19
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require "spec_helper" describe "Doorkeeper::Models::Scopes" do subject do Class.new(Struct.new(:scopes)) do include Doorkeeper::Models::Scopes end.new end before do subject[:scopes] = "public admin" end describe :scopes do it "is a `Scopes` class" do expect(subject.scopes).to be_a(Doorkeeper::OAuth::Scopes) end it "includes scopes" do expect(subject.scopes).to include("public") end end describe :scopes= do it "accepts String" do subject.scopes = "private admin" expect(subject.scopes_string).to eq("private admin") end it "accepts Array" do subject.scopes = %w[private admin] expect(subject.scopes_string).to eq("private admin") end end describe :scopes_string do it "is a `Scopes` class" do expect(subject.scopes_string).to eq("public admin") end end describe :includes_scope? do it "should return true if at least one scope is included" do expect(subject.includes_scope?("public", "private")).to be true end it "should return false if no scopes are included" do expect(subject.includes_scope?("teacher", "student")).to be false end end end
Version data entries
19 entries across 19 versions & 2 rubygems