Sha256: 6d48697cef4e6823c6a505eebb20f1f850484de7326643ccf189647b389f6949

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 KB

Contents

describe ChatWork::Me do
  describe ".get", type: :api do
    subject { ChatWork::Me.get }

    before do
      stub_chatwork_request(:get, "/me")
    end

    it_behaves_like :a_chatwork_api, :get, "/me"

    its(:account_id)        { should eq 123 }
    its(:room_id)           { should eq 322 }
    its(:name)              { should eq "John Smith" }
    its(:chatwork_id)       { should eq "tarochatworkid" }
    its(:organization_id)   { should eq 101 }
    its(:organization_name) { should eq "Hello Company" }
    its(:department)        { should eq "Marketing" }
    its(:title)             { should eq "CMO" }
    its(:url)               { should eq "http://mycompany.example.com" }
    its(:introduction)      { should eq "Self Introduction" }
    its(:mail)              { should eq "taro@example.com" }
    its(:tel_organization)  { should eq "XXX-XXXX-XXXX" }
    its(:tel_extension)     { should eq "YYY-YYYY-YYYY" }
    its(:tel_mobile)        { should eq "ZZZ-ZZZZ-ZZZZ" }
    its(:skype)             { should eq "myskype_id" }
    its(:facebook)          { should eq "myfacebook_id" }
    its(:twitter)           { should eq "mytwitter_id" }
    its(:avatar_image_url)  { should eq "https://example.com/abc.png" }
    its(:login_mail)        { should eq "account@example.com" }

    context "when unauthorized" do
      before do
        stub_chatwork_request(:get, "/me", "/me", 401)
      end

      it { expect { subject }.to raise_error(ChatWork::APIError, "Invalid API token") }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chatwork-0.7.0 spec/lib/chatwork/me_spec.rb
chatwork-0.6.2 spec/lib/chatwork/me_spec.rb
chatwork-0.6.1 spec/lib/chatwork/me_spec.rb
chatwork-0.6.0 spec/lib/chatwork/me_spec.rb