test/story_test.rb in tracker_api-0.2.11 vs test/story_test.rb in tracker_api-0.2.12
- old
+ new
@@ -82,97 +82,112 @@
owners.wont_be_empty
owner = owners.first
owner.must_be_instance_of TrackerApi::Resources::Person
end
- it 'gets all owners for this story' do
- VCR.use_cassette('get story', record: :new_episodes) do
- story = project.story(story_id)
- owners = VCR.use_cassette('get owners for story') { story.owners }
+ it 'gets all owners for this story' do
+ VCR.use_cassette('get story', record: :new_episodes) do
+ story = project.story(story_id)
+ owners = VCR.use_cassette('get owners for story') { story.owners }
- owners.wont_be_empty
- owner = owners.first
- owner.must_be_instance_of TrackerApi::Resources::Person
+ owners.wont_be_empty
+ owner = owners.first
+ owner.must_be_instance_of TrackerApi::Resources::Person
+ end
end
end
-end
-describe '.tasks' do
- it 'gets all tasks for this story with eager loading' do
- VCR.use_cassette('get story with tasks', record: :new_episodes) do
- tasks = project.story(story_id, fields: ':default,tasks').tasks
+ describe '.tasks' do
+ it 'gets all tasks for this story with eager loading' do
+ VCR.use_cassette('get story with tasks', record: :new_episodes) do
+ tasks = project.story(story_id, fields: ':default,tasks').tasks
- tasks.wont_be_empty
- task = tasks.first
- task.must_be_instance_of TrackerApi::Resources::Task
+ tasks.wont_be_empty
+ task = tasks.first
+ task.must_be_instance_of TrackerApi::Resources::Task
+ end
end
- end
- it 'gets all tasks for this story' do
- VCR.use_cassette('get tasks', record: :new_episodes) do
- story = project.story(story_id)
- tasks = VCR.use_cassette('get tasks for story') { story.tasks }
+ it 'gets all tasks for this story' do
+ VCR.use_cassette('get tasks', record: :new_episodes) do
+ story = project.story(story_id)
+ tasks = VCR.use_cassette('get tasks for story') { story.tasks }
- tasks.wont_be_empty
- task = tasks.first
- task.must_be_instance_of TrackerApi::Resources::Task
+ tasks.wont_be_empty
+ task = tasks.first
+ task.must_be_instance_of TrackerApi::Resources::Task
+ end
end
- end
- it 'gets all tasks even when the project_id is excluded from the story fields' do
- VCR.use_cassette('get tasks when stories filtered', record: :new_episodes) do
- stories = project.stories(with_state: 'unstarted', fields: 'name,story_type')
- stories.each do |story|
- tasks = story.tasks
- unless tasks.empty?
- task = tasks.first
- task.must_be_instance_of TrackerApi::Resources::Task
+ it 'gets all tasks even when the project_id is excluded from the story fields' do
+ VCR.use_cassette('get tasks when stories filtered', record: :new_episodes) do
+ stories = project.stories(with_state: 'unstarted', fields: 'name,story_type')
+ stories.each do |story|
+ tasks = story.tasks
+ unless tasks.empty?
+ task = tasks.first
+ task.must_be_instance_of TrackerApi::Resources::Task
+ end
end
end
end
- end
- it 'can create task' do
- VCR.use_cassette('create task') do
- task = project.story(story_id).create_task(description: 'Test task')
+ it 'can create task' do
+ VCR.use_cassette('create task') do
+ task = project.story(story_id).create_task(description: 'Test task')
- task.must_be_instance_of TrackerApi::Resources::Task
- task.id.wont_be_nil
- task.id.must_be :>, 0
- task.description.must_equal 'Test task'
+ task.must_be_instance_of TrackerApi::Resources::Task
+ task.id.wont_be_nil
+ task.id.must_be :>, 0
+ task.description.must_equal 'Test task'
+ end
end
end
-end
-describe '.activity' do
- before do
- # create some activity
- story.name = "#{story.name}+"
+ describe '.activity' do
+ before do
+ # create some activity
+ story.name = "#{story.name}+"
- VCR.use_cassette('update story to create activity', record: :new_episodes) do
- story.save
+ VCR.use_cassette('update story to create activity', record: :new_episodes) do
+ story.save
+ end
end
+
+ it 'gets all the activity for this story' do
+ VCR.use_cassette('get story activity', record: :new_episodes) do
+ activity = story.activity
+
+ activity.wont_be_empty
+ event = activity.first
+ event.must_be_instance_of TrackerApi::Resources::Activity
+ end
+ end
end
- it 'gets all the activity for this story' do
- VCR.use_cassette('get story activity', record: :new_episodes) do
- activity = story.activity
+ describe '.owners' do
+ it 'gets all owners of this story' do
+ VCR.use_cassette('get story owners', record: :new_episodes) do
+ owners = story.owners
- activity.wont_be_empty
- event = activity.first
- event.must_be_instance_of TrackerApi::Resources::Activity
+ owners.wont_be_empty
+ owner = owners.first
+ owner.must_be_instance_of TrackerApi::Resources::Person
+ end
end
end
-end
-describe '.owners' do
- it 'gets all owners of this story' do
- VCR.use_cassette('get story owners', record: :new_episodes) do
- owners = story.owners
+ describe '.comments' do
+ it 'gets all comments of story with just project_id and story_id' do
+ VCR.use_cassette('get story comments', record: :new_episodes) do
+ story = TrackerApi::Resources::Story.new( client: client,
+ project_id: project_id,
+ id: story_id)
- owners.wont_be_empty
- owner = owners.first
- owner.must_be_instance_of TrackerApi::Resources::Person
+ comments = story.comments
+ comment = comments.first
+ comment.must_be_instance_of TrackerApi::Resources::Comment
+ end
end
end
-end
+
end