test/client_test.rb in tracker_api-0.2.6 vs test/client_test.rb in tracker_api-0.2.7

- old
+ new

@@ -84,11 +84,11 @@ let(:client) { TrackerApi::Client.new token: pt_user[:token] } let(:project_id) { pt_user[:project_id] } it 'auto paginates when needed' do VCR.use_cassette('client: get all stories with pagination', record: :new_episodes) do - project = client.project(project_id) + project = client.project(project_id) # skip pagination with a hugh limit unpaged_stories = project.stories(limit: 300) unpaged_stories.wont_be_empty unpaged_stories.length.must_be :>, 7 @@ -131,9 +131,53 @@ it 'retrieves a story solely by story id' do VCR.use_cassette('client: get single story by story id', record: :new_episodes) do story = client.story('66728004') story.must_be_instance_of TrackerApi::Resources::Story + end + end + end + + describe '.notifictions' do + let(:pt_user) { PT_USER_1 } + let(:client) { TrackerApi::Client.new token: pt_user[:token] } + + it 'gets authenticated persons notifications' do + VCR.use_cassette('get all notifications', record: :new_episodes) do + notifications = client.notifications + + notifications.wont_be_empty + notification = notifications.first + notification.must_be_instance_of TrackerApi::Resources::Notification + + notification.project.id.must_equal pt_user[:project_id] + notification.story.must_be_instance_of TrackerApi::Resources::Story + notification.performer.must_be_instance_of TrackerApi::Resources::Person + end + end + end + + describe '.activity' do + let(:pt_user) { PT_USER_1 } + let(:client) { TrackerApi::Client.new token: pt_user[:token] } + + it 'gets all my activities' do + VCR.use_cassette('get my activities', record: :new_episodes) do + activities = client.activity(fields: ':default') + + activities.wont_be_empty + activity = activities.first + activity.must_be_instance_of TrackerApi::Resources::Activity + + activity.changes.wont_be_empty + activity.changes.first.must_be_instance_of TrackerApi::Resources::Change + + activity.primary_resources.wont_be_empty + activity.primary_resources.first.must_be_instance_of TrackerApi::Resources::PrimaryResource + + activity.project.must_be_instance_of TrackerApi::Resources::Project + + activity.performed_by.must_be_instance_of TrackerApi::Resources::Person end end end end