Sha256: 4702ac78522f0fb4ca59d67aaa4081bf5b4e27f3cdc0d7aefc9303e65ee6a3ff

Contents?: true

Size: 987 Bytes

Versions: 25

Compression:

Stored size: 987 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Users::Emails, '#add' do
  let(:email) { "octocat@github.com" }
  let(:request_path) { "/user/emails" }

  before {
    subject.oauth_token = OAUTH_TOKEN
    stub_post(request_path).with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
      to_return(:body => body, :status => status,
        :headers => {:content_type => "application/json; charset=utf-8"})
  }

  after { reset_authentication_for(subject) }

  let(:params) { { :per_page => 21, :page => 1 }}
  let(:body) { fixture('users/emails.json') }
  let(:status) { 200 }

  it 'extracts request parameters and email data' do
    subject.should_receive(:post_request).
      with(request_path, { "per_page" => 21, "page" => 1, "data" => [email] })
    subject.add email, params
  end

  it 'submits request successfully' do
    subject.add email
    a_post(request_path).with(:query => { :access_token => "#{OAUTH_TOKEN}"}).
      should have_been_made
  end
end # add

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
github_api-0.11.3 spec/github/users/emails/add_spec.rb
github_api-0.11.2 spec/github/users/emails/add_spec.rb
github_api-0.11.1 spec/github/users/emails/add_spec.rb
github_api-0.11.0 spec/github/users/emails/add_spec.rb
github_api-0.10.2 spec/github/users/emails/add_spec.rb
github_api-0.10.1 spec/github/users/emails/add_spec.rb
github_api-0.10.0 spec/github/users/emails/add_spec.rb
github_api-0.9.7 spec/github/users/emails/add_spec.rb
github_api-0.9.6 spec/github/users/emails/add_spec.rb
github_api-0.9.5 spec/github/users/emails/add_spec.rb
github_api-0.9.4 spec/github/users/emails/add_spec.rb
github_api-0.9.3 spec/github/users/emails/add_spec.rb
github_api-0.9.2 spec/github/users/emails/add_spec.rb
github_api-0.9.1 spec/github/users/emails/add_spec.rb
github_api-0.9.0 spec/github/users/emails/add_spec.rb
github_api-0.8.11 spec/github/users/emails/add_spec.rb
github_api-0.8.10 spec/github/users/emails/add_spec.rb
github_api-0.8.9 spec/github/users/emails/add_spec.rb
github_api-0.8.8 spec/github/users/emails/add_spec.rb
github_api-0.8.7 spec/github/users/emails/add_spec.rb