Sha256: 67d9401db0950f064d6892e7721787fbda2e67b50308f9b89bcc4cf7cc3c8aa3

Contents?: true

Size: 1.17 KB

Versions: 13

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Github::Activity::Notifications, '#create' do
  let(:thread_id) { 1 }
  let(:request_path) { "/notifications/threads/#{thread_id}/subscription" }

  let(:inputs) {{
    :subscribed => true,
    :ignored => false
  }}

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

  after { reset_authentication_for subject }

  context "resource created successfully" do
    let(:body)  { fixture('activity/subscribed.json') }
    let(:status) { 200 }

    it 'asserts thread id presence' do
      expect { subject.create nil }.to raise_error(ArgumentError)
    end

    it 'should create resource' do
      subject.create thread_id, inputs
      a_put(request_path).
        with(:body => inputs, :query => {:access_token => OAUTH_TOKEN}).
        should have_been_made
    end

    it 'should return the resource' do
      thread = subject.create thread_id, inputs
      thread.subscribed.should be_true
    end
  end
end # create

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
github_api-0.9.0 spec/github/activity/notifications/create_spec.rb
github_api-0.8.11 spec/github/activity/notifications/create_spec.rb
github_api-0.8.10 spec/github/activity/notifications/create_spec.rb
github_api-0.8.9 spec/github/activity/notifications/create_spec.rb
github_api-0.8.8 spec/github/activity/notifications/create_spec.rb
github_api-0.8.7 spec/github/activity/notifications/create_spec.rb
github_api-0.8.6 spec/github/activity/notifications/create_spec.rb
github_api-0.8.5 spec/github/activity/notifications/create_spec.rb
github_api-0.8.4 spec/github/activity/notifications/create_spec.rb
github_api-0.8.3 spec/github/activity/notifications/create_spec.rb
github_api-0.8.2 spec/github/activity/notifications/create_spec.rb
github_api-0.8.1 spec/github/activity/notifications/create_spec.rb
github_api-0.8.0 spec/github/activity/notifications/create_spec.rb