thoughtbot-shoulda 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -90,19 +90,6 @@ Macros to test the most common controller patterns...
90
90
  end
91
91
  end
92
92
 
93
- Test entire controllers in a few lines...
94
-
95
- class PostsControllerTest < Test::Unit::TestCase
96
- should_be_restful do |resource|
97
- resource.parent = :user
98
-
99
- resource.create.params = { :title => "first post", :body => 'blah blah blah'}
100
- resource.update.params = { :title => "changed" }
101
- end
102
- end
103
-
104
- should_be_restful generates 40 tests on the fly, for both html and xml requests.
105
-
106
93
  === Helpful Assertions (ThoughtBot::Shoulda::Assertions)
107
94
 
108
95
  More to come here, but have fun with what's there.
data/Rakefile CHANGED
@@ -52,8 +52,6 @@ spec = Gem::Specification.new do |s|
52
52
 
53
53
  s.authors = ["Tammer Saleh"]
54
54
  s.email = "tsaleh@thoughtbot.com"
55
-
56
- s.add_dependency "activesupport", ">= 2.0.0"
57
55
  end
58
56
 
59
57
  Rake::GemPackageTask.new spec do |pkg|
@@ -66,7 +66,10 @@ module ThoughtBot # :nodoc:
66
66
  end
67
67
 
68
68
  def pretty_error_messages(obj)
69
- obj.errors.map { |a, m| "#{a} #{m} (#{obj.send(a).inspect})" }
69
+ obj.errors.map do |a, m|
70
+ msg = "#{a} #{m}"
71
+ msg << " (#{obj.send(a).inspect})" unless a.to_sym == :base
72
+ end
70
73
  end
71
74
 
72
75
  private
@@ -516,7 +516,7 @@ module ThoughtBot # :nodoc:
516
516
  assert reflection, "#{klass.name} does not have any relationship to #{association}"
517
517
  assert_equal :has_and_belongs_to_many, reflection.macro
518
518
  table = reflection.options[:join_table]
519
- assert ::ActiveRecord::Base.connection.tables.include?(table), "table #{table} doesn't exist"
519
+ assert ::ActiveRecord::Base.connection.tables.include?(table.to_s), "table #{table} doesn't exist"
520
520
  end
521
521
  end
522
522
  end
@@ -1,6 +1,6 @@
1
1
  module Thoughtbot # :nodoc:
2
2
  module Shoulda
3
- VERSION = '2.0.5'
3
+ VERSION = '2.0.6'
4
4
 
5
5
  class << self
6
6
  attr_accessor :contexts
@@ -100,7 +100,7 @@ module ThoughtBot # :nodoc:
100
100
  def should_not_set_the_flash
101
101
  should_set_the_flash_to nil
102
102
  end
103
-
103
+
104
104
  # Macro that creates a test asserting that filter_parameter_logging
105
105
  # is set for the specified keys
106
106
  #
@@ -227,9 +227,9 @@ module ThoughtBot # :nodoc:
227
227
  # should_render_with_layout 'special'
228
228
  def should_render_with_layout(expected_layout = 'application')
229
229
  if expected_layout
230
- should "render with #{expected_layout} layout" do
230
+ should "render with #{expected_layout.inspect} layout" do
231
231
  response_layout = @response.layout.blank? ? "" : @response.layout.split('/').last
232
- assert_equal expected_layout,
232
+ assert_equal expected_layout.to_s,
233
233
  response_layout,
234
234
  "Expected to render with layout #{expected_layout} but was rendered with #{response_layout}"
235
235
  end
@@ -288,7 +288,7 @@ module ThoughtBot # :nodoc:
288
288
  # should_route :edit, "/posts/1", :action => :show, :id => 1
289
289
  # should_route :put, "/posts/1", :action => :update, :id => 1
290
290
  # should_route :delete, "/posts/1", :action => :destroy, :id => 1
291
- # should_route :get, "/users/1/posts/1",
291
+ # should_route :get, "/users/1/posts/1",
292
292
  # :action => :show, :id => 1, :user_id => 1
293
293
  #
294
294
  def should_route(method, path, options)
@@ -11,7 +11,7 @@ module ThoughtBot # :nodoc:
11
11
  #
12
12
  # Example:
13
13
  #
14
- # context "Creating a post"
14
+ # context "Creating a post" do
15
15
  # setup { Post.create }
16
16
  # should_change "Post.count", :by => 1
17
17
  # end
@@ -53,7 +53,7 @@ module ThoughtBot # :nodoc:
53
53
  #
54
54
  # Example:
55
55
  #
56
- # context "Updating a post"
56
+ # context "Updating a post" do
57
57
  # setup { @post.update_attributes(:title => "new") }
58
58
  # should_not_change "Post.count"
59
59
  # end
@@ -93,6 +93,7 @@ class PostsControllerTest < Test::Unit::TestCase
93
93
  context "viewing a post on GET to #show" do
94
94
  setup { get :show, :user_id => users(:first), :id => posts(:first) }
95
95
  should_render_with_layout 'wide'
96
+ should_render_with_layout :wide
96
97
  end
97
98
 
98
99
  context "on GET to #new" do
@@ -1,5 +1,5 @@
1
1
  class Dog < ActiveRecord::Base
2
2
  belongs_to :user, :foreign_key => :owner_id
3
3
  belongs_to :address
4
- has_and_belongs_to_many :fleas
4
+ has_and_belongs_to_many :fleas, :join_table => :fleas
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thoughtbot-shoulda
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tammer Saleh
@@ -9,18 +9,10 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-15 00:00:00 -07:00
12
+ date: 2008-12-10 00:00:00 -08:00
13
13
  default_executable: convert_to_should_syntax
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: activesupport
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.0.0
23
- version:
14
+ dependencies: []
15
+
24
16
  description:
25
17
  email: tsaleh@thoughtbot.com
26
18
  executables: