Sha256: ad881bf3f66186371223485c15d0670e6f91f063c7973b56d717716ace0ea671

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

describe Youroom::GetRoomList do
  describe "#initialize" do
    describe "when can create instance" do
      subject { Youroom::GetRoomList.new(access_token, 3) }
      it { should be_a(Youroom::GetRoomList) }
      its(:url) { should == Youroom::BASE_URL }
      its(:billing_id) { should == '3' }
      its(:access_token) { should == access_token }
    end

    describe "when can't create instance" do
      it "should raise ArgumentError" do
        lambda { Youroom::GetRoomList.new(access_token, ["hoge"]) }.should raise_exception(ArgumentError)
      end
    end
  end

  describe "#path" do
    describe "when url is default" do
      before do
        @client = Youroom::GetRoomList.new(access_token, 3)
      end

      subject { @client.path }
      it { should == File.join(@client.url, 'billings', '3', 'billing_groups?format=json') }
    end

    describe "when url is customized" do
      before do
        @client = Youroom::GetRoomList.new(access_token, 3, WW_URL)
      end

      subject { @client.path }
      it { should == File.join(@client.url, 'billings', '3', 'billing_groups?format=json') }
    end
  end

  describe "#call" do
    before do
      @client = Youroom::GetRoomList.new(access_token, 3, WW_URL)
      WW::Server.mock(:youroom).get("/youroom/billings/3/billing_groups") do
        { :status => "Created" }.to_json
      end
    end

    after do
      WW::Server.verify(:youroom)
    end

    subject { @client.get }
    it "should call request url" do
      should be_a_instance_of(Hash)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
youroom_api-0.1.4 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.1.3 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.1.2 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.1.1 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.1.0 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.0.13 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.0.12 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.0.11 spec/youroom_api/get_room_list_spec.rb
youroom_api-0.0.10 spec/youroom_api/get_room_list_spec.rb