typo 5.0 → 5.0.1

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 (50) hide show
  1. data/CHANGES-5.0 +82 -0
  2. data/app/controllers/articles_controller.rb +4 -4
  3. data/app/helpers/admin/base_helper.rb +9 -6
  4. data/app/models/blog_sweeper.rb +5 -0
  5. data/app/models/page_cache.rb +12 -6
  6. data/app/models/user.rb +7 -2
  7. data/app/views/admin/categories/show.html.erb +3 -3
  8. data/app/views/admin/content/_articles.html.erb +1 -1
  9. data/app/views/admin/general/index.html.erb +4 -4
  10. data/app/views/admin/sidebar/index.html.erb +1 -1
  11. data/app/views/admin/themes/index.html.erb +1 -1
  12. data/config/environments/development.rb +1 -1
  13. data/db/migrate/066_fix_profiles.rb +20 -0
  14. data/db/schema.rb +2 -2
  15. data/lib/tasks/release.rake +1 -8
  16. data/lib/typo_version.rb +1 -1
  17. data/spec/controllers/articles_controller_spec.rb +1 -1
  18. data/spec/fixtures/contents.yml +3 -13
  19. data/spec/fixtures/profiles.yml +11 -0
  20. data/spec/fixtures/tags.yml +0 -3
  21. data/spec/models/page_spec.rb +7 -4
  22. data/spec/models/tag_spec.rb +1 -1
  23. data/spec/spec_helper.rb +1 -0
  24. data/test/fixtures/profiles.yml +1 -6
  25. data/test/fixtures/users.yml +8 -8
  26. data/vendor/plugins/rspec/CHANGES +1 -9
  27. data/vendor/plugins/rspec/examples/pure/helper_method_example.rb +6 -9
  28. data/vendor/plugins/rspec/lib/spec/example/example_methods.rb +8 -9
  29. data/vendor/plugins/rspec/lib/spec/matchers.rb +7 -1
  30. data/vendor/plugins/rspec/lib/spec/matchers/be.rb +2 -3
  31. data/vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb +3 -10
  32. data/vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb +5 -8
  33. data/vendor/plugins/rspec/lib/spec/story/runner/story_parser.rb +8 -8
  34. data/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb +0 -1
  35. data/vendor/plugins/rspec/lib/spec/version.rb +1 -1
  36. data/vendor/plugins/rspec/spec/spec/example/example_methods_spec.rb +0 -16
  37. data/vendor/plugins/rspec/spec/spec/matchers/match_spec.rb +3 -3
  38. data/vendor/plugins/rspec/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +4 -45
  39. data/vendor/plugins/rspec/spec/spec/story/runner/story_runner_spec.rb +0 -37
  40. data/vendor/plugins/rspec/stories/example_groups/autogenerated_docstrings +8 -27
  41. data/vendor/plugins/rspec/stories/example_groups/output +0 -5
  42. data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/helper_example_group.rb +1 -0
  43. data/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/have_text.rb +2 -2
  44. data/vendor/plugins/rspec_on_rails/lib/spec/rails/version.rb +1 -1
  45. data/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb +46 -0
  46. metadata +5 -7
  47. data/spec/fixtures/articles_tags.yml +0 -19
  48. data/vendor/plugins/rspec/failing_examples/failing_autogenerated_docstrings_example.rb +0 -19
  49. data/vendor/plugins/rspec/stories/resources/stories/failing_story.rb +0 -15
  50. data/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb +0 -62
@@ -0,0 +1,11 @@
1
+ admin:
2
+ label: admin
3
+ nicename: Typo administrator
4
+
5
+ publisher:
6
+ label: publisher
7
+ nicename: Blog publisher
8
+
9
+ contributor:
10
+ label: contributor
11
+ nicename: Contributor
@@ -1,13 +1,10 @@
1
1
  # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
2
  foo_tag:
3
- id: 1
4
3
  name: foo
5
4
  display_name: foo
6
5
  bar_tag:
7
- id: 2
8
6
  name: bar
9
7
  display_name: bar
10
8
  bazz_tag:
11
- id: 3
12
9
  name: bazz
13
10
  display_name: bazz
@@ -11,12 +11,12 @@ describe 'Given the fixture :first_page' do
11
11
  @page.permalink_url.should == 'http://myblog.net/pages/page_one'
12
12
  end
13
13
 
14
- it '#edit_url should be: http://myblog.net/admin/pages/edit/9' do
15
- @page.edit_url.should == 'http://myblog.net/admin/pages/edit/9'
14
+ it '#edit_url should be: http://myblog.net/admin/pages/edit/<page_id>' do
15
+ @page.edit_url.should == "http://myblog.net/admin/pages/edit/#{@page.id}"
16
16
  end
17
17
 
18
18
  it '#delete_url should work too' do
19
- @page.delete_url.should == 'http://myblog.net/admin/pages/destroy/9'
19
+ @page.delete_url.should == "http://myblog.net/admin/pages/destroy/#{@page.id}"
20
20
  end
21
21
 
22
22
  it 'Pages cannot have the same name' do
@@ -44,7 +44,10 @@ end
44
44
  describe 'Given no pages' do
45
45
  it_should_behave_like "ValidPageHelper"
46
46
 
47
- before(:each) { @page = Page.new }
47
+ before(:each) do
48
+ Page.delete_all
49
+ @page = Page.new
50
+ end
48
51
 
49
52
  it 'An empty page is invalid' do
50
53
  @page.should_not be_valid
@@ -1,7 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe 'Given loaded fixtures' do
4
- fixtures :tags, :contents, :articles_tags, :blogs
4
+ fixtures :tags, :contents, :blogs
5
5
 
6
6
  it 'we can Tag.get by name' do
7
7
  Tag.get('foo').should == tags(:foo_tag)
@@ -8,6 +8,7 @@ Spec::Runner.configure do |config|
8
8
  config.use_transactional_fixtures = true
9
9
  config.use_instantiated_fixtures = false
10
10
  config.fixture_path = RAILS_ROOT + '/spec/fixtures'
11
+ config.global_fixtures = [:contents, :tags, :blogs, :profiles]
11
12
 
12
13
  config.before(:each) do
13
14
  CachedModel.cache_reset
@@ -1,16 +1,11 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
-
3
1
  admin:
4
- id: 1
5
2
  label: admin
6
3
  nicename: Typo administrator
7
4
 
8
5
  publisher:
9
- id: 2
10
6
  label: publisher
11
7
  nicename: Blog publisher
12
8
 
13
9
  contributor:
14
- id: 3
15
10
  label: contributor
16
- nicename: Contributor
11
+ nicename: Contributor
@@ -10,8 +10,8 @@ tobi:
10
10
  notify_via_jabber: false
11
11
  notify_on_new_articles: false
12
12
  notify_on_comments: true
13
- profile_id: 1
14
-
13
+ profile: admin
14
+
15
15
  bob:
16
16
  id: 2
17
17
  login: bob
@@ -22,8 +22,8 @@ bob:
22
22
  notify_via_jabber: false
23
23
  notify_on_new_articles: true
24
24
  notify_on_comments: false
25
- profile_id: 1
26
-
25
+ profile: admin
26
+
27
27
  existingbob:
28
28
  id: 3
29
29
  login: existingbob
@@ -34,7 +34,7 @@ existingbob:
34
34
  notify_via_jabber: false
35
35
  notify_on_new_articles: false
36
36
  notify_on_comments: false
37
- profile_id: 1
37
+ profile: admin
38
38
 
39
39
  longbob:
40
40
  id: 4
@@ -46,8 +46,8 @@ longbob:
46
46
  notify_via_jabber: false
47
47
  notify_on_new_articles: false
48
48
  notify_on_comments: false
49
- profile_id: 1
50
-
49
+ profile: admin
50
+
51
51
  randomuser:
52
52
  id: 5
53
53
  login: randomuser
@@ -58,4 +58,4 @@ randomuser:
58
58
  notify_via_jabber: false
59
59
  notify_on_new_articles: true
60
60
  notify_on_comments: true
61
- profile_id: 1
61
+ profile: admin
@@ -1,11 +1,3 @@
1
- == Trunk
2
-
3
- * Fixed regression in 1.1 that caused failing examples to fail to generate their own names. Closes LH[#209].
4
- * Applied doc patch from Jens Krämer for capturing content_for
5
- * Applied patch from Alexander Lang to clean up story steps after each story. Closes LH[#198].
6
- * Applied patch from Josh Knowles to support 'string_or_response.should have_text(...)'. Closes LH[#193].
7
- * Applied patch from Ian Dees to quiet the Story Runner backtrace. Closes LH[#183].
8
-
9
1
  == Version 1.1.1
10
2
 
11
3
  Bug fix release.
@@ -20,7 +12,7 @@ The "tell me a story and go nest yourself" release.
20
12
  * Applied patch from Mike Vincent to handle generators rails > 2.0.1. Closes LH[#181]
21
13
  * Formatter.pending signature changed so it gets passed an ExampleGroup instance instead of the name ( LH[#180])
22
14
  * Fixed LH[#180] Spec::Rails::Example::ModelExampleGroup and friends show up in rspec/rails output
23
- * Spec::Rails no longer loads ActiveRecord extensions if it's disabled in config/boot.rb
15
+ * Spec::Rails no longer loads ActiveRecord extensions if it's disablet in config/boot.rb
24
16
  * Applied LH[#178] small annoyances running specs with warnings enabled (Patch from Mikko Lehtonen)
25
17
  * Tighter integration with Rails fixtures. Take advantage of fixture caching to get performance improvements (Thanks to Pat Maddox, Nick Kallen, Jonathan Barnes, and Curtis)
26
18
 
@@ -1,14 +1,11 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
- module HelperMethodExample
4
- describe "an example group with helper a method" do
5
- def helper_method
6
- "received call"
7
- end
3
+ describe "a context with helper a method" do
4
+ def helper_method
5
+ "received call"
6
+ end
8
7
 
9
- it "should make that method available to specs" do
10
- helper_method.should == "received call"
11
- end
8
+ it "should make that method available to specs" do
9
+ helper_method.should == "received call"
12
10
  end
13
11
  end
14
-
@@ -64,22 +64,21 @@ module Spec
64
64
  @_defined_description || @_matcher_description || "NO NAME"
65
65
  end
66
66
 
67
- def set_instance_variables_from_hash(ivars)
68
- ivars.each do |variable_name, value|
69
- # Ruby 1.9 requires variable.to_s on the next line
70
- unless ['@_implementation', '@_defined_description', '@_matcher_description', '@method_name'].include?(variable_name.to_s)
67
+ def set_instance_variables_from_hash(instance_variables)
68
+ instance_variables.each do |variable_name, value|
69
+ unless ['@_implementation', '@_defined_description', '@_matcher_description', '@method_name'].index(variable_name)
71
70
  instance_variable_set variable_name, value
72
71
  end
73
72
  end
74
73
  end
75
74
 
76
75
  def run_with_description_capturing
77
- begin
78
- return instance_eval(&(@_implementation || PENDING_EXAMPLE_BLOCK))
79
- ensure
80
- @_matcher_description = Spec::Matchers.generated_description
81
- Spec::Matchers.clear_generated_description
76
+ return_value = nil
77
+
78
+ @_matcher_description = Matchers.capture_generated_description do
79
+ return_value = instance_eval(&(@_implementation || PENDING_EXAMPLE_BLOCK))
82
80
  end
81
+ return_value
83
82
  end
84
83
 
85
84
  protected
@@ -139,8 +139,14 @@ module Spec
139
139
  def clear_generated_description
140
140
  self.generated_description = nil
141
141
  end
142
- end
143
142
 
143
+ def capture_generated_description
144
+ yield
145
+ description = generated_description
146
+ clear_generated_description
147
+ description
148
+ end
149
+ end
144
150
  extend ModuleMethods
145
151
 
146
152
  def method_missing(sym, *args, &block) # :nodoc:
@@ -124,9 +124,8 @@ module Spec
124
124
  def parse_expected(expected)
125
125
  if Symbol === expected
126
126
  @handling_predicate = true
127
- ["be_an_","be_a_","be_"].each do |prefix|
128
- if expected.starts_with?(prefix)
129
- @prefix = prefix
127
+ ["be_an_","be_a_","be_"].each do |@prefix|
128
+ if expected.starts_with?(@prefix)
130
129
  return "#{expected.to_s.sub(@prefix,"")}".to_sym
131
130
  end
132
131
  end
@@ -39,8 +39,6 @@ module Spec
39
39
  @expected_received_count < values.size
40
40
  end
41
41
  @return_block = block_given? ? return_block : lambda { value }
42
- # Ruby 1.9 - see where this is used below
43
- @ignore_args = !block_given?
44
42
  end
45
43
 
46
44
  # :call-seq:
@@ -130,14 +128,9 @@ module Spec
130
128
 
131
129
  def invoke_return_block(args, block)
132
130
  args << block unless block.nil?
133
- # Ruby 1.9 - when we set @return_block to return values
134
- # regardless of arguments, any arguments will result in
135
- # a "wrong number of arguments" error
136
- if @ignore_args
137
- @return_block.call()
138
- else
139
- @return_block.call(*args)
140
- end
131
+ value = @return_block.call(*args)
132
+
133
+ value
141
134
  end
142
135
  end
143
136
 
@@ -20,7 +20,6 @@ module Spec
20
20
  end
21
21
 
22
22
  def story_started(title, narrative)
23
- @current_story_title = title
24
23
  @output.puts "Story: #{title}\n\n"
25
24
  narrative.each_line do |line|
26
25
  @output.print " "
@@ -34,7 +33,6 @@ module Spec
34
33
  end
35
34
 
36
35
  def scenario_started(story_title, scenario_name)
37
- @current_scenario_name = scenario_name
38
36
  @scenario_already_failed = false
39
37
  @output.print "\n\n Scenario: #{scenario_name}"
40
38
  @scenario_ok = true
@@ -45,12 +43,12 @@ module Spec
45
43
  end
46
44
 
47
45
  def scenario_failed(story_title, scenario_name, err)
48
- @options.backtrace_tweaker.tweak_backtrace(err)
49
46
  @failed_scenarios << [story_title, scenario_name, err] unless @scenario_already_failed
50
47
  @scenario_already_failed = true
51
48
  end
52
49
 
53
50
  def scenario_pending(story_title, scenario_name, msg)
51
+ @pending_steps << [story_title, scenario_name, msg]
54
52
  @pending_scenario_count += 1 unless @scenario_already_failed
55
53
  @scenario_already_failed = true
56
54
  end
@@ -60,8 +58,8 @@ module Spec
60
58
  unless @pending_steps.empty?
61
59
  @output.puts "\nPending Steps:"
62
60
  @pending_steps.each_with_index do |pending, i|
63
- story_name, scenario_name, msg = pending
64
- @output.puts "#{i+1}) #{story_name} (#{scenario_name}): #{msg}"
61
+ title, scenario_name, msg = pending
62
+ @output.puts "#{i+1}) #{title} (#{scenario_name}): #{msg}"
65
63
  end
66
64
  end
67
65
  unless @failed_scenarios.empty?
@@ -72,9 +70,9 @@ module Spec
72
70
  #{i+1}) #{title} (#{scenario_name}) FAILED
73
71
  #{err.class}: #{err.message}
74
72
  #{err.backtrace.join("\n")}
75
- ]
73
+ ]
76
74
  end
77
- end
75
+ end
78
76
  end
79
77
 
80
78
  def step_succeeded(type, description, *args)
@@ -83,7 +81,6 @@ module Spec
83
81
 
84
82
  def step_pending(type, description, *args)
85
83
  found_step(type, description, false, *args)
86
- @pending_steps << [@current_story_title, @current_scenario_name, description]
87
84
  @output.print " (PENDING)"
88
85
  @scenario_ok = false
89
86
  end
@@ -26,14 +26,14 @@ module Spec
26
26
  def process_line(line)
27
27
  line.strip!
28
28
  case line
29
- when /^Story: / then @state.story(line)
30
- when /^Scenario: / then @state.scenario(line)
31
- when /^Given:? / then @state.given(line)
32
- when /^GivenScenario:? / then @state.given_scenario(line)
33
- when /^When:? / then @state.event(line)
34
- when /^Then:? / then @state.outcome(line)
35
- when /^And:? / then @state.one_more_of_the_same(line)
36
- else @state.other(line)
29
+ when /^Story: / : @state.story(line)
30
+ when /^Scenario: / : @state.scenario(line)
31
+ when /^Given:? / : @state.given(line)
32
+ when /^GivenScenario:? / : @state.given_scenario(line)
33
+ when /^When:? / : @state.event(line)
34
+ when /^Then:? / : @state.outcome(line)
35
+ when /^And:? / : @state.one_more_of_the_same(line)
36
+ else @state.other(line)
37
37
  end
38
38
  end
39
39
 
@@ -48,7 +48,6 @@ module Spec
48
48
  @scenario_runner.run(scenario, world)
49
49
  end
50
50
  @listeners.each { |l| l.story_ended(story.title, story.narrative) }
51
- World.step_mother.clear
52
51
  end
53
52
  unique_steps = World.step_names.uniq.sort
54
53
  @listeners.each { |l| l.collected_steps(unique_steps) }
@@ -6,7 +6,7 @@ module Spec
6
6
  TINY = 1
7
7
  RELEASE_CANDIDATE = nil
8
8
 
9
- BUILD_TIME_UTC = 20071229014907
9
+ BUILD_TIME_UTC = 20071217181808
10
10
 
11
11
  STRING = [MAJOR, MINOR, TINY].join('.')
12
12
  TAG = "REL_#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('_')}".upcase.gsub(/\.|-/, '_')
@@ -70,22 +70,6 @@ module Spec
70
70
  @example_group.run
71
71
  ExampleMethods.count.should == 5
72
72
  end
73
-
74
- describe "run_with_description_capturing" do
75
- before(:each) do
76
- @example_group = Class.new(ExampleGroup) do end
77
- @example = @example_group.new("foo", &(lambda { 2.should == 2 }))
78
- @example.run_with_description_capturing
79
- end
80
-
81
- it "should provide the generated description" do
82
- @example.instance_eval { @_matcher_description }.should == "should == 2"
83
- end
84
-
85
- it "should clear the global generated_description" do
86
- Spec::Matchers.generated_description.should == nil
87
- end
88
- end
89
73
  end
90
74
  end
91
75
  end
@@ -5,12 +5,12 @@ describe "should match(expected)" do
5
5
  "string".should match(/tri/)
6
6
  end
7
7
 
8
- it "should fail when target (String) does not match expected (Regexp)" do
8
+ it "should fail when target (String) matches expected (Regexp)" do
9
9
  lambda {
10
10
  "string".should match(/rings/)
11
11
  }.should fail
12
12
  end
13
-
13
+
14
14
  it "should provide message, expected and actual on failure" do
15
15
  matcher = match(/rings/)
16
16
  matcher.matches?("string")
@@ -19,7 +19,7 @@ describe "should match(expected)" do
19
19
  end
20
20
 
21
21
  describe "should_not match(expected)" do
22
- it "should pass when target (String) matches does not match (Regexp)" do
22
+ it "should pass when target (String) matches expected (Regexp)" do
23
23
  "string".should_not match(/rings/)
24
24
  end
25
25
 
@@ -9,11 +9,8 @@ module Spec
9
9
  before :each do
10
10
  # given
11
11
  @out = StringIO.new
12
- @tweaker = mock('tweaker')
13
- @tweaker.stub!(:tweak_backtrace)
14
12
  @options = mock('options')
15
13
  @options.stub!(:colour).and_return(false)
16
- @options.stub!(:backtrace_tweaker).and_return(@tweaker)
17
14
  @formatter = PlainTextFormatter.new(@options, @out)
18
15
  end
19
16
 
@@ -62,40 +59,6 @@ module Spec
62
59
  @out.string.should include("3 scenarios: 1 succeeded, 2 failed")
63
60
  end
64
61
 
65
- it 'should end cleanly (no characters on the last line) with successes' do
66
- # when
67
- @formatter.run_started(1)
68
- @formatter.scenario_started(nil, nil)
69
- @formatter.scenario_succeeded('story', 'scenario')
70
- @formatter.run_ended
71
-
72
- # then
73
- @out.string.should =~ /\n\z/
74
- end
75
-
76
- it 'should end cleanly (no characters on the last line) with failures' do
77
- # when
78
- @formatter.run_started(1)
79
- @formatter.scenario_started(nil, nil)
80
- @formatter.scenario_failed('story', 'scenario', exception_from { raise RuntimeError, 'oops' })
81
- @formatter.run_ended
82
-
83
- # then
84
- @out.string.should =~ /\n\z/
85
- end
86
-
87
- it 'should end cleanly (no characters on the last line) with pending steps' do
88
- # when
89
- @formatter.run_started(1)
90
- @formatter.scenario_started(nil, nil)
91
- @formatter.step_pending(:then, 'do pend')
92
- @formatter.scenario_pending('story', 'scenario', exception_from { raise RuntimeError, 'oops' })
93
- @formatter.run_ended
94
-
95
- # then
96
- @out.string.should =~ /\n\z/
97
- end
98
-
99
62
  it 'should summarize the number of pending scenarios when the run ends' do
100
63
  # when
101
64
  @formatter.run_started(3)
@@ -183,18 +146,14 @@ module Spec
183
146
  it 'should produce details of each pending step when the run ends' do
184
147
  # when
185
148
  @formatter.run_started(2)
186
- @formatter.story_started('story 1', 'narrative')
187
- @formatter.scenario_started('story 1', 'scenario 1')
188
- @formatter.step_pending(:given, 'todo 1', [])
189
- @formatter.story_started('story 2', 'narrative')
190
- @formatter.scenario_started('story 2', 'scenario 2')
191
- @formatter.step_pending(:given, 'todo 2', [])
149
+ @formatter.scenario_pending('story', 'scenario2', 'todo2')
150
+ @formatter.scenario_pending('story', 'scenario3', 'todo3')
192
151
  @formatter.run_ended
193
152
 
194
153
  # then
195
154
  @out.string.should include("Pending Steps:\n")
196
- @out.string.should include("1) story 1 (scenario 1): todo 1")
197
- @out.string.should include("2) story 2 (scenario 2): todo 2")
155
+ @out.string.should include("1) story (scenario2): todo2")
156
+ @out.string.should include("2) story (scenario3): todo3")
198
157
  end
199
158
 
200
159
  it 'should document a story title and narrative' do