From 609381274083f7a1c2e288124ccba7f128f9e1e9 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Tue, 5 Feb 2013 11:36:46 -0500 Subject: [PATCH 1/5] Allow focus on a specific test --- spec/spec_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7d6435c..4a9e65d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,6 +30,10 @@ def is_stale? RSpec.configure do |config| + # Allow focus on a specific test if specified + config.filter_run :focus => true + config.run_all_when_everything_filtered = true + # Give StaleFish temporary file which is ignored by git org_stale_fish_config = File.join(File.dirname(__FILE__), 'fixtures', 'stale_fish.yml') tmp_stale_fish_config = File.join(File.dirname(__FILE__), 'fixtures', 'stale_fish-tmp.yml') From f755cfa3b9e6e96fe1af0d0816db4ea7237a434f Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Tue, 5 Feb 2013 11:36:57 -0500 Subject: [PATCH 2/5] Removed defunct spec.opts file --- spec/spec.opts | 1 - 1 file changed, 1 deletion(-) delete mode 100644 spec/spec.opts diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 5052887..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1 +0,0 @@ ---color \ No newline at end of file From 8d36c855c06956028e81fff0eb71a804db65b9ca Mon Sep 17 00:00:00 2001 From: Alastair Mair Date: Thu, 7 Feb 2013 17:01:54 +0000 Subject: [PATCH 3/5] Fix parsing of iterations' stories. --- lib/pivotal-tracker/iteration.rb | 10 +++++----- spec/pivotal-tracker/iteration_spec.rb | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/pivotal-tracker/iteration.rb b/lib/pivotal-tracker/iteration.rb index f3757a2..5594f1c 100644 --- a/lib/pivotal-tracker/iteration.rb +++ b/lib/pivotal-tracker/iteration.rb @@ -7,7 +7,7 @@ def all(project, options={}) params = PivotalTracker.encode_options(options) parse(Client.connection["/projects/#{project.id}/iterations#{params}"].get) end - + def current(project) array = parse(Client.connection["projects/#{project.id}/iterations/current"].get) array.first if array @@ -22,19 +22,19 @@ def backlog(project, options={}) params = PivotalTracker.encode_options(options) parse(Client.connection["/projects/#{project.id}/iterations/backlog#{params}"].get) end - + def current_backlog(project, options={}) params = PivotalTracker.encode_options(options) parse(Client.connection["/projects/#{project.id}/iterations/current_backlog#{params}"].get) - end + end end - + element :id, Integer element :number, Integer element :start, DateTime element :finish, DateTime element :team_strength, Float - has_many :stories, Story + has_many :stories, Story, :xpath => '//stories' end end diff --git a/spec/pivotal-tracker/iteration_spec.rb b/spec/pivotal-tracker/iteration_spec.rb index 148d6eb..cc70330 100644 --- a/spec/pivotal-tracker/iteration_spec.rb +++ b/spec/pivotal-tracker/iteration_spec.rb @@ -48,7 +48,7 @@ @iterations.first.should be_a(PivotalTracker::Iteration) end end - + describe ".current_backlog" do before do @iterations = PivotalTracker::Iteration.current_backlog(@project) @@ -59,18 +59,31 @@ @iterations.first.should be_a(PivotalTracker::Iteration) end end - + describe ".team_strength" do before do @iteration = PivotalTracker::Iteration.current(@project) end - + it "should return a Float" do @iteration.should respond_to(:team_strength) @iteration.team_strength.should be_a(Float) end end - + + describe ".stories" do + before do + @iteration = PivotalTracker::Iteration.current(@project) + end + + it "There should be 1 story in the current iteration" do + @iteration.stories.should be_a(Array) + @iteration.stories.length.should eq(1) + @iteration.stories.first.description.should eq("Generic description") + @iteration.stories.first.estimate.should eq (2) + end + end + end From 049ec0ae717cab36b9feeefb37e4f76883c588a7 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Wed, 7 Aug 2013 14:01:01 -0400 Subject: [PATCH 4/5] Incorporate xpath fix suggested by @tienle --- lib/pivotal-tracker/iteration.rb | 2 +- spec/pivotal-tracker/iteration_spec.rb | 30 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/pivotal-tracker/iteration.rb b/lib/pivotal-tracker/iteration.rb index 5594f1c..13408e4 100644 --- a/lib/pivotal-tracker/iteration.rb +++ b/lib/pivotal-tracker/iteration.rb @@ -34,7 +34,7 @@ def current_backlog(project, options={}) element :start, DateTime element :finish, DateTime element :team_strength, Float - has_many :stories, Story, :xpath => '//stories' + has_many :stories, Story, :xpath => './/stories' end end diff --git a/spec/pivotal-tracker/iteration_spec.rb b/spec/pivotal-tracker/iteration_spec.rb index cc70330..b6abfd3 100644 --- a/spec/pivotal-tracker/iteration_spec.rb +++ b/spec/pivotal-tracker/iteration_spec.rb @@ -72,15 +72,31 @@ end describe ".stories" do - before do - @iteration = PivotalTracker::Iteration.current(@project) + context "for the current iteration" do + before do + @iteration = PivotalTracker::Iteration.current(@project) + end + + it "should include one story" do + @iteration.stories.should be_a(Array) + @iteration.stories.length.should eq(1) + @iteration.stories.first.description.should eq("Generic description") + @iteration.stories.first.estimate.should eq (2) + end end - it "There should be 1 story in the current iteration" do - @iteration.stories.should be_a(Array) - @iteration.stories.length.should eq(1) - @iteration.stories.first.description.should eq("Generic description") - @iteration.stories.first.estimate.should eq (2) + context "with multiple iterations" do + before do + @iteration1 = PivotalTracker::Iteration.current(@project) + @iteration2 = PivotalTracker::Iteration.backlog(@project).first + end + + it "should include the correct stories in each iteration" do + @iteration1.stories.count.should eq(1) + @iteration1.stories.first.name.should eq('Tasks Test') + @iteration2.stories.count.should eq(1) + @iteration2.stories.first.name.should eq('This is for comments') + end end end From 7298947fd5db2998767a49bf7a8da1dd03d913f2 Mon Sep 17 00:00:00 2001 From: Leon Miller-Out Date: Mon, 2 Sep 2013 22:11:14 -0400 Subject: [PATCH 5/5] Remove spec/spec.opts from gemspec --- pivotal-tracker.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/pivotal-tracker.gemspec b/pivotal-tracker.gemspec index 99141cd..d850ff2 100644 --- a/pivotal-tracker.gemspec +++ b/pivotal-tracker.gemspec @@ -71,7 +71,6 @@ Gem::Specification.new do |s| "spec/pivotal-tracker/project_spec.rb", "spec/pivotal-tracker/story_spec.rb", "spec/pivotal-tracker/task_spec.rb", - "spec/spec.opts", "spec/spec_helper.rb", "spec/support/stale_fish_fixtures.rb" ]