test/project_test.rb in tracker_api-0.2.6 vs test/project_test.rb in tracker_api-0.2.7
- old
+ new
@@ -61,10 +61,37 @@
story = current.stories.first
story.must_be_instance_of TrackerApi::Resources::Story
end
end
+
+ it 'can get an iteration by number' do
+ VCR.use_cassette('get iteration by number', record: :new_episodes) do
+ iterations = project.iterations(number: 2)
+
+ iterations.size.must_equal 1
+ iterations.first.must_be_instance_of TrackerApi::Resources::Iteration
+ iterations.first.number.must_equal 2
+
+ iterations = project.iterations(number: 1)
+
+ iterations.size.must_equal 1
+ iterations.first.must_be_instance_of TrackerApi::Resources::Iteration
+ iterations.first.number.must_equal 1
+
+ iterations = project.iterations(number: 10_000)
+
+ iterations.must_be_empty
+ end
+ end
+
+ it 'requires an iteration number > 0' do
+ VCR.use_cassette('get iteration by number', record: :new_episodes) do
+ -> { project.iterations(number: 0) }.must_raise(ArgumentError, /> 0/)
+ -> { project.iterations(number: -1) }.must_raise(ArgumentError, /> 0/)
+ end
+ end
end
describe '.stories' do
it 'can get unscheduled stories' do
VCR.use_cassette('get unscheduled stories', record: :new_episodes) do
@@ -84,9 +111,32 @@
story.must_be_instance_of TrackerApi::Resources::Story
story.id.wont_be_nil
story.id.must_be :>, 0
story.name.must_equal 'Test story'
+ end
+ end
+ end
+
+ describe '.activity' do
+ let(:story) { VCR.use_cassette('get unscheduled story') { project.stories(with_state: :unscheduled).first } }
+
+ before do
+ # create some activity
+ story.name = "#{story.name}+"
+
+ VCR.use_cassette('update story to create activity', record: :new_episodes) do
+ story.save
+ end
+ end
+
+ it 'gets all the activity for this project' do
+ VCR.use_cassette('get project activity', record: :new_episodes) do
+ activity = project.activity
+
+ activity.wont_be_empty
+ event = activity.first
+ event.must_be_instance_of TrackerApi::Resources::Activity
end
end
end
end