Sha256: 6adeb362f581d8a743d05264db2b6c8525425b3adb77ea6e1184ec308af3b2e7

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

module FootStats
  describe Request do
    subject { Request.new(stub(resource_name: 'fake', resource_key: 'fake_key')) }

    before do
      Request.any_instance.stub(:post).and_return('{}')
    end

    describe '#resource_name' do
      its(:resource_name) { should eq 'fake' }
    end

    describe '#resource_key' do
      its(:resource_key) { should eq 'fake_key' }
    end

    describe '#request_url' do
      it 'should return the base url with resource name' do
        Setup.stub(:base_url).and_return('http://foo.com')
        subject.request_url.should eq 'http://foo.com/fake'
      end
    end

    describe '#setup_params' do
      before do
        Setup.stub(:username).and_return('username')
        Setup.stub(:password).and_return('password')
      end

      its(:setup_params) do
        should eq({ Usuario: 'username', Senha: 'password' } )
      end
    end

    describe '#parse' do
      it 'should create a response object' do
        subject.parse.should be_instance_of(Response)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foot_stats-0.1.0 spec/foot_stats/request_spec.rb
foot_stats-0.0.1 spec/foot_stats/request_spec.rb