Sha256: b52d74028b7832a215e71233e00104ceb57b003ec52ef5955c491c5e4610c6bb

Contents?: true

Size: 1.32 KB

Versions: 12

Compression:

Stored size: 1.32 KB

Contents

shared_examples_for "collection of resources" do

    context "resource found" do
      before do
        stub_get(resource_path).
          to_return(:body => fixture(fixture_dir), :status => 200, :headers => {:content_type => "application/json; charset=utf-8"})
      end

      it "should fail to get resource without username" do
        github.user, github.repo = nil, nil
        expect { github.issues.milestones nil, repo }.to raise_error(ArgumentError)
      end

      it "should get the resources" do
        github.send *method_chain, user, repo
        a_get(resource_path).should have_been_made
      end

      it "should return array of resources" do
        milestones = github.issues.milestones user, repo
        milestones.should be_an Array
        milestones.should have(1).items
      end

      it "should be a mash type" do
        milestones = github.issues.milestones user, repo
        milestones.first.should be_a Hashie::Mash
      end

      it "should get issue information" do
        milestones = github.issues.milestones user, repo
        milestones.first.title.should == 'v1.0'
      end

      it "should yield to a block" do
        github.issues.should_receive(:milestones).with(user, repo).and_yield('web')
        github.issues.milestones(user, repo) { |param| 'web' }.should == 'web'
      end
    end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
github_api-0.4.8 spec/support/github_api_shared_examples.rb
github_api-0.4.7 spec/support/github_api_shared_examples.rb
github_api-0.4.6 spec/support/github_api_shared_examples.rb
github_api-0.4.5 spec/support/github_api_shared_examples.rb
github_api-0.4.4 spec/support/github_api_shared_examples.rb
github_api-0.4.3 spec/support/github_api_shared_examples.rb
github_api-0.4.2 spec/support/github_api_shared_examples.rb
github_api-0.4.1 spec/support/github_api_shared_examples.rb
github_api-0.4.0 spec/support/github_api_shared_examples.rb
github_api-0.3.9 spec/support/github_api_shared_examples.rb
github_api-0.3.8 spec/support/github_api_shared_examples.rb
github_api-0.3.7 spec/support/github_api_shared_examples.rb