Sha256: ac88e378c8187b4fc9715ddff8f44f58aa08af7f7257562fc336008c50430cd3

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'katapult/elements/action'

describe Katapult::Action do

  subject { described_class.new 'action' }

  describe '#post?' do
    it 'returns true when its method is :post' do
      subject.method = :post
      expect(subject.post?).to be true
    end

    it 'returns false when its method is :get' do
      subject.method = :get
      expect(subject.post?).to be false
    end
  end

  describe '#member?' do
    it 'returns true when its scope is :member' do
      subject.scope = :member
      expect(subject.member?).to be true
    end

    it 'returns false when its scope is :collection' do
      subject.scope = :collection
      expect(subject.member?).to be false
    end

    it 'returns false when it is an index action' do
      subject = described_class.new :index
      expect(subject.member?).to be false
    end
  end

  describe '#collection?' do
    it 'returns true when it is an index action' do
      subject = described_class.new :index
      expect(subject.collection?).to be true
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katapult-0.5.0 spec/action_spec.rb
katapult-0.4.1 spec/action_spec.rb
katapult-0.4.0 spec/action_spec.rb