Sha256: 4a0a6b0611dc31cee71175678f93bdb38691d6046ce88a2a8fad9d88192a035e

Contents?: true

Size: 1.65 KB

Versions: 10

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'

module RailsBestPractices::Core
  describe Check::Exceptable do
    let(:method) { Method.new "BlogPost", "approve", "public", {} }

    context "wildcard class and method" do
      let(:except_method) { '*#*' }

      it "matches" do
        expect(Check::Exceptable.matches(method, except_method)).to eql true
      end
    end

    context "wildcard class and matching explicit method" do
      let(:except_method) { '*#approve' }

      it "matches" do
        expect(Check::Exceptable.matches(method, except_method)).to eql true
      end
    end

    context "wildcard class and non-matching explicit method" do
      let(:except_method) { '*#disapprove' }

      it "matches" do
        expect(Check::Exceptable.matches(method, except_method)).to eql false
      end
    end

    context "matching class and wildcard method" do
      let(:except_method) { 'BlogPost#*' }

      it "matches" do
        expect(Check::Exceptable.matches(method, except_method)).to eql true
      end
    end

    context "non-matching class and wildcard method" do
      let(:except_method) { 'User#*' }

      it "matches" do
        expect(Check::Exceptable.matches(method, except_method)).to eql false
      end
    end

    context "matching class and matching method" do
      let(:except_method) { 'BlogPost#approve' }

      it "matches" do
        expect(Check::Exceptable.matches(method, except_method)).to eql true
      end
    end

    context "non-matching class and non-matching method" do
      let(:except_method) { 'User#disapprove' }

      it "matches" do
        expect(Check::Exceptable.matches(method, except_method)).to eql false
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rails_best_practices-1.19.0 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.18.1 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.18.0 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.17.0 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.16.0 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.15.7 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.15.6 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.15.4 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.15.3 spec/rails_best_practices/core/except_methods_spec.rb
rails_best_practices-1.15.2 spec/rails_best_practices/core/except_methods_spec.rb