branston 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/branston/app/controllers/stories_controller.rb +104 -103
- data/lib/branston/coverage/app-controllers-application_controller_rb.html +1 -1
- data/lib/branston/coverage/app-controllers-iterations_controller_rb.html +107 -101
- data/lib/branston/coverage/app-controllers-outcomes_controller_rb.html +114 -102
- data/lib/branston/coverage/app-controllers-preconditions_controller_rb.html +54 -90
- data/lib/branston/coverage/app-controllers-releases_controller_rb.html +101 -89
- data/lib/branston/coverage/app-controllers-scenarios_controller_rb.html +94 -76
- data/lib/branston/coverage/app-controllers-sessions_controller_rb.html +60 -42
- data/lib/branston/coverage/app-controllers-stories_controller_rb.html +188 -110
- data/lib/branston/coverage/app-controllers-user_roles_controller_rb.html +123 -87
- data/lib/branston/coverage/app-controllers-users_controller_rb.html +39 -27
- data/lib/branston/coverage/app-helpers-application_helper_rb.html +26 -8
- data/lib/branston/coverage/app-helpers-iterations_helper_rb.html +1 -1
- data/lib/branston/coverage/app-helpers-outcomes_helper_rb.html +1 -1
- data/lib/branston/coverage/app-helpers-preconditions_helper_rb.html +1 -1
- data/lib/branston/coverage/app-helpers-releases_helper_rb.html +1 -1
- data/lib/branston/coverage/app-helpers-sessions_helper_rb.html +1 -1
- data/lib/branston/coverage/app-helpers-stories_helper_rb.html +1 -1
- data/lib/branston/coverage/app-helpers-user_roles_helper_rb.html +1 -1
- data/lib/branston/coverage/app-models-iteration_rb.html +1 -1
- data/lib/branston/coverage/app-models-outcome_rb.html +1 -1
- data/lib/branston/coverage/app-models-participation_rb.html +1 -1
- data/lib/branston/coverage/app-models-precondition_rb.html +9 -3
- data/lib/branston/coverage/app-models-release_rb.html +1 -1
- data/lib/branston/coverage/app-models-scenario_rb.html +3 -3
- data/lib/branston/coverage/app-models-story_rb.html +79 -7
- data/lib/branston/coverage/app-models-user_rb.html +1 -1
- data/lib/branston/coverage/app-models-user_role_rb.html +1 -1
- data/lib/branston/coverage/index.html +106 -90
- data/lib/branston/coverage/lib-client_rb.html +537 -0
- data/lib/branston/coverage/lib-faker_extras_rb.html +1 -1
- data/lib/branston/coverage/lib-story_generator_rb.html +43 -49
- data/lib/branston/db/test.sqlite3 +0 -0
- data/lib/branston/lib/branston.rb +5 -1
- data/lib/branston/lib/client.rb +48 -30
- data/lib/branston/test/functional/stories_controller_test.rb +119 -105
- data/lib/branston/test/unit/client_test.rb +34 -9
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_flat.txt +10 -0
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_graph.html +6603 -0
- data/lib/branston/tmp/performance/BrowsingTest#test_homepage_process_time_tree.txt +9714 -0
- metadata +6 -5
- data/lib/branston/db/production.sqlite3 +0 -0
- data/lib/branston/log/development.log +0 -10836
- data/lib/branston/log/test.log +0 -52955
@@ -201,7 +201,7 @@
|
|
201
201
|
</tbody>
|
202
202
|
</table>
|
203
203
|
|
204
|
-
<p>Generated on
|
204
|
+
<p>Generated on Wed Dec 09 15:45:09 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
|
205
205
|
|
206
206
|
</body>
|
207
207
|
</html>
|
@@ -28,8 +28,8 @@
|
|
28
28
|
<tbody>
|
29
29
|
<tr>
|
30
30
|
<td class="left_align"><a href="lib-story_generator_rb.html">lib/story_generator.rb</a></td>
|
31
|
-
<td class='right_align'><tt>
|
32
|
-
<td class='right_align'><tt>
|
31
|
+
<td class='right_align'><tt>135</tt></td>
|
32
|
+
<td class='right_align'><tt>112</tt></td>
|
33
33
|
<td class="left_align"><div class="percent_graph_legend"><tt class=''>100.00%</tt></div>
|
34
34
|
<div class="percent_graph">
|
35
35
|
<div class="covered" style="width:100px"></div>
|
@@ -627,253 +627,247 @@
|
|
627
627
|
|
628
628
|
|
629
629
|
<tr class="marked">
|
630
|
-
<td><pre><a name="line96">96</a> gherkin += "\
|
630
|
+
<td><pre><a name="line96">96</a> gherkin += "\tScenario: "</pre></td>
|
631
631
|
</tr>
|
632
632
|
|
633
633
|
|
634
634
|
|
635
635
|
<tr class="marked">
|
636
|
-
<td><pre><a name="line97">97</a> gherkin +=
|
636
|
+
<td><pre><a name="line97">97</a> gherkin += scenario.title</pre></td>
|
637
637
|
</tr>
|
638
638
|
|
639
639
|
|
640
640
|
|
641
641
|
<tr class="marked">
|
642
|
-
<td><pre><a name="line98">98</a> gherkin +=
|
643
|
-
</tr>
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
<tr class="marked">
|
648
|
-
<td><pre><a name="line99">99</a> gherkin += "\n"</pre></td>
|
642
|
+
<td><pre><a name="line98">98</a> gherkin += "\n"</pre></td>
|
649
643
|
</tr>
|
650
644
|
|
651
645
|
|
652
646
|
|
653
647
|
<tr class="inferred">
|
654
|
-
<td><pre><a name="
|
648
|
+
<td><pre><a name="line99">99</a> </pre></td>
|
655
649
|
</tr>
|
656
650
|
|
657
651
|
|
658
652
|
|
659
653
|
<tr class="marked">
|
660
|
-
<td><pre><a name="
|
654
|
+
<td><pre><a name="line100">100</a> unless scenario.preconditions.empty?</pre></td>
|
661
655
|
</tr>
|
662
656
|
|
663
657
|
|
664
658
|
|
665
659
|
<tr class="marked">
|
666
|
-
<td><pre><a name="
|
660
|
+
<td><pre><a name="line101">101</a> scenario.preconditions.each_with_index do |p, i|</pre></td>
|
667
661
|
</tr>
|
668
662
|
|
669
663
|
|
670
664
|
|
671
665
|
<tr class="marked">
|
672
|
-
<td><pre><a name="
|
666
|
+
<td><pre><a name="line102">102</a> gherkin += "\t\tGiven #{p.description}\n" if i == 0</pre></td>
|
673
667
|
</tr>
|
674
668
|
|
675
669
|
|
676
670
|
|
677
671
|
<tr class="marked">
|
678
|
-
<td><pre><a name="
|
672
|
+
<td><pre><a name="line103">103</a> gherkin += "\t\t\tAnd #{p.description}\n" unless i == 0</pre></td>
|
679
673
|
</tr>
|
680
674
|
|
681
675
|
|
682
676
|
|
683
677
|
<tr class="inferred">
|
684
|
-
<td><pre><a name="
|
678
|
+
<td><pre><a name="line104">104</a> end</pre></td>
|
685
679
|
</tr>
|
686
680
|
|
687
681
|
|
688
682
|
|
689
683
|
<tr class="inferred">
|
690
|
-
<td><pre><a name="
|
684
|
+
<td><pre><a name="line105">105</a> end</pre></td>
|
691
685
|
</tr>
|
692
686
|
|
693
687
|
|
694
688
|
|
695
689
|
<tr class="inferred">
|
696
|
-
<td><pre><a name="
|
690
|
+
<td><pre><a name="line106">106</a> </pre></td>
|
697
691
|
</tr>
|
698
692
|
|
699
693
|
|
700
694
|
|
701
695
|
<tr class="marked">
|
702
|
-
<td><pre><a name="
|
696
|
+
<td><pre><a name="line107">107</a> unless scenario.outcomes.empty?</pre></td>
|
703
697
|
</tr>
|
704
698
|
|
705
699
|
|
706
700
|
|
707
701
|
<tr class="marked">
|
708
|
-
<td><pre><a name="
|
702
|
+
<td><pre><a name="line108">108</a> scenario.outcomes.each_with_index do |o, i|</pre></td>
|
709
703
|
</tr>
|
710
704
|
|
711
705
|
|
712
706
|
|
713
707
|
<tr class="marked">
|
714
|
-
<td><pre><a name="
|
708
|
+
<td><pre><a name="line109">109</a> gherkin += "\t\tThen #{o.description}\n" if i==0</pre></td>
|
715
709
|
</tr>
|
716
710
|
|
717
711
|
|
718
712
|
|
719
713
|
<tr class="marked">
|
720
|
-
<td><pre><a name="
|
714
|
+
<td><pre><a name="line110">110</a> gherkin += "\t\t\tAnd #{o.description}\n" unless i==0</pre></td>
|
721
715
|
</tr>
|
722
716
|
|
723
717
|
|
724
718
|
|
725
719
|
<tr class="inferred">
|
726
|
-
<td><pre><a name="
|
720
|
+
<td><pre><a name="line111">111</a> end</pre></td>
|
727
721
|
</tr>
|
728
722
|
|
729
723
|
|
730
724
|
|
731
725
|
<tr class="inferred">
|
732
|
-
<td><pre><a name="
|
726
|
+
<td><pre><a name="line112">112</a> end</pre></td>
|
733
727
|
</tr>
|
734
728
|
|
735
729
|
|
736
730
|
|
737
731
|
<tr class="inferred">
|
738
|
-
<td><pre><a name="
|
732
|
+
<td><pre><a name="line113">113</a> </pre></td>
|
739
733
|
</tr>
|
740
734
|
|
741
735
|
|
742
736
|
|
743
737
|
<tr class="marked">
|
744
|
-
<td><pre><a name="
|
738
|
+
<td><pre><a name="line114">114</a> gherkin += "\n"</pre></td>
|
745
739
|
</tr>
|
746
740
|
|
747
741
|
|
748
742
|
|
749
743
|
<tr class="inferred">
|
750
|
-
<td><pre><a name="
|
744
|
+
<td><pre><a name="line115">115</a> end</pre></td>
|
751
745
|
</tr>
|
752
746
|
|
753
747
|
|
754
748
|
|
755
749
|
<tr class="inferred">
|
756
|
-
<td><pre><a name="
|
750
|
+
<td><pre><a name="line116">116</a> end</pre></td>
|
757
751
|
</tr>
|
758
752
|
|
759
753
|
|
760
754
|
|
761
755
|
<tr class="inferred">
|
762
|
-
<td><pre><a name="
|
756
|
+
<td><pre><a name="line117">117</a> </pre></td>
|
763
757
|
</tr>
|
764
758
|
|
765
759
|
|
766
760
|
|
767
761
|
<tr class="marked">
|
768
|
-
<td><pre><a name="
|
762
|
+
<td><pre><a name="line118">118</a> File.open(FEATURE_PATH + feature_filename, 'w') {|f| f.write(gherkin) }</pre></td>
|
769
763
|
</tr>
|
770
764
|
|
771
765
|
|
772
766
|
|
773
767
|
<tr class="inferred">
|
774
|
-
<td><pre><a name="
|
768
|
+
<td><pre><a name="line119">119</a> end</pre></td>
|
775
769
|
</tr>
|
776
770
|
|
777
771
|
|
778
772
|
|
779
773
|
<tr class="inferred">
|
780
|
-
<td><pre><a name="
|
774
|
+
<td><pre><a name="line120">120</a> </pre></td>
|
781
775
|
</tr>
|
782
776
|
|
783
777
|
|
784
778
|
|
785
779
|
<tr class="marked">
|
786
|
-
<td><pre><a name="
|
780
|
+
<td><pre><a name="line121">121</a> def regexp(string)</pre></td>
|
787
781
|
</tr>
|
788
782
|
|
789
783
|
|
790
784
|
|
791
785
|
<tr class="marked">
|
792
|
-
<td><pre><a name="
|
786
|
+
<td><pre><a name="line122">122</a> pc = string.gsub(/"([^\"]*)"/, '"([^\"]*)"')</pre></td>
|
793
787
|
</tr>
|
794
788
|
|
795
789
|
|
796
790
|
|
797
791
|
<tr class="marked">
|
798
|
-
<td><pre><a name="
|
792
|
+
<td><pre><a name="line123">123</a> "/^#{pc}$/"</pre></td>
|
799
793
|
</tr>
|
800
794
|
|
801
795
|
|
802
796
|
|
803
797
|
<tr class="inferred">
|
804
|
-
<td><pre><a name="
|
798
|
+
<td><pre><a name="line124">124</a> end</pre></td>
|
805
799
|
</tr>
|
806
800
|
|
807
801
|
|
808
802
|
|
809
803
|
<tr class="inferred">
|
810
|
-
<td><pre><a name="
|
804
|
+
<td><pre><a name="line125">125</a> </pre></td>
|
811
805
|
</tr>
|
812
806
|
|
813
807
|
|
814
808
|
|
815
809
|
<tr class="marked">
|
816
|
-
<td><pre><a name="
|
810
|
+
<td><pre><a name="line126">126</a> def variables(string)</pre></td>
|
817
811
|
</tr>
|
818
812
|
|
819
813
|
|
820
814
|
|
821
815
|
<tr class="marked">
|
822
|
-
<td><pre><a name="
|
816
|
+
<td><pre><a name="line127">127</a> variables = string.split(/"([^\"]*)"/)</pre></td>
|
823
817
|
</tr>
|
824
818
|
|
825
819
|
|
826
820
|
|
827
821
|
<tr class="marked">
|
828
|
-
<td><pre><a name="
|
822
|
+
<td><pre><a name="line128">128</a> variables.each_with_index do |v, i|</pre></td>
|
829
823
|
</tr>
|
830
824
|
|
831
825
|
|
832
826
|
|
833
827
|
<tr class="marked">
|
834
|
-
<td><pre><a name="
|
828
|
+
<td><pre><a name="line129">129</a> i % 2 == 0 ? variables[i] = nil : variables[i] = v</pre></td>
|
835
829
|
</tr>
|
836
830
|
|
837
831
|
|
838
832
|
|
839
833
|
<tr class="inferred">
|
840
|
-
<td><pre><a name="
|
834
|
+
<td><pre><a name="line130">130</a> end</pre></td>
|
841
835
|
</tr>
|
842
836
|
|
843
837
|
|
844
838
|
|
845
839
|
<tr class="marked">
|
846
|
-
<td><pre><a name="
|
840
|
+
<td><pre><a name="line131">131</a> variables.compact</pre></td>
|
847
841
|
</tr>
|
848
842
|
|
849
843
|
|
850
844
|
|
851
845
|
<tr class="inferred">
|
852
|
-
<td><pre><a name="
|
846
|
+
<td><pre><a name="line132">132</a> end</pre></td>
|
853
847
|
</tr>
|
854
848
|
|
855
849
|
|
856
850
|
|
857
851
|
<tr class="inferred">
|
858
|
-
<td><pre><a name="
|
852
|
+
<td><pre><a name="line133">133</a> </pre></td>
|
859
853
|
</tr>
|
860
854
|
|
861
855
|
|
862
856
|
|
863
857
|
<tr class="inferred">
|
864
|
-
<td><pre><a name="
|
858
|
+
<td><pre><a name="line134">134</a> end</pre></td>
|
865
859
|
</tr>
|
866
860
|
|
867
861
|
|
868
862
|
|
869
863
|
<tr class="inferred">
|
870
|
-
<td><pre><a name="
|
864
|
+
<td><pre><a name="line135">135</a> </pre></td>
|
871
865
|
</tr>
|
872
866
|
|
873
867
|
</tbody>
|
874
868
|
</table>
|
875
869
|
|
876
|
-
<p>Generated on
|
870
|
+
<p>Generated on Wed Dec 09 15:45:09 +0000 2009 with <a href="http://github.com/relevance/rcov">rcov 0.9.2.1</a></p>
|
877
871
|
|
878
872
|
</body>
|
879
873
|
</html>
|
Binary file
|
@@ -66,7 +66,11 @@ class Branston
|
|
66
66
|
if actions.first == 'server'
|
67
67
|
launch_branston_server(options)
|
68
68
|
elsif actions.first == 'generator'
|
69
|
-
Client.new(options)
|
69
|
+
client = Client.new(options)
|
70
|
+
client.generate_story_files
|
71
|
+
client.errors.each do |error|
|
72
|
+
puts error
|
73
|
+
end
|
70
74
|
elsif actions.first == 'init'
|
71
75
|
initialise_branston(options)
|
72
76
|
end
|
data/lib/branston/lib/client.rb
CHANGED
@@ -6,47 +6,65 @@ include StoryGenerator
|
|
6
6
|
|
7
7
|
class Client
|
8
8
|
|
9
|
-
attr_accessor :options
|
9
|
+
attr_accessor :options, :errors
|
10
10
|
|
11
11
|
def initialize(options)
|
12
12
|
self.options = options
|
13
|
+
self.errors = []
|
13
14
|
end
|
14
15
|
|
15
16
|
def generate_story_files
|
17
|
+
begin
|
18
|
+
return process_xml get_xml
|
19
|
+
rescue StandardError => e
|
20
|
+
errors << "Could not connect to Branston server on " +
|
21
|
+
"#{options[:Host]}:#{options[:Port]}: #{e.message}\n" +
|
22
|
+
"Is Branston running?"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def process_xml(xml)
|
27
|
+
errors.clear
|
16
28
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
if xml.nil? or xml.root.nil? or xml.root.elements.nil?
|
30
|
+
errors << "Did not recieve XML data for story #{options[:feature]}.\n" +
|
31
|
+
"Is the Branston server running, and have you provided the correct story name?"
|
32
|
+
else
|
33
|
+
|
34
|
+
begin
|
35
|
+
root = xml.root
|
36
|
+
story = OpenStruct.new
|
37
|
+
story.description = root.elements["/story/description"].text
|
38
|
+
story.title = root.elements["/story/title"].text
|
39
|
+
story.scenarios = []
|
40
|
+
root.elements.each("/story/scenarios/scenario") { |scenario|
|
41
|
+
s = OpenStruct.new
|
42
|
+
s.preconditions = []
|
43
|
+
s.outcomes = []
|
44
|
+
s.title = scenario.elements["title"].text
|
45
|
+
|
46
|
+
scenario.elements.each("preconditions/precondition") { |precondition|
|
47
|
+
p = OpenStruct.new
|
48
|
+
p.description = precondition.elements["description"].text
|
49
|
+
s.preconditions << p
|
50
|
+
}
|
51
|
+
|
52
|
+
scenario.elements.each("outcomes/outcome") { |outcome|
|
53
|
+
o = OpenStruct.new
|
54
|
+
o.description = outcome.elements["description"].text
|
55
|
+
s.outcomes << o
|
56
|
+
}
|
57
|
+
|
58
|
+
story.scenarios << s
|
41
59
|
}
|
42
60
|
|
43
|
-
story
|
44
|
-
|
45
|
-
|
46
|
-
|
61
|
+
generate(story)
|
62
|
+
rescue StandardError => error
|
63
|
+
errors << "Could not generate feature: " + error
|
64
|
+
end
|
47
65
|
end
|
48
66
|
end
|
49
|
-
|
67
|
+
|
50
68
|
def get_xml
|
51
69
|
Net::HTTP.start(options[:Host] , options[:Port]) { |http|
|
52
70
|
req = Net::HTTP::Get.new("/stories/#{options[:feature]}.xml")
|
@@ -1,129 +1,143 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class StoriesControllerTest < ActionController::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
context "The StoriesController" do
|
6
|
-
setup do
|
7
|
-
login_as(User.make)
|
6
|
+
setup do
|
8
7
|
@story = Factory.make_story
|
9
8
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
step_file = FEATURE_PATH + @story.step_filename
|
15
|
-
FileUtils.rm step_file if File.exists? step_file
|
16
|
-
end
|
17
|
-
|
18
|
-
should "show a list of all the stories" do
|
19
|
-
get :index
|
20
|
-
assert_response :success
|
21
|
-
assert_not_nil assigns(:backlog_stories)
|
22
|
-
end
|
23
|
-
|
24
|
-
should "show a form to edit stories" do
|
25
|
-
get :edit, :id => @story.to_param
|
26
|
-
assert_response :success
|
27
|
-
assert assigns(:iterations)
|
28
|
-
end
|
29
|
-
|
30
|
-
should "show a form to add stories" do
|
31
|
-
get :new
|
32
|
-
assert_response :success
|
33
|
-
assert assigns(:iterations)
|
34
|
-
end
|
35
|
-
|
36
|
-
should "show details about a story" do
|
37
|
-
get :show, :id => @story.to_param
|
38
|
-
assert_response :success
|
39
|
-
end
|
40
|
-
|
41
|
-
should "delete a story" do
|
42
|
-
assert_difference('Story.count', -1) do
|
43
|
-
delete :destroy, :id => @story.to_param
|
9
|
+
|
10
|
+
context "with a logged-in user" do
|
11
|
+
setup do
|
12
|
+
login_as(User.make)
|
44
13
|
end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
14
|
+
|
15
|
+
teardown do
|
16
|
+
feature_file = FEATURE_PATH + @story.feature_filename
|
17
|
+
FileUtils.rm feature_file if File.exists? feature_file
|
18
|
+
step_file = FEATURE_PATH + @story.step_filename
|
19
|
+
FileUtils.rm step_file if File.exists? step_file
|
20
|
+
end
|
21
|
+
|
22
|
+
should "show a list of all the stories" do
|
23
|
+
get :index
|
24
|
+
assert_response :success
|
25
|
+
assert_not_nil assigns(:backlog_stories)
|
26
|
+
end
|
27
|
+
|
28
|
+
should "show a form to edit stories" do
|
29
|
+
get :edit, :id => @story.to_param
|
30
|
+
assert_response :success
|
31
|
+
assert assigns(:iterations)
|
32
|
+
end
|
33
|
+
|
34
|
+
should "show a form to add stories" do
|
35
|
+
get :new
|
36
|
+
assert_response :success
|
37
|
+
assert assigns(:iterations)
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
should "delete a story" do
|
43
|
+
assert_difference('Story.count', -1) do
|
44
|
+
delete :destroy, :id => @story.to_param
|
71
45
|
end
|
72
|
-
|
73
|
-
|
46
|
+
|
47
|
+
assert_redirected_to stories_path
|
48
|
+
end
|
49
|
+
|
50
|
+
should "generate the cucumber feature file for a story" do
|
51
|
+
get :generate_feature, :id => @story.to_param, :path => 'test/features/'
|
52
|
+
assert_response :success
|
53
|
+
assert File.exists? FEATURE_PATH + @story.feature_filename
|
54
|
+
assert File.exists? FEATURE_PATH + @story.step_filename
|
55
|
+
end
|
56
|
+
|
57
|
+
context "creating a story" do
|
58
|
+
|
59
|
+
context "with valid params" do
|
74
60
|
setup do
|
75
61
|
assert_difference("Story.count") do
|
76
|
-
post :create, :story => Story.plan
|
62
|
+
post :create, :story => Story.plan
|
77
63
|
end
|
78
64
|
end
|
79
|
-
|
80
|
-
should "
|
81
|
-
|
65
|
+
|
66
|
+
should "redirect to show" do
|
67
|
+
assert_redirected_to stories_path
|
82
68
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
context "with invalid params" do
|
87
|
-
setup do
|
88
|
-
assert_no_difference("Story.count") do
|
89
|
-
post :create, :story => {}
|
69
|
+
|
70
|
+
should "not be associated with an iteration" do
|
71
|
+
assert !assigns(:story).iteration
|
90
72
|
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
setup do
|
103
|
-
assert_no_difference("Story.count") do
|
104
|
-
put :update,{ :id => @story.to_param, :story => {:description => "bar"}}
|
73
|
+
|
74
|
+
context "including an iteration id" do
|
75
|
+
setup do
|
76
|
+
assert_difference("Story.count") do
|
77
|
+
post :create, :story => Story.plan(:in_progress)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
should "be associated with an iteration" do
|
82
|
+
assert assigns(:story).iteration
|
83
|
+
end
|
105
84
|
end
|
106
85
|
end
|
107
|
-
|
108
|
-
|
109
|
-
|
86
|
+
|
87
|
+
context "with invalid params" do
|
88
|
+
setup do
|
89
|
+
assert_no_difference("Story.count") do
|
90
|
+
post :create, :story => {}
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
should "redisplay" do
|
95
|
+
assert_template 'new'
|
96
|
+
assert assigns(:iterations)
|
97
|
+
end
|
110
98
|
end
|
111
|
-
|
112
99
|
end
|
113
|
-
|
114
|
-
context "
|
115
|
-
|
116
|
-
|
100
|
+
|
101
|
+
context "updating a story" do
|
102
|
+
context "with valid parameters" do
|
103
|
+
setup do
|
104
|
+
assert_no_difference("Story.count") do
|
105
|
+
put :update,{ :id => @story.to_param, :story => {:description => "bar"}}
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
should "redirect to show" do
|
110
|
+
assert_redirected_to story_url(assigns(:story))
|
111
|
+
end
|
112
|
+
|
117
113
|
end
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
114
|
+
|
115
|
+
context "with invalid parameters" do
|
116
|
+
setup do
|
117
|
+
put :update, :id => @story.to_param, :story => {:description => ""}
|
118
|
+
end
|
119
|
+
|
120
|
+
should "redisplay the edit template" do
|
121
|
+
assert_template "edit"
|
122
|
+
assert assigns(:iterations)
|
123
|
+
end
|
122
124
|
end
|
123
125
|
end
|
126
|
+
|
124
127
|
end
|
125
|
-
|
128
|
+
|
129
|
+
context "Without logging in, the StoriesController" do
|
130
|
+
|
131
|
+
should "show details about a story" do
|
132
|
+
get :show, :id => @story.to_param
|
133
|
+
assert_response :success
|
134
|
+
end
|
135
|
+
|
136
|
+
should "fail gracefully if the slug is not found" do
|
137
|
+
get :show, :id => 'none-such-story'
|
138
|
+
assert_response 404
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
126
142
|
end
|
127
|
-
|
128
143
|
end
|
129
|
-
|