Sha256: 8a09a3f4c8779c9c747ff51d4b0feb9cb6e3ce6d3bb4322b44f9299e39e06471

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

Contents

require 'spec_helper'

describe RestPack::Service::Command do
  context 'with a commands in a namespace like TextService::Commands::Text::Reverse' do
    it 'defines sugar methods' do
      TextService::Text.respond_to?(:reverse).should == true
      TextService::Text.respond_to?(:reverse!).should == true
      TextService::Text.reverse!(text: 'gavin').should == 'nivag'
    end

    it 'defines aliases' do
      command = TextService::Commands::Text::Reverse

      command::Model.should == TextService::Models::Text
      command::Serializer.should == TextService::Serializers::Text
      command::Commands.should == TextService::Commands
      command::Models.should == TextService::Models
    end
  end

  context 'with a commands in a namespace like Commands::Template::Create' do
    it 'defines sugar methods' do
      Commands::Math.respond_to?(:add).should == true
      Commands::Math.respond_to?(:add!).should == true
      Commands::Math.add!(a: 1, b: 2).should == 3
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restpack_service-0.0.64 spec/command_spec.rb
restpack_service-0.0.63 spec/command_spec.rb