Sha256: 00e9b5ea82ebfda28f11aee974dcb651464785f2fdf110f138f290ec0647c429
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' RSpec.describe ResourceKit::Action do subject(:action) { ResourceKit::Action.new(:bunk) } describe '#initialize' do it 'initializes with a name' do instance = ResourceKit::Action.new(:all) expect(instance.name).to eq(:all) end end describe '#verb' do it 'sets the verb' do action = described_class.new(:find) action.verb :get expect(action.verb).to be(:get) end end describe '#path' do it 'sets the path' do action = described_class.new(:find) action.path '/something/sammy' expect(action.path).to eq('/something/sammy') end end describe '#handler' do it 'adds a handler to the handlers' do expect { action.handler(202) { } }.to change(action.handlers, :size).from(0).to(1) end it 'adds the correct status code when using a symbol' do action.handler(:ok) {} expect(action.handlers).to have_key(200) end end describe '#handlers' do it 'returns a handler collection object' do collection = action.handlers expect(collection).to be_kind_of(Hash) end end describe '#body' do it 'stores a proc for handling requests with bodies' do handler = Proc.new {|object| 'whut whut' } action.body(&handler) expect(action.body).to be(handler) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
resource_kit-0.0.3 | spec/lib/resource_kit/action_spec.rb |
resource_kit-0.0.1 | spec/lib/resource_kit/action_spec.rb |