spec/github/activity/events/network_spec.rb in github_api-0.8.0 vs spec/github/activity/events/network_spec.rb in github_api-0.8.1

- old
+ new

@@ -24,38 +24,26 @@ it "should get the resources" do subject.network user, repo a_get(request_path).should have_been_made end - it "should return array of resources" do - events = subject.network user, repo - events.should be_an Array - events.should have(1).items + it_should_behave_like 'an array of resources' do + let(:requestable) { subject.network user, repo } end - it "should be a mash type" do - events = subject.network user, repo - events.first.should be_a Hashie::Mash - end - it "should get event information" do events = subject.network user, repo events.first.type.should == 'Event' end it "should yield to a block" do - subject.should_receive(:network).with(user, repo).and_yield('web') - subject.network(user, repo) { |param| 'web' } + yielded = [] + result = subject.network(user, repo) { |obj| yielded << obj } + yielded.should == result end end - context "resource not found" do - let(:body) { '' } - let(:status) { [404, "Not Found"] } - - it "should return 404 with a message 'Not Found'" do - expect { - subject.network user, repo - }.to raise_error(Github::Error::NotFound) - end + it_should_behave_like 'request failure' do + let(:requestable) { subject.network user, repo } end + end # network