cardigan 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/.gemtest +0 -0
  2. data/Rakefile +6 -0
  3. data/bin/cardigan +2 -0
  4. data/lib/cardigan/cli.rb +18 -20
  5. data/lib/cardigan/command/add_transitions.rb +27 -0
  6. data/lib/cardigan/command/batch_update_cards.rb +15 -14
  7. data/lib/cardigan/command/change_status.rb +18 -11
  8. data/lib/cardigan/command/change_value.rb +11 -10
  9. data/lib/cardigan/command/claim_cards.rb +15 -13
  10. data/lib/cardigan/command/commit_changes.rb +15 -0
  11. data/lib/cardigan/command/count_cards.rb +6 -2
  12. data/lib/cardigan/command/create_card.rb +14 -11
  13. data/lib/cardigan/command/destroy_cards.rb +15 -13
  14. data/lib/cardigan/command/edit_value.rb +12 -11
  15. data/lib/cardigan/command/export_cards.rb +9 -4
  16. data/lib/cardigan/command/filter_cards.rb +6 -0
  17. data/lib/cardigan/command/import_cards.rb +18 -4
  18. data/lib/cardigan/command/list_cards.rb +5 -0
  19. data/lib/cardigan/command/open_card.rb +20 -12
  20. data/lib/cardigan/command/open_workflow.rb +14 -12
  21. data/lib/cardigan/command/remove_transitions.rb +25 -0
  22. data/lib/cardigan/command/show_entry.rb +12 -10
  23. data/lib/cardigan/command/specify_display_columns.rb +6 -0
  24. data/lib/cardigan/command/specify_sort_columns.rb +6 -0
  25. data/lib/cardigan/command/total_cards.rb +6 -2
  26. data/lib/cardigan/command/unclaim_cards.rb +13 -13
  27. data/lib/cardigan/command/unfilter_cards.rb +6 -0
  28. data/lib/cardigan/commands.rb +10 -0
  29. data/lib/cardigan/entry_context.rb +7 -12
  30. data/lib/cardigan/filtered_repository.rb +9 -5
  31. data/lib/cardigan/io.rb +1 -1
  32. data/lib/cardigan/root_context.rb +21 -23
  33. data/lib/cardigan/workflow_context.rb +12 -29
  34. data/lib/cardigan/workflow_repository.rb +18 -10
  35. data/spec/command/add_transitions_spec.rb +35 -0
  36. data/spec/command/batch_update_cards_spec.rb +9 -0
  37. data/spec/command/change_status_spec.rb +9 -0
  38. data/spec/command/change_value_spec.rb +9 -0
  39. data/spec/command/claim_cards_spec.rb +9 -0
  40. data/spec/command/commit_changes_spec.rb +9 -0
  41. data/spec/command/count_cards_spec.rb +68 -0
  42. data/spec/command/create_card_spec.rb +9 -0
  43. data/spec/command/destroy_cards_spec.rb +9 -0
  44. data/spec/command/edit_value_spec.rb +9 -0
  45. data/spec/command/export_cards_spec.rb +9 -0
  46. data/spec/command/filter_cards_spec.rb +9 -0
  47. data/spec/command/import_cards_spec.rb +9 -0
  48. data/spec/command/list_cards_spec.rb +9 -0
  49. data/spec/command/open_card_spec.rb +9 -0
  50. data/spec/command/open_workflow_spec.rb +9 -0
  51. data/spec/command/remove_transitions_spec.rb +25 -0
  52. data/spec/command/show_entry_spec.rb +9 -0
  53. data/spec/command/specify_display_columns_spec.rb +9 -0
  54. data/spec/command/specify_sort_columns_spec.rb +9 -0
  55. data/spec/command/total_cards_spec.rb +82 -0
  56. data/spec/command/unfilter_cards_spec.rb +9 -0
  57. data/spec/spec_helper.rb +25 -0
  58. data/spec/text_report_formatter_spec.rb +47 -0
  59. metadata +100 -35
  60. data/lib/cardigan/command/select_columns.rb +0 -20
  61. data/lib/cardigan/context.rb +0 -60
  62. data/lib/cardigan/directory.rb +0 -34
  63. data/lib/cardigan/repository.rb +0 -54
  64. data/lib/cardigan/symbol_extensions.rb +0 -3
@@ -1,17 +1,17 @@
1
- module Cardigan
2
- module Command
3
- class UnclaimCards
4
- def initialize repository, io
5
- @repository, @io = repository, io
6
- end
1
+ class Cardigan::Command::UnclaimCards
2
+ attr_reader :usage, :help
7
3
 
8
- def execute numbers
9
- @repository.each_card_from_indices(numbers) do |card|
10
- @io.say "unclaiming \"#{card['name']}\""
11
- card.delete('owner')
12
- @repository.save card
13
- end
14
- end
4
+ def initialize repository, io
5
+ @repository, @io = repository, io
6
+ @usage = '<number> [<number]*'
7
+ @help = 'Removes the owner of the specified cards'
8
+ end
9
+
10
+ def execute numbers
11
+ @repository.each_card_from_indices(numbers || '') do |card|
12
+ @io.say "unclaiming \"#{card['name']}\""
13
+ card.delete('owner')
14
+ @repository[card.id] = card
15
15
  end
16
16
  end
17
17
  end
@@ -1,6 +1,12 @@
1
1
  require 'cardigan/command/list_cards'
2
2
 
3
3
  class Cardigan::Command::UnfilterCards < Cardigan::Command::ListCards
4
+ def initialize repository, io
5
+ super
6
+ @usage = ''
7
+ @help = 'Removes the current filter (or does nothing if no filter has been specified)'
8
+ end
9
+
4
10
  def execute filter
5
11
  @repository.filter = nil
6
12
  super
@@ -0,0 +1,10 @@
1
+ require 'active_support/inflector'
2
+
3
+ module Cardigan
4
+ module Command
5
+ def self.load name, *args
6
+ require "cardigan/command/#{name}"
7
+ Command.const_get(name.to_s.camelize).new(*args)
8
+ end
9
+ end
10
+ end
@@ -1,24 +1,19 @@
1
- require 'cardigan/context'
1
+ require 'shell_shock/context'
2
+ require 'cardigan/commands'
2
3
 
3
4
  module Cardigan
4
5
  class EntryContext
5
- include Context
6
+ include ShellShock::Context
6
7
 
7
8
  def initialize io, workflow_repository, entry
8
9
  @io, @workflow_repository, @entry = io, workflow_repository, entry
9
10
  @prompt_text = "#{File.expand_path('.').split('/').last.slice(0..0)}/#{entry['name']} > "
10
11
  @commands = {
11
- 'now' => command(:change_status, @entry),
12
- 'set' => command(:change_value, @entry, @io),
13
- 'edit' => command(:edit_value, @entry, @io),
14
- 'list' => command(:show_entry, @entry, @io)
12
+ 'now' => Command.load(:change_status, @entry, @workflow_repository),
13
+ 'set' => Command.load(:change_value, @entry, @io),
14
+ 'edit' => Command.load(:edit_value, @entry, @io),
15
+ 'ls' => Command.load(:show_entry, @entry, @io)
15
16
  }
16
17
  end
17
-
18
- def refresh_commands
19
- status = @entry['status'] || 'none'
20
- next_statuses = @workflow_repository.load[status]
21
- next_statuses ? next_statuses.map { |s| "now #{s}" } : []
22
- end
23
18
  end
24
19
  end
@@ -1,12 +1,14 @@
1
1
  require 'forwardable'
2
+ require 'set'
2
3
 
3
4
  module Cardigan
4
5
  class FilteredRepository
6
+ include Enumerable
7
+
5
8
  attr_accessor :filter, :sort_columns, :display_columns
6
9
 
7
10
  extend Forwardable
8
-
9
- def_delegators :@repository, :refresh, :save, :destroy, :find_or_create, :columns, :load, :create
11
+ def_delegators :@repository, :[], :[]=, :exist?, :destroy, :addremovecommit
10
12
 
11
13
  def initialize repository, user, *columns
12
14
  @repository, @sort_columns, @display_columns, @user = repository, columns, columns, user
@@ -14,7 +16,7 @@ module Cardigan
14
16
 
15
17
  def cards
16
18
  me = @user
17
- cards = @filter ? @repository.cards.select {|card| eval @filter } : @repository.cards
19
+ cards = @filter ? @repository.select {|card| eval @filter } : @repository.to_a
18
20
  cards.sort do |a,b|
19
21
  a_values = sort_columns.map {|col| a[col] ? a[col] : '' }
20
22
  b_values = sort_columns.map {|col| b[col] ? b[col] : '' }
@@ -22,8 +24,10 @@ module Cardigan
22
24
  end
23
25
  end
24
26
 
25
- def each
26
- cards.each {|card| yield card }
27
+ def columns
28
+ columns = Set.new
29
+ @repository.each {|card| columns += card.keys }
30
+ columns.to_a
27
31
  end
28
32
 
29
33
  def max_field_length name
data/lib/cardigan/io.rb CHANGED
@@ -9,7 +9,7 @@ module Cardigan
9
9
  @in_io.gets.chomp
10
10
  end
11
11
 
12
- def say message
12
+ def say message=''
13
13
  @out_io.puts message
14
14
  end
15
15
  end
@@ -1,36 +1,34 @@
1
- require 'cardigan/context'
1
+ require 'rubygems'
2
+ require 'shell_shock/context'
3
+ require 'cardigan/commands'
2
4
  require 'cardigan/filtered_repository'
3
5
 
4
6
  module Cardigan
5
7
  class RootContext
6
- include Context
8
+ include ShellShock::Context
7
9
 
8
10
  def initialize io, repository, name, workflow_repository
9
11
  @io, @repository, @name, @workflow_repository = io, FilteredRepository.new(repository, name, 'name'), name, workflow_repository
10
12
  @prompt_text = "#{File.expand_path('.').split('/').last} > "
11
13
  @commands = {
12
- 'claim' => command(:claim_cards, @repository, @io, @name),
13
- 'create' => command(:create_card, @repository),
14
- 'destroy' => command(:destroy_cards, @repository, @io),
15
- 'display' => command(:specify_display_columns, @repository, @io),
16
- 'filter' => command(:filter_cards, @repository, @io),
17
- 'list' => command(:list_cards, @repository, @io),
18
- 'open' => command(:open_card, @repository, @workflow_repository, @io),
19
- 'set' => command(:batch_update_cards, @repository, @io),
20
- 'sort' => command(:specify_sort_columns, @repository, @io),
21
- 'unclaim' => command(:unclaim_cards, @repository, @io),
22
- 'unfilter' => command(:unfilter_cards, @repository, @io),
23
- 'workflow' => command(:open_workflow, @workflow_repository, @io),
24
- 'count' => command(:count_cards, @repository, @io),
25
- 'total' => command(:total_cards, @repository, @io),
26
- 'export' => command(:export_cards, @repository),
27
- 'import' => command(:import_cards, @repository, @io)
14
+ 'claim' => Command.load(:claim_cards, @repository, @io, @name),
15
+ 'touch' => Command.load(:create_card, @repository),
16
+ 'rm' => Command.load(:destroy_cards, @repository, @io),
17
+ 'columns' => Command.load(:specify_display_columns, @repository, @io),
18
+ 'filter' => Command.load(:filter_cards, @repository, @io),
19
+ 'ls' => Command.load(:list_cards, @repository, @io),
20
+ 'cd' => Command.load(:open_card, @repository, @workflow_repository, @io),
21
+ 'set' => Command.load(:batch_update_cards, @repository, @io),
22
+ 'sort' => Command.load(:specify_sort_columns, @repository, @io),
23
+ 'unclaim' => Command.load(:unclaim_cards, @repository, @io),
24
+ 'unfilter' => Command.load(:unfilter_cards, @repository, @io),
25
+ 'workflow' => Command.load(:open_workflow, @workflow_repository, @io),
26
+ 'count' => Command.load(:count_cards, @repository, @io),
27
+ 'total' => Command.load(:total_cards, @repository, @io),
28
+ 'export' => Command.load(:export_cards, @repository),
29
+ 'import' => Command.load(:import_cards, @repository, @io),
30
+ 'commit' => Command.load(:commit_changes, @repository, @io)
28
31
  }
29
32
  end
30
-
31
- def refresh_commands
32
- @repository.refresh
33
- @repository.cards.map {|card| "open #{card['name']}" }
34
- end
35
33
  end
36
34
  end
@@ -1,33 +1,16 @@
1
- require 'cardigan/context'
1
+ require 'shell_shock/context'
2
+ require 'cardigan/commands'
2
3
 
3
- module Cardigan
4
- class WorkflowContext
5
- include Context
4
+ class Cardigan::WorkflowContext
5
+ include ShellShock::Context
6
6
 
7
- def initialize io, entry
8
- @io, @entry = io, entry
9
- @prompt_text = "#{File.expand_path('.').split('/').last.slice(0..0)}/workflow > "
10
- @commands = {
11
- 'list' => command(:show_entry, @entry, @io)
12
- }
13
- end
14
-
15
- def refresh_commands
16
- ['create', 'add', 'remove']
17
- end
18
-
19
- def create_command key
20
- @entry[key] = []
21
- end
22
-
23
- def add_command text
24
- name, *states = text.scan(/\w+/)
25
- @entry[name] += states
26
- end
27
-
28
- def remove_command text
29
- name, *states = text.scan(/\w+/)
30
- @entry[name] -= states
31
- end
7
+ def initialize io, entry
8
+ @io, @entry = io, entry
9
+ @prompt_text = "#{File.expand_path('.').split('/').last.slice(0..0)}/workflow > "
10
+ @commands = {
11
+ 'ls' => Cardigan::Command.load(:show_entry, @entry, @io),
12
+ 'add' => Cardigan::Command.load(:add_transitions, @entry, @io),
13
+ 'rm' => Cardigan::Command.load(:remove_transitions, @entry, @io),
14
+ }
32
15
  end
33
16
  end
@@ -1,16 +1,24 @@
1
- module Cardigan
2
- class WorkflowRepository
3
- def initialize path
4
- @directory = Directory.new(path)
5
- @path = '.card_workflow'
6
- end
1
+ require 'flat_hash/serialiser'
2
+ require 'flat_hash/repository'
3
+
4
+ class Cardigan::WorkflowRepository
5
+ def initialize path
6
+ @directory = FlatHash::Directory.new(FlatHash::Serialiser.new,'.')
7
+ @key = '.card_workflow'
8
+ end
7
9
 
8
- def save workflow
9
- @directory.store @path, workflow
10
+ def save workflow
11
+ workflow.keys.each do |key|
12
+ workflow[key] = workflow[key].join("\n")
10
13
  end
14
+ @directory[@key] = workflow
15
+ end
11
16
 
12
- def load
13
- @directory.has_file?(@path) ? @directory.load(@path) : {}
17
+ def load
18
+ workflow = @directory[@key]
19
+ workflow.keys.each do |key|
20
+ workflow[key] = workflow[key].split("\n") unless workflow[key].instance_of?(Array)
14
21
  end
22
+ workflow
15
23
  end
16
24
  end
@@ -0,0 +1,35 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/add_transitions'
3
+
4
+ describe Cardigan::Command::AddTransitions do
5
+ with_usage '<start status> [<subsequent status>]+'
6
+ with_help 'Creates transitions from a starting status to a number of subsequent statuses'
7
+
8
+ before do
9
+ @entry = {}
10
+ @io = MockPrompt.new
11
+ @command = Cardigan::Command::AddTransitions.new @entry, @io
12
+ end
13
+
14
+ [nil, ''].each do |parameter|
15
+ it "should report error when called with #{parameter.inspect}" do
16
+ @command.execute
17
+ @io.should have_received "missing required start status"
18
+ end
19
+ end
20
+
21
+ it 'should report error when called with a single parameter' do
22
+ @command.execute 'none'
23
+ @io.should have_received "missing required subsequent status"
24
+ end
25
+
26
+ it 'should append status when called with single' do
27
+ @command.execute 'none started'
28
+ @entry['none'].should == ['started']
29
+ end
30
+
31
+ it 'should ignore duplicate subsequent statuses' do
32
+ @command.execute 'none started started'
33
+ @entry['none'].should == ['started']
34
+ end
35
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/batch_update_cards'
3
+
4
+ describe Cardigan::Command::BatchUpdateCards do
5
+ with_usage '<field> <number>*'
6
+ with_help 'Sets the specified field to a new value for the specified cards (by index in the list)'
7
+
8
+ before { @command = Cardigan::Command::BatchUpdateCards.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/change_status'
3
+
4
+ describe Cardigan::Command::ChangeStatus do
5
+ with_usage '<new status>'
6
+ with_help 'Changes the status of the current entry'
7
+
8
+ before { @command = Cardigan::Command::ChangeStatus.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/change_value'
3
+
4
+ describe Cardigan::Command::ChangeValue do
5
+ with_usage '<key>'
6
+ with_help 'Prompt for a new value to associate with the specified key'
7
+
8
+ before { @command = Cardigan::Command::ChangeValue.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/claim_cards'
3
+
4
+ describe Cardigan::Command::ClaimCards do
5
+ with_usage '<number>*'
6
+ with_help 'Sets you as the owner of the specified cards (by index in the list)'
7
+
8
+ before { @command = Cardigan::Command::ClaimCards.new(nil,nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/commit_changes'
3
+
4
+ describe Cardigan::Command::CommitChanges do
5
+ with_usage '<commit message>'
6
+ with_help "Commits _all_ changes (adds, removes and modifications) to the source control system\nWarning: Use with caution. This will not only commit changes to cards - all modifications will be committed."
7
+
8
+ before { @command = Cardigan::Command::CommitChanges.new(nil,nil) }
9
+ end
@@ -0,0 +1,68 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/count_cards'
3
+
4
+ describe Cardigan::Command::CountCards do
5
+ with_usage '<grouping field>*'
6
+ with_help 'Counts cards aggregated across the specified grouping fields'
7
+
8
+ before do
9
+ @repository, @prompt = stub(:repository), MockPrompt.new
10
+ @command = Cardigan::Command::CountCards.new @repository, @prompt
11
+ end
12
+
13
+ [nil, ''].each do |parameter|
14
+ it "should count single row when called with #{parameter}" do
15
+ @repository.stub!(:cards).and_return []
16
+ @command.execute parameter
17
+
18
+ @prompt.messages.should == [
19
+ ' -------',
20
+ '| count |',
21
+ ' -------',
22
+ '| 0 |',
23
+ ' -------'
24
+ ]
25
+ end
26
+ end
27
+
28
+ it 'should count single row when no grouping fields are provided' do
29
+ @repository.stub!(:cards).and_return [{'points' => 1}]
30
+ @command.execute
31
+
32
+ @prompt.messages.should == [
33
+ ' -------',
34
+ '| count |',
35
+ ' -------',
36
+ '| 1 |',
37
+ ' -------'
38
+ ]
39
+ end
40
+
41
+ it 'should count single row when a single grouping fields are provided' do
42
+ @repository.stub!(:cards).and_return [{'type' => 'bug'}]
43
+ @command.execute 'type'
44
+
45
+ @prompt.messages.should == [
46
+ ' --------------',
47
+ '| type | count |',
48
+ ' --------------',
49
+ '| bug | 1 |',
50
+ ' --------------'
51
+ ]
52
+ end
53
+
54
+ it 'should count single row when a single grouping fields are provided' do
55
+ @repository.stub!(:cards).and_return [{'type' => 'bug'},{'type' => 'feature'}]
56
+ @command.execute 'type'
57
+
58
+ @prompt.messages.should == [
59
+ ' -----------------',
60
+ '| type | count |',
61
+ ' -----------------',
62
+ '| bug | 1 |',
63
+ '| feature | 1 |',
64
+ '| | 2 |',
65
+ ' -----------------'
66
+ ]
67
+ end
68
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/create_card'
3
+
4
+ describe Cardigan::Command::CreateCard do
5
+ with_usage '<name>'
6
+ with_help 'Creates a new card with the specified name (without opening it for editing)'
7
+
8
+ before { @command = Cardigan::Command::CreateCard.new(nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/destroy_cards'
3
+
4
+ describe Cardigan::Command::DestroyCards do
5
+ with_usage '<number>*'
6
+ with_help 'Destroys the specified cards (by index in the list)'
7
+
8
+ before { @command = Cardigan::Command::DestroyCards.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/edit_value'
3
+
4
+ describe Cardigan::Command::EditValue do
5
+ with_usage '<key>'
6
+ with_help 'Launch default editor to specify a new value to associate with the specified key'
7
+
8
+ before { @command = Cardigan::Command::EditValue.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/export_cards'
3
+
4
+ describe Cardigan::Command::ExportCards do
5
+ with_usage '<filename>'
6
+ with_help 'Exports all cards according to the current filter'
7
+
8
+ before { @command = Cardigan::Command::ExportCards.new(nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/filter_cards'
3
+
4
+ describe Cardigan::Command::FilterCards do
5
+ with_usage '<ruby expression>'
6
+ with_help "Sets the filter on cards to be displayed\nThis filter is a ruby expression that must return a boolean.\nBound variables are card (a hash) and me (a string)"
7
+
8
+ before { @command = Cardigan::Command::FilterCards.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/import_cards'
3
+
4
+ describe Cardigan::Command::ImportCards do
5
+ with_usage '<filename>'
6
+ with_help "Imports cards from the specific csv file.\nNote that if the file does not contain an id column, all new cards will be created.\nOtherwise, existing cards with a matching id will be updated."
7
+
8
+ before { @command = Cardigan::Command::ImportCards.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/list_cards'
3
+
4
+ describe Cardigan::Command::ListCards do
5
+ with_usage ''
6
+ with_help 'Lists all cards that match the current filter'
7
+
8
+ before { @command = Cardigan::Command::ListCards.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/open_card'
3
+
4
+ describe Cardigan::Command::OpenCard do
5
+ with_usage '<card name>'
6
+ with_help 'Opens the specified card for editing'
7
+
8
+ before { @command = Cardigan::Command::OpenCard.new(nil,nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/open_workflow'
3
+
4
+ describe Cardigan::Command::OpenWorkflow do
5
+ with_usage ''
6
+ with_help 'Opens the current workflow for editing'
7
+
8
+ before { @command = Cardigan::Command::OpenWorkflow.new(nil,nil) }
9
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/remove_transitions'
3
+
4
+ describe Cardigan::Command::RemoveTransitions do
5
+ with_usage '<start status> [<subsequent status>]+'
6
+ with_help 'Removes transitions from a starting status to a number of subsequent statuses'
7
+
8
+ before do
9
+ @entry = {}
10
+ @io = MockPrompt.new
11
+ @command = Cardigan::Command::RemoveTransitions.new @entry, @io
12
+ end
13
+
14
+ [nil, ''].each do |parameter|
15
+ it "should report error when called with #{parameter.inspect}" do
16
+ @command.execute
17
+ @io.should have_received "missing required start status"
18
+ end
19
+ end
20
+
21
+ it 'should report error when called with a single parameter' do
22
+ @command.execute 'none'
23
+ @io.should have_received "missing required subsequent status"
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/show_entry'
3
+
4
+ describe Cardigan::Command::ShowEntry do
5
+ with_usage ''
6
+ with_help 'Shows the entire content of the entry'
7
+
8
+ before { @command = Cardigan::Command::ShowEntry.new(nil, nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/specify_display_columns'
3
+
4
+ describe Cardigan::Command::SpecifyDisplayColumns do
5
+ with_usage '<column>*'
6
+ with_help 'Specify the list of columns to display'
7
+
8
+ before { @command = Cardigan::Command::SpecifyDisplayColumns.new(nil,nil) }
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__)+'/../spec_helper'
2
+ require 'cardigan/command/specify_sort_columns'
3
+
4
+ describe Cardigan::Command::SpecifySortColumns do
5
+ with_usage '<column>*'
6
+ with_help 'Specify the list of columns to sort by'
7
+
8
+ before { @command = Cardigan::Command::SpecifySortColumns.new(nil,nil) }
9
+ end