test/client_test.rb in tracker_api-1.9.1 vs test/client_test.rb in tracker_api-1.10.0

- old
+ new

@@ -1,46 +1,46 @@ require_relative 'minitest_helper' describe TrackerApi do it 'has a version' do - ::TrackerApi::VERSION.wont_be_nil + _(::TrackerApi::VERSION).wont_be_nil end end describe TrackerApi::Client do it 'can be configured' do client = TrackerApi::Client.new(url: 'http://test.com', api_version: '/foo-bar/1', token: '12345', logger: LOGGER) - client.url.must_equal 'http://test.com' - client.api_version.must_equal '/foo-bar/1' - client.token.must_equal '12345' - client.logger.must_equal LOGGER + _(client.url).must_equal 'http://test.com' + _(client.api_version).must_equal '/foo-bar/1' + _(client.token).must_equal '12345' + _(client.logger).must_equal LOGGER end describe '.projects' do let(:pt_user) { PT_USER_1 } let(:client) { TrackerApi::Client.new token: pt_user[:token] } it 'gets all projects' do VCR.use_cassette('get all projects', record: :new_episodes) do projects = client.projects(fields: ':default,account,current_velocity,labels(name),epics(:default,label(name))') - projects.wont_be_empty + _(projects).wont_be_empty project = projects.first - project.must_be_instance_of TrackerApi::Resources::Project - project.id.must_equal pt_user[:project_id] + _(project).must_be_instance_of TrackerApi::Resources::Project + _(project.id).must_equal pt_user[:project_id] - project.account.must_be_instance_of TrackerApi::Resources::Account + _(project.account).must_be_instance_of TrackerApi::Resources::Account - project.labels.wont_be_empty - project.labels.first.must_be_instance_of TrackerApi::Resources::Label + _(project.labels).wont_be_empty + _(project.labels.first).must_be_instance_of TrackerApi::Resources::Label - project.epics.wont_be_empty - project.epics.first.must_be_instance_of TrackerApi::Resources::Epic + _(project.epics).wont_be_empty + _(project.epics.first).must_be_instance_of TrackerApi::Resources::Epic end end end describe '.project' do @@ -50,15 +50,15 @@ it 'gets a project by id' do VCR.use_cassette('get project', record: :new_episodes) do project = client.project(project_id) - project.must_be_instance_of TrackerApi::Resources::Project - project.id.must_equal project_id + _(project).must_be_instance_of TrackerApi::Resources::Project + _(project.id).must_equal project_id - project.account.must_be_nil - project.account_id.wont_be_nil + _(project.account).must_be_nil + _(project.account_id).wont_be_nil end end end describe '.workspace' do @@ -67,13 +67,13 @@ it 'gets a workspace by id' do VCR.use_cassette('get workspace', record: :new_episodes) do workspace = client.workspace(pt_user[:workspace_id]) - workspace.must_be_instance_of TrackerApi::Resources::Workspace - workspace.id.must_equal pt_user[:workspace_id] - workspace.name.wont_be_empty + _(workspace).must_be_instance_of TrackerApi::Resources::Workspace + _(workspace.id).must_equal pt_user[:workspace_id] + _(workspace.name).wont_be_empty end end end @@ -83,14 +83,14 @@ it 'gets all workspaces' do VCR.use_cassette('get all workspaces', record: :new_episodes) do workspaces = client.workspaces(fields: ':default,projects(id,name)') - workspaces.wont_be_empty + _(workspaces).wont_be_empty workspace = workspaces.first - workspace.must_be_instance_of TrackerApi::Resources::Workspace - workspace.id.must_equal pt_user[:workspace_id] + _(workspace).must_be_instance_of TrackerApi::Resources::Workspace + _(workspace.id).must_equal pt_user[:workspace_id] end end end @@ -103,14 +103,14 @@ it 'gets info about the authenticated user' do VCR.use_cassette('get me', record: :new_episodes) do me = client.me - me.must_be_instance_of TrackerApi::Resources::Me - me.username.must_equal username + _(me).must_be_instance_of TrackerApi::Resources::Me + _(me.username).must_equal username - me.projects.map(&:project_id).must_include project_id + _(me.projects.map(&:project_id)).must_include project_id end end end describe '.paginate' do @@ -122,40 +122,40 @@ VCR.use_cassette('client: get all stories with pagination', record: :new_episodes) do 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 + _(unpaged_stories).wont_be_empty + _(unpaged_stories.length).must_be :>, 7 # force pagination with a small limit paged_stories = project.stories(limit: 7) - paged_stories.wont_be_empty - paged_stories.length.must_equal unpaged_stories.length - paged_stories.map(&:id).sort.uniq.must_equal unpaged_stories.map(&:id).sort.uniq + _(paged_stories).wont_be_empty + _(paged_stories.length).must_equal unpaged_stories.length + _(paged_stories.map(&:id).sort.uniq).must_equal unpaged_stories.map(&:id).sort.uniq end end it 'allows auto pagination to be turned off when just a subset of a list is desired' do VCR.use_cassette('client: get limited stories with no pagination', record: :new_episodes) do project = client.project(project_id) # force no pagination stories = project.stories(limit: 7, auto_paginate: false) - stories.wont_be_empty - stories.length.must_equal 7 + _(stories).wont_be_empty + _(stories.length).must_equal 7 end end it 'can handle negative offsets' do VCR.use_cassette('client: done iterations with pagination', record: :new_episodes) do project = client.project(project_id) done_iterations = project.iterations(scope: :done, offset: -12, limit: 5) - done_iterations.wont_be_empty - done_iterations.length.must_be :<=, 12 + _(done_iterations).wont_be_empty + _(done_iterations.length).must_be :<=, 12 end end end describe '.story' do @@ -164,12 +164,12 @@ 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', fields: ':default,owned_by') - story.must_be_instance_of TrackerApi::Resources::Story - story.owned_by.wont_be_nil + _(story).must_be_instance_of TrackerApi::Resources::Story + _(story.owned_by).wont_be_nil end end end describe '.epic' do @@ -178,12 +178,12 @@ it 'retrieves an epic solely by epic id' do VCR.use_cassette('client: get single epic by epic id', record: :new_episodes) do epic = client.epic('1087314', fields: ':default,label_id') - epic.must_be_instance_of TrackerApi::Resources::Epic - epic.label_id.wont_be_nil + _(epic).must_be_instance_of TrackerApi::Resources::Epic + _(epic.label_id).wont_be_nil end end end describe '.notifictions' do @@ -192,17 +192,17 @@ it 'gets authenticated persons notifications' do VCR.use_cassette('get all notifications', record: :new_episodes) do notifications = client.notifications - notifications.wont_be_empty + _(notifications).wont_be_empty notification = notifications.first - notification.must_be_instance_of TrackerApi::Resources::Notification + _(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 + _(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 @@ -211,22 +211,22 @@ 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 + _(activities).wont_be_empty activity = activities.first - activity.must_be_instance_of TrackerApi::Resources::Activity + _(activity).must_be_instance_of TrackerApi::Resources::Activity - activity.changes.wont_be_empty - activity.changes.first.must_be_instance_of TrackerApi::Resources::Change + _(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.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.project).must_be_instance_of TrackerApi::Resources::Project - activity.performed_by.must_be_instance_of TrackerApi::Resources::Person + _(activity.performed_by).must_be_instance_of TrackerApi::Resources::Person end end end end