Sha256: 62a967db17e59ab01e1c251ff5d8711eb6837673ec40fc8eab5802c4bc392ab5
Contents?: true
Size: 1.47 KB
Versions: 12
Compression:
Stored size: 1.47 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Github::Activity::Notifications, '#get' do let(:thread_id) { 1 } let(:request_path) { "/notifications/threads/#{thread_id}" } before { stub_get(request_path).to_return(:body => body, :status => status, :headers => {:content_type => "application/json; charset=utf-8"}) } after { reset_authentication_for subject } context "resource found" do let(:body) { fixture('activity/threads.json') } let(:status) { 200 } it { should respond_to(:find) } it "should raise error when no thread-id parameter" do expect { subject.get nil }.to raise_error(ArgumentError) end it "should find resources" do subject.get thread_id a_get(request_path).should have_been_made end it "should return repository mash" do threads = subject.get thread_id threads.should be_an Array threads.should have(1).items end it "should get repository information" do threads = subject.get thread_id threads.first.repository.name.should == 'Hello-World' end it "should yield repositories to a block" do subject.should_receive(:get).and_yield('octocat') subject.get(thread_id) { |repo| 'octocat' } end end context "resource not found" do let(:body) { '' } let(:status) { 404 } it "should fail to get resource" do expect { subject.get thread_id }.to raise_error(Github::Error::NotFound) end end end # get
Version data entries
12 entries across 12 versions & 1 rubygems