carlosbrando-remarkable 2.2.1 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +0 -83
- data/Rakefile +8 -1
- data/lib/remarkable.rb +1 -1
- data/lib/remarkable/active_record/macros/database/column_matcher.rb +6 -53
- data/lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb +2 -2
- data/lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb +1 -1
- data/remarkable.gemspec +6 -5
- metadata +6 -87
- data/spec/controllers/posts_controller_spec.rb +0 -220
- data/spec/controllers/users_controller_spec.rb +0 -15
- data/spec/fixtures/addresses.yml +0 -3
- data/spec/fixtures/fleas.yml +0 -10
- data/spec/fixtures/friendships.yml +0 -0
- data/spec/fixtures/posts.yml +0 -5
- data/spec/fixtures/products.yml +0 -0
- data/spec/fixtures/taggings.yml +0 -0
- data/spec/fixtures/tags.yml +0 -9
- data/spec/fixtures/users.yml +0 -13
- data/spec/models/address_spec.rb +0 -65
- data/spec/models/dog_spec.rb +0 -78
- data/spec/models/flea_spec.rb +0 -39
- data/spec/models/friendship_spec.rb +0 -13
- data/spec/models/post_spec.rb +0 -69
- data/spec/models/product_spec.rb +0 -122
- data/spec/models/tag_spec.rb +0 -21
- data/spec/models/tagging_spec.rb +0 -37
- data/spec/models/user_spec.rb +0 -292
- data/spec/other/custom_macros_spec.rb +0 -27
- data/spec/other/my_own_matcher_spec.rb +0 -11
- data/spec/other/private_helpers_spec.rb +0 -31
- data/spec/rails_root/app/controllers/application.rb +0 -25
- data/spec/rails_root/app/controllers/posts_controller.rb +0 -87
- data/spec/rails_root/app/controllers/users_controller.rb +0 -84
- data/spec/rails_root/app/helpers/application_helper.rb +0 -3
- data/spec/rails_root/app/helpers/posts_helper.rb +0 -2
- data/spec/rails_root/app/helpers/users_helper.rb +0 -2
- data/spec/rails_root/app/models/address.rb +0 -7
- data/spec/rails_root/app/models/flea.rb +0 -7
- data/spec/rails_root/app/models/friendship.rb +0 -4
- data/spec/rails_root/app/models/pets/dog.rb +0 -12
- data/spec/rails_root/app/models/post.rb +0 -12
- data/spec/rails_root/app/models/product.rb +0 -14
- data/spec/rails_root/app/models/tag.rb +0 -8
- data/spec/rails_root/app/models/tagging.rb +0 -6
- data/spec/rails_root/app/models/user.rb +0 -43
- data/spec/rails_root/app/views/layouts/posts.rhtml +0 -19
- data/spec/rails_root/app/views/layouts/users.rhtml +0 -17
- data/spec/rails_root/app/views/layouts/wide.html.erb +0 -1
- data/spec/rails_root/app/views/posts/edit.rhtml +0 -27
- data/spec/rails_root/app/views/posts/index.rhtml +0 -25
- data/spec/rails_root/app/views/posts/new.rhtml +0 -26
- data/spec/rails_root/app/views/posts/show.rhtml +0 -18
- data/spec/rails_root/app/views/users/edit.rhtml +0 -22
- data/spec/rails_root/app/views/users/index.rhtml +0 -22
- data/spec/rails_root/app/views/users/new.rhtml +0 -21
- data/spec/rails_root/app/views/users/show.rhtml +0 -13
- data/spec/rails_root/config/boot.rb +0 -109
- data/spec/rails_root/config/database.yml +0 -3
- data/spec/rails_root/config/environment.rb +0 -16
- data/spec/rails_root/config/environments/test.rb +0 -0
- data/spec/rails_root/config/initializers/new_rails_defaults.rb +0 -15
- data/spec/rails_root/config/initializers/shoulda.rb +0 -8
- data/spec/rails_root/config/locales/en.yml +0 -8
- data/spec/rails_root/config/routes.rb +0 -6
- data/spec/rails_root/db/migrate/001_create_users.rb +0 -18
- data/spec/rails_root/db/migrate/002_create_posts.rb +0 -13
- data/spec/rails_root/db/migrate/003_create_taggings.rb +0 -12
- data/spec/rails_root/db/migrate/004_create_tags.rb +0 -11
- data/spec/rails_root/db/migrate/005_create_dogs.rb +0 -13
- data/spec/rails_root/db/migrate/006_create_addresses.rb +0 -14
- data/spec/rails_root/db/migrate/007_create_fleas.rb +0 -11
- data/spec/rails_root/db/migrate/008_create_dogs_fleas.rb +0 -12
- data/spec/rails_root/db/migrate/009_create_products.rb +0 -17
- data/spec/rails_root/db/migrate/010_create_friendships.rb +0 -14
- data/spec/rails_root/db/migrate/011_add_fleas_color.rb +0 -10
- data/spec/rails_root/db/migrate/012_add_fleas_address.rb +0 -10
- data/spec/rails_root/db/schema.rb +0 -0
- data/spec/rails_root/log/.keep +0 -0
- data/spec/rails_root/public/.htaccess +0 -40
- data/spec/rails_root/public/404.html +0 -30
- data/spec/rails_root/public/422.html +0 -30
- data/spec/rails_root/public/500.html +0 -30
- data/spec/rails_root/script/console +0 -3
- data/spec/rails_root/script/generate +0 -3
- data/spec/rails_root/spec/remarkable_macros/.keep +0 -0
- data/spec/rails_root/vendor/plugins/.keep +0 -0
- data/spec/rails_root/vendor/plugins/my_plugin/remarkable_macros/.keep +0 -0
- data/spec/rcov.opts +0 -2
- data/spec/spec.opts +0 -4
- data/spec/spec_helper.rb +0 -56
data/Manifest.txt
CHANGED
@@ -56,87 +56,4 @@ remarkable.gemspec
|
|
56
56
|
script/console
|
57
57
|
script/destroy
|
58
58
|
script/generate
|
59
|
-
spec/controllers/posts_controller_spec.rb
|
60
|
-
spec/controllers/users_controller_spec.rb
|
61
|
-
spec/fixtures/addresses.yml
|
62
|
-
spec/fixtures/fleas.yml
|
63
|
-
spec/fixtures/friendships.yml
|
64
|
-
spec/fixtures/posts.yml
|
65
|
-
spec/fixtures/products.yml
|
66
|
-
spec/fixtures/taggings.yml
|
67
|
-
spec/fixtures/tags.yml
|
68
|
-
spec/fixtures/users.yml
|
69
|
-
spec/models/address_spec.rb
|
70
|
-
spec/models/dog_spec.rb
|
71
|
-
spec/models/flea_spec.rb
|
72
|
-
spec/models/friendship_spec.rb
|
73
|
-
spec/models/post_spec.rb
|
74
|
-
spec/models/product_spec.rb
|
75
|
-
spec/models/tag_spec.rb
|
76
|
-
spec/models/tagging_spec.rb
|
77
|
-
spec/models/user_spec.rb
|
78
|
-
spec/other/custom_macros_spec.rb
|
79
|
-
spec/other/my_own_matcher_spec.rb
|
80
|
-
spec/other/private_helpers_spec.rb
|
81
|
-
spec/rails_root/app/controllers/application.rb
|
82
|
-
spec/rails_root/app/controllers/posts_controller.rb
|
83
|
-
spec/rails_root/app/controllers/users_controller.rb
|
84
|
-
spec/rails_root/app/helpers/application_helper.rb
|
85
|
-
spec/rails_root/app/helpers/posts_helper.rb
|
86
|
-
spec/rails_root/app/helpers/users_helper.rb
|
87
|
-
spec/rails_root/app/models/address.rb
|
88
|
-
spec/rails_root/app/models/flea.rb
|
89
|
-
spec/rails_root/app/models/friendship.rb
|
90
|
-
spec/rails_root/app/models/pets/dog.rb
|
91
|
-
spec/rails_root/app/models/post.rb
|
92
|
-
spec/rails_root/app/models/product.rb
|
93
|
-
spec/rails_root/app/models/tag.rb
|
94
|
-
spec/rails_root/app/models/tagging.rb
|
95
|
-
spec/rails_root/app/models/user.rb
|
96
|
-
spec/rails_root/app/views/layouts/posts.rhtml
|
97
|
-
spec/rails_root/app/views/layouts/users.rhtml
|
98
|
-
spec/rails_root/app/views/layouts/wide.html.erb
|
99
|
-
spec/rails_root/app/views/posts/edit.rhtml
|
100
|
-
spec/rails_root/app/views/posts/index.rhtml
|
101
|
-
spec/rails_root/app/views/posts/new.rhtml
|
102
|
-
spec/rails_root/app/views/posts/show.rhtml
|
103
|
-
spec/rails_root/app/views/users/edit.rhtml
|
104
|
-
spec/rails_root/app/views/users/index.rhtml
|
105
|
-
spec/rails_root/app/views/users/new.rhtml
|
106
|
-
spec/rails_root/app/views/users/show.rhtml
|
107
|
-
spec/rails_root/config/boot.rb
|
108
|
-
spec/rails_root/config/database.yml
|
109
|
-
spec/rails_root/config/environment.rb
|
110
|
-
spec/rails_root/config/environments/test.rb
|
111
|
-
spec/rails_root/config/initializers/new_rails_defaults.rb
|
112
|
-
spec/rails_root/config/initializers/shoulda.rb
|
113
|
-
spec/rails_root/config/locales/en.yml
|
114
|
-
spec/rails_root/config/routes.rb
|
115
|
-
spec/rails_root/db/migrate/001_create_users.rb
|
116
|
-
spec/rails_root/db/migrate/002_create_posts.rb
|
117
|
-
spec/rails_root/db/migrate/003_create_taggings.rb
|
118
|
-
spec/rails_root/db/migrate/004_create_tags.rb
|
119
|
-
spec/rails_root/db/migrate/005_create_dogs.rb
|
120
|
-
spec/rails_root/db/migrate/006_create_addresses.rb
|
121
|
-
spec/rails_root/db/migrate/007_create_fleas.rb
|
122
|
-
spec/rails_root/db/migrate/008_create_dogs_fleas.rb
|
123
|
-
spec/rails_root/db/migrate/009_create_products.rb
|
124
|
-
spec/rails_root/db/migrate/010_create_friendships.rb
|
125
|
-
spec/rails_root/db/migrate/011_add_fleas_color.rb
|
126
|
-
spec/rails_root/db/migrate/012_add_fleas_address.rb
|
127
|
-
spec/rails_root/db/schema.rb
|
128
|
-
spec/rails_root/log/.keep
|
129
|
-
spec/rails_root/log/test.log
|
130
|
-
spec/rails_root/public/.htaccess
|
131
|
-
spec/rails_root/public/404.html
|
132
|
-
spec/rails_root/public/422.html
|
133
|
-
spec/rails_root/public/500.html
|
134
|
-
spec/rails_root/script/console
|
135
|
-
spec/rails_root/script/generate
|
136
|
-
spec/rails_root/spec/remarkable_macros/.keep
|
137
|
-
spec/rails_root/vendor/plugins/.keep
|
138
|
-
spec/rails_root/vendor/plugins/my_plugin/remarkable_macros/.keep
|
139
|
-
spec/rcov.opts
|
140
|
-
spec/spec.opts
|
141
|
-
spec/spec_helper.rb
|
142
59
|
tasks/rspec.rake
|
data/Rakefile
CHANGED
@@ -4,14 +4,21 @@ require File.dirname(__FILE__) + '/lib/remarkable'
|
|
4
4
|
# Generate all the Rake tasks
|
5
5
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
6
|
$hoe = Hoe.new('remarkable', Remarkable::VERSION) do |p|
|
7
|
-
p.developer
|
7
|
+
p.developer 'Carlos Brando', 'eduardobrando@gmail.com'
|
8
|
+
p.developer 'José Valim', 'jose.valim@gmail.com'
|
9
|
+
p.developer 'Diego Carrion', 'dc.rec1@gmail.com'
|
10
|
+
|
11
|
+
p.url = 'http://www.nomedojogo.com/2008/11/18/shoulda-for-rspec-is-remarkable/'
|
12
|
+
p.summary = 'Remarkable is a framework for Rspec matchers.'
|
8
13
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
14
|
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
15
|
p.rubyforge_name = p.name # TODO this is default value
|
16
|
+
|
11
17
|
p.extra_deps = [
|
12
18
|
['rspec','>= 1.1.12'],
|
13
19
|
['rspec-rails','>= 1.1.12']
|
14
20
|
]
|
21
|
+
|
15
22
|
p.extra_dev_deps = [
|
16
23
|
['newgem', ">= #{::Newgem::VERSION}"]
|
17
24
|
]
|
data/lib/remarkable.rb
CHANGED
@@ -3,59 +3,12 @@ module Remarkable # :nodoc:
|
|
3
3
|
module Matchers # :nodoc:
|
4
4
|
|
5
5
|
class ColumnMatcher < Remarkable::Matcher::Base
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def type(type)
|
12
|
-
@options[:type] = type
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def primary(value = true)
|
17
|
-
@options[:primary] = value
|
18
|
-
self
|
19
|
-
end
|
6
|
+
arguments :columns
|
7
|
+
|
8
|
+
optional :type, :default, :precision, :limit, :scale, :sql_type
|
9
|
+
optional :primary, :null, :default => true
|
20
10
|
|
21
|
-
|
22
|
-
@options[:default] = default
|
23
|
-
self
|
24
|
-
end
|
25
|
-
|
26
|
-
def precision(precision)
|
27
|
-
@options[:precision] = precision
|
28
|
-
self
|
29
|
-
end
|
30
|
-
|
31
|
-
def limit(limit)
|
32
|
-
@options[:limit] = limit
|
33
|
-
self
|
34
|
-
end
|
35
|
-
|
36
|
-
def null(value = true)
|
37
|
-
@options[:null] = value
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
def scale(scale)
|
42
|
-
@options[:scale] = scale
|
43
|
-
self
|
44
|
-
end
|
45
|
-
|
46
|
-
def sql_type(sql_type)
|
47
|
-
@options[:sql_type] = sql_type
|
48
|
-
self
|
49
|
-
end
|
50
|
-
|
51
|
-
def matches?(subject)
|
52
|
-
@subject = subject
|
53
|
-
|
54
|
-
assert_matcher_for(@columns) do |column|
|
55
|
-
@column = column
|
56
|
-
has_column? && all_options_correct?
|
57
|
-
end
|
58
|
-
end
|
11
|
+
assertions :has_column?, :all_options_correct?
|
59
12
|
|
60
13
|
def failure_message
|
61
14
|
"Expected #{expectation} (#{@missing})"
|
@@ -75,7 +28,7 @@ module Remarkable # :nodoc:
|
|
75
28
|
description
|
76
29
|
end
|
77
30
|
|
78
|
-
|
31
|
+
private
|
79
32
|
|
80
33
|
def column_type
|
81
34
|
subject_class.columns.detect {|c| c.name == @column.to_s }
|
@@ -27,8 +27,8 @@ module Remarkable # :nodoc:
|
|
27
27
|
protected = subject_class.protected_attributes || []
|
28
28
|
accessible = subject_class.accessible_attributes || []
|
29
29
|
|
30
|
-
return true
|
31
|
-
return true
|
30
|
+
return true if !protected.empty? && !protected.include?(attribute.to_s)
|
31
|
+
return true if !accessible.empty? && accessible.include?(attribute.to_s)
|
32
32
|
|
33
33
|
@missing = accessible.empty? ? "#{subject_class} is protecting #{protected.to_a.to_sentence}" :
|
34
34
|
"#{subject_class} has not made #{attribute} accessible"
|
@@ -27,7 +27,7 @@ module Remarkable # :nodoc:
|
|
27
27
|
protected = subject_class.protected_attributes || []
|
28
28
|
accessible = subject_class.accessible_attributes || []
|
29
29
|
|
30
|
-
return true if protected.include?(attribute.to_s)
|
30
|
+
return true if !protected.empty? && protected.include?(attribute.to_s)
|
31
31
|
return true if !accessible.empty? && !accessible.include?(attribute.to_s)
|
32
32
|
|
33
33
|
@missing = accessible.empty? ? "#{subject_class} is protecting #{protected.to_a.to_sentence}, but not #{attribute}." :
|
data/remarkable.gemspec
CHANGED
@@ -2,16 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{remarkable}
|
5
|
-
s.version = "2.2.
|
5
|
+
s.version = "2.2.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Carlos Brando", "
|
8
|
+
s.authors = ["Carlos Brando", "Jos\303\251 Valim", "Diego Carrion"]
|
9
9
|
s.date = %q{2009-02-10}
|
10
|
-
s.description = %q{
|
11
|
-
s.email = ["eduardobrando@gmail.com"]
|
10
|
+
s.description = %q{}
|
11
|
+
s.email = ["eduardobrando@gmail.com", "jose.valim@gmail.com", "dc.rec1@gmail.com"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
|
13
|
-
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "init.rb", "lib/remarkable.rb", "lib/remarkable/active_record/README.markdown", "lib/remarkable/active_record/active_record.rb", "lib/remarkable/active_record/helpers.rb", "lib/remarkable/active_record/macros.rb", "lib/remarkable/active_record/macros/associations/association_matcher.rb", "lib/remarkable/active_record/macros/callbacks/callback_matcher.rb", "lib/remarkable/active_record/macros/database/column_matcher.rb", "lib/remarkable/active_record/macros/database/index_matcher.rb", "lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb", "lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb", "lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb", "lib/remarkable/assertions.rb", "lib/remarkable/controller/README.markdown", "lib/remarkable/controller/controller.rb", "lib/remarkable/controller/helpers.rb", "lib/remarkable/controller/macros.rb", "lib/remarkable/controller/macros/assign_matcher.rb", "lib/remarkable/controller/macros/filter_params_matcher.rb", "lib/remarkable/controller/macros/metadata_matcher.rb", "lib/remarkable/controller/macros/render_with_layout_matcher.rb", "lib/remarkable/controller/macros/respond_with_content_type_matcher.rb", "lib/remarkable/controller/macros/respond_with_matcher.rb", "lib/remarkable/controller/macros/return_from_session_matcher.rb", "lib/remarkable/controller/macros/route_matcher.rb", "lib/remarkable/controller/macros/set_the_flash_to_matcher.rb", "lib/remarkable/dsl.rb", "lib/remarkable/example/example_methods.rb", "lib/remarkable/helpers.rb", "lib/remarkable/matcher_base.rb", "lib/remarkable/private_helpers.rb", "lib/remarkable/rails.rb", "rails/init.rb", "remarkable.gemspec", "script/console", "script/destroy", "script/generate", "
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "init.rb", "lib/remarkable.rb", "lib/remarkable/active_record/README.markdown", "lib/remarkable/active_record/active_record.rb", "lib/remarkable/active_record/helpers.rb", "lib/remarkable/active_record/macros.rb", "lib/remarkable/active_record/macros/associations/association_matcher.rb", "lib/remarkable/active_record/macros/callbacks/callback_matcher.rb", "lib/remarkable/active_record/macros/database/column_matcher.rb", "lib/remarkable/active_record/macros/database/index_matcher.rb", "lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb", "lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb", "lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb", "lib/remarkable/assertions.rb", "lib/remarkable/controller/README.markdown", "lib/remarkable/controller/controller.rb", "lib/remarkable/controller/helpers.rb", "lib/remarkable/controller/macros.rb", "lib/remarkable/controller/macros/assign_matcher.rb", "lib/remarkable/controller/macros/filter_params_matcher.rb", "lib/remarkable/controller/macros/metadata_matcher.rb", "lib/remarkable/controller/macros/render_with_layout_matcher.rb", "lib/remarkable/controller/macros/respond_with_content_type_matcher.rb", "lib/remarkable/controller/macros/respond_with_matcher.rb", "lib/remarkable/controller/macros/return_from_session_matcher.rb", "lib/remarkable/controller/macros/route_matcher.rb", "lib/remarkable/controller/macros/set_the_flash_to_matcher.rb", "lib/remarkable/dsl.rb", "lib/remarkable/example/example_methods.rb", "lib/remarkable/helpers.rb", "lib/remarkable/matcher_base.rb", "lib/remarkable/private_helpers.rb", "lib/remarkable/rails.rb", "rails/init.rb", "remarkable.gemspec", "script/console", "script/destroy", "script/generate", "tasks/rspec.rake"]
|
14
14
|
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://www.nomedojogo.com/2008/11/18/shoulda-for-rspec-is-remarkable/}
|
15
16
|
s.post_install_message = %q{PostInstall.txt}
|
16
17
|
s.rdoc_options = ["--main", "README.rdoc"]
|
17
18
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carlosbrando-remarkable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Brando
|
8
|
-
- Diego Carrion
|
9
8
|
- "Jos\xC3\xA9 Valim"
|
9
|
+
- Diego Carrion
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
@@ -50,9 +50,11 @@ dependencies:
|
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: 1.8.0
|
52
52
|
version:
|
53
|
-
description:
|
53
|
+
description: ""
|
54
54
|
email:
|
55
55
|
- eduardobrando@gmail.com
|
56
|
+
- jose.valim@gmail.com
|
57
|
+
- dc.rec1@gmail.com
|
56
58
|
executables: []
|
57
59
|
|
58
60
|
extensions: []
|
@@ -121,92 +123,9 @@ files:
|
|
121
123
|
- script/console
|
122
124
|
- script/destroy
|
123
125
|
- script/generate
|
124
|
-
- spec/controllers/posts_controller_spec.rb
|
125
|
-
- spec/controllers/users_controller_spec.rb
|
126
|
-
- spec/fixtures/addresses.yml
|
127
|
-
- spec/fixtures/fleas.yml
|
128
|
-
- spec/fixtures/friendships.yml
|
129
|
-
- spec/fixtures/posts.yml
|
130
|
-
- spec/fixtures/products.yml
|
131
|
-
- spec/fixtures/taggings.yml
|
132
|
-
- spec/fixtures/tags.yml
|
133
|
-
- spec/fixtures/users.yml
|
134
|
-
- spec/models/address_spec.rb
|
135
|
-
- spec/models/dog_spec.rb
|
136
|
-
- spec/models/flea_spec.rb
|
137
|
-
- spec/models/friendship_spec.rb
|
138
|
-
- spec/models/post_spec.rb
|
139
|
-
- spec/models/product_spec.rb
|
140
|
-
- spec/models/tag_spec.rb
|
141
|
-
- spec/models/tagging_spec.rb
|
142
|
-
- spec/models/user_spec.rb
|
143
|
-
- spec/other/custom_macros_spec.rb
|
144
|
-
- spec/other/my_own_matcher_spec.rb
|
145
|
-
- spec/other/private_helpers_spec.rb
|
146
|
-
- spec/rails_root/app/controllers/application.rb
|
147
|
-
- spec/rails_root/app/controllers/posts_controller.rb
|
148
|
-
- spec/rails_root/app/controllers/users_controller.rb
|
149
|
-
- spec/rails_root/app/helpers/application_helper.rb
|
150
|
-
- spec/rails_root/app/helpers/posts_helper.rb
|
151
|
-
- spec/rails_root/app/helpers/users_helper.rb
|
152
|
-
- spec/rails_root/app/models/address.rb
|
153
|
-
- spec/rails_root/app/models/flea.rb
|
154
|
-
- spec/rails_root/app/models/friendship.rb
|
155
|
-
- spec/rails_root/app/models/pets/dog.rb
|
156
|
-
- spec/rails_root/app/models/post.rb
|
157
|
-
- spec/rails_root/app/models/product.rb
|
158
|
-
- spec/rails_root/app/models/tag.rb
|
159
|
-
- spec/rails_root/app/models/tagging.rb
|
160
|
-
- spec/rails_root/app/models/user.rb
|
161
|
-
- spec/rails_root/app/views/layouts/posts.rhtml
|
162
|
-
- spec/rails_root/app/views/layouts/users.rhtml
|
163
|
-
- spec/rails_root/app/views/layouts/wide.html.erb
|
164
|
-
- spec/rails_root/app/views/posts/edit.rhtml
|
165
|
-
- spec/rails_root/app/views/posts/index.rhtml
|
166
|
-
- spec/rails_root/app/views/posts/new.rhtml
|
167
|
-
- spec/rails_root/app/views/posts/show.rhtml
|
168
|
-
- spec/rails_root/app/views/users/edit.rhtml
|
169
|
-
- spec/rails_root/app/views/users/index.rhtml
|
170
|
-
- spec/rails_root/app/views/users/new.rhtml
|
171
|
-
- spec/rails_root/app/views/users/show.rhtml
|
172
|
-
- spec/rails_root/config/boot.rb
|
173
|
-
- spec/rails_root/config/database.yml
|
174
|
-
- spec/rails_root/config/environment.rb
|
175
|
-
- spec/rails_root/config/environments/test.rb
|
176
|
-
- spec/rails_root/config/initializers/new_rails_defaults.rb
|
177
|
-
- spec/rails_root/config/initializers/shoulda.rb
|
178
|
-
- spec/rails_root/config/locales/en.yml
|
179
|
-
- spec/rails_root/config/routes.rb
|
180
|
-
- spec/rails_root/db/migrate/001_create_users.rb
|
181
|
-
- spec/rails_root/db/migrate/002_create_posts.rb
|
182
|
-
- spec/rails_root/db/migrate/003_create_taggings.rb
|
183
|
-
- spec/rails_root/db/migrate/004_create_tags.rb
|
184
|
-
- spec/rails_root/db/migrate/005_create_dogs.rb
|
185
|
-
- spec/rails_root/db/migrate/006_create_addresses.rb
|
186
|
-
- spec/rails_root/db/migrate/007_create_fleas.rb
|
187
|
-
- spec/rails_root/db/migrate/008_create_dogs_fleas.rb
|
188
|
-
- spec/rails_root/db/migrate/009_create_products.rb
|
189
|
-
- spec/rails_root/db/migrate/010_create_friendships.rb
|
190
|
-
- spec/rails_root/db/migrate/011_add_fleas_color.rb
|
191
|
-
- spec/rails_root/db/migrate/012_add_fleas_address.rb
|
192
|
-
- spec/rails_root/db/schema.rb
|
193
|
-
- spec/rails_root/log/.keep
|
194
|
-
- spec/rails_root/log/test.log
|
195
|
-
- spec/rails_root/public/.htaccess
|
196
|
-
- spec/rails_root/public/404.html
|
197
|
-
- spec/rails_root/public/422.html
|
198
|
-
- spec/rails_root/public/500.html
|
199
|
-
- spec/rails_root/script/console
|
200
|
-
- spec/rails_root/script/generate
|
201
|
-
- spec/rails_root/spec/remarkable_macros/.keep
|
202
|
-
- spec/rails_root/vendor/plugins/.keep
|
203
|
-
- spec/rails_root/vendor/plugins/my_plugin/remarkable_macros/.keep
|
204
|
-
- spec/rcov.opts
|
205
|
-
- spec/spec.opts
|
206
|
-
- spec/spec_helper.rb
|
207
126
|
- tasks/rspec.rake
|
208
127
|
has_rdoc: true
|
209
|
-
homepage:
|
128
|
+
homepage: http://www.nomedojogo.com/2008/11/18/shoulda-for-rspec-is-remarkable/
|
210
129
|
post_install_message: PostInstall.txt
|
211
130
|
rdoc_options:
|
212
131
|
- --main
|
@@ -1,220 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe PostsController do
|
4
|
-
fixtures :all
|
5
|
-
|
6
|
-
integrate_views
|
7
|
-
|
8
|
-
# autodetects the :controller
|
9
|
-
should_route :get, '/posts', :controller => :posts, :action => :index
|
10
|
-
should_not_route :get, '/posts', :controller => :posts, :action => :show
|
11
|
-
# explicitly specify :controller
|
12
|
-
should_route :post, '/posts', :controller => :posts, :action => :create
|
13
|
-
# non-string parameter
|
14
|
-
should_route :get, '/posts/1', :controller => :posts, :action => :show, :id => 1
|
15
|
-
# string-parameter
|
16
|
-
should_route :put, '/posts/1', :controller => :posts, :action => :update, :id => "1"
|
17
|
-
should_route :delete, '/posts/1', :controller => :posts, :action => :destroy, :id => 1
|
18
|
-
should_route :get, '/posts/new', :controller => :posts, :action => :new
|
19
|
-
|
20
|
-
# Test the nested routes
|
21
|
-
should_route :get, '/users/5/posts', :controller => :posts, :action => :index, :user_id => 5
|
22
|
-
should_route :post, '/users/5/posts', :controller => :posts, :action => :create, :user_id => 5
|
23
|
-
should_route :get, '/users/5/posts/1', :controller => :posts, :action => :show, :id => 1, :user_id => 5
|
24
|
-
should_route :delete, '/users/5/posts/1', :controller => :posts, :action => :destroy, :id => 1, :user_id => 5
|
25
|
-
should_route :get, '/users/5/posts/new', :controller => :posts, :action => :new, :user_id => 5
|
26
|
-
should_route :put, '/users/5/posts/1', :controller => :posts, :action => :update, :id => 1, :user_id => 5
|
27
|
-
|
28
|
-
describe "Logged in" do
|
29
|
-
before do
|
30
|
-
request.session[:logged_in] = true
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "viewing posts for a user" do
|
34
|
-
before do
|
35
|
-
get :index, :user_id => users(:first)
|
36
|
-
end
|
37
|
-
should_respond_with 200
|
38
|
-
should_assign_to :user, :class => User, :equals => 'users(:first)'
|
39
|
-
should_not_assign_to :user, :class => User, :equals => 'users(:second)'
|
40
|
-
|
41
|
-
should_not_assign_to :user, :class => Post
|
42
|
-
should_not_assign_to :user, :equals => 'posts(:first)'
|
43
|
-
it { lambda { should_assign_to(:user, :class => Post) }.should raise_error }
|
44
|
-
it { lambda { should_assign_to(:user, :equals => 'posts(:first)') }.should raise_error }
|
45
|
-
|
46
|
-
should_assign_to :posts
|
47
|
-
should_not_assign_to :foo, :bar
|
48
|
-
|
49
|
-
# should_render_page_with_metadata :title => /index/
|
50
|
-
# should_render_page_with_metadata :description => /Posts/, :title => /index/
|
51
|
-
# should_render_page_with_metadata :keywords => "posts"
|
52
|
-
# should_not_render_page_with_metadata :description => "user"
|
53
|
-
# should_not_render_page_with_metadata :foo => "bar"
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "on POST to :create" do
|
57
|
-
before do
|
58
|
-
post :create, :post => { :title => "Title", :body => "Body" }, :user_id => users(:first)
|
59
|
-
@post = Post.last
|
60
|
-
end
|
61
|
-
should_respond_with :redirect
|
62
|
-
should_respond_with 302
|
63
|
-
should_not_respond_with :success
|
64
|
-
|
65
|
-
should_redirect_to "user_post_url(@post.user, @post)"
|
66
|
-
should_not_redirect_to "user_url(@post.user)"
|
67
|
-
should_set_the_flash_to /created/i
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "viewing posts for a user with rss format" do
|
71
|
-
before do
|
72
|
-
get :index, :user_id => users(:first), :format => 'rss'
|
73
|
-
@user = users(:first)
|
74
|
-
end
|
75
|
-
should_respond_with :success
|
76
|
-
should_respond_with_content_type 'application/rss+xml'
|
77
|
-
should_respond_with_content_type :rss
|
78
|
-
should_respond_with_content_type /rss/
|
79
|
-
|
80
|
-
should_return_from_session :special, "'$2 off your next purchase'"
|
81
|
-
should_return_from_session :special_user_id, '@user.id'
|
82
|
-
should_not_return_from_session(:monkey, "'fat'")
|
83
|
-
|
84
|
-
should_assign_to :user, :posts
|
85
|
-
should_not_assign_to :foo, :bar
|
86
|
-
end
|
87
|
-
|
88
|
-
describe "viewing a post on GET to #show" do
|
89
|
-
before { get :show, :user_id => users(:first), :id => posts(:first) }
|
90
|
-
|
91
|
-
should_render_with_layout 'wide'
|
92
|
-
should_render_with_layout :wide
|
93
|
-
should_not_render_with_layout 'other'
|
94
|
-
|
95
|
-
should_assign_to :false_flag
|
96
|
-
|
97
|
-
should_not_respond_with_content_type :rss
|
98
|
-
|
99
|
-
should_render_template :show
|
100
|
-
should_not_render_template :new
|
101
|
-
end
|
102
|
-
|
103
|
-
describe "on GET to #new" do
|
104
|
-
before { get :new, :user_id => users(:first) }
|
105
|
-
should_render_without_layout
|
106
|
-
should_not_set_the_flash
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
describe PostsController do
|
113
|
-
fixtures :all
|
114
|
-
|
115
|
-
integrate_views
|
116
|
-
|
117
|
-
# autodetects the :controller
|
118
|
-
it { should route(:get, '/posts', :action => :index) }
|
119
|
-
it { should_not route(:get, '/posts', :action => :show) }
|
120
|
-
# explicitly specify :controller
|
121
|
-
it { should route(:post, '/posts', :controller => :posts, :action => :create) }
|
122
|
-
# # non-string parameter
|
123
|
-
it { should route(:get, '/posts/1', :action => :show, :id => 1) }
|
124
|
-
# # string-parameter
|
125
|
-
it { should route(:put, '/posts/1', :action => :update, :id => "1") }
|
126
|
-
it { should route(:delete, '/posts/1', :action => :destroy, :id => 1) }
|
127
|
-
it { should route(:get, '/posts/new', :action => :new) }
|
128
|
-
|
129
|
-
# # Test the nested routes
|
130
|
-
it { should route(:get, '/users/5/posts', :action => :index, :user_id => 5) }
|
131
|
-
it { should route(:post, '/users/5/posts', :action => :create, :user_id => 5) }
|
132
|
-
it { should route(:get, '/users/5/posts/1', :action => :show, :id => 1, :user_id => 5) }
|
133
|
-
it { should route(:delete, '/users/5/posts/1', :action => :destroy, :id => 1, :user_id => 5) }
|
134
|
-
it { should route(:get, '/users/5/posts/new', :action => :new, :user_id => 5) }
|
135
|
-
it { should route(:put, '/users/5/posts/1', :action => :update, :id => 1, :user_id => 5) }
|
136
|
-
|
137
|
-
describe "Logged in" do
|
138
|
-
before do
|
139
|
-
request.session[:logged_in] = true
|
140
|
-
end
|
141
|
-
|
142
|
-
describe "viewing posts for a user" do
|
143
|
-
before do
|
144
|
-
get :index, :user_id => users(:first)
|
145
|
-
end
|
146
|
-
it { should respond_with(200) }
|
147
|
-
|
148
|
-
it { should assign_to(:some_text) }
|
149
|
-
it { should assign_to(:some_text, :equals => "foo bar") }
|
150
|
-
it { should_not assign_to(:some_text, :equals => "foo without bar") }
|
151
|
-
it { should assign_to(:user, :class => User, :equals => 'users(:first)') }
|
152
|
-
it { should assign_to(:user, :class => User, :equals => users(:first)) }
|
153
|
-
it { should_not assign_to(:user, :class => User, :equals => 'users(:second)') }
|
154
|
-
it { should_not assign_to(:user, :class => User, :equals => users(:second)) }
|
155
|
-
it { should_not assign_to(:user, :class => Post) }
|
156
|
-
it { should_not assign_to(:user, :equals => 'posts(:first)') }
|
157
|
-
it { should assign_to(:posts) }
|
158
|
-
it { should_not assign_to(:foo, :bar) }
|
159
|
-
|
160
|
-
# it { should render_page_with_metadata(:title => /index/) }
|
161
|
-
# it { should render_page_with_metadata(:description => /Posts/, :title => /index/) }
|
162
|
-
# it { should render_page_with_metadata(:keywords => "posts") }
|
163
|
-
# it { should_not render_page_with_metadata(:description => "user") }
|
164
|
-
# it { should_not render_page_with_metadata(:foo => "bar") }
|
165
|
-
end
|
166
|
-
|
167
|
-
describe "on POST to :create" do
|
168
|
-
before(:each) do
|
169
|
-
post :create, :post => { :title => "Title", :body => "Body" }, :user_id => users(:first)
|
170
|
-
@post = Post.last
|
171
|
-
end
|
172
|
-
it { should respond_with(:redirect) }
|
173
|
-
it { should respond_with(302) }
|
174
|
-
it { should_not respond_with(:success) }
|
175
|
-
|
176
|
-
it { should redirect_to(user_post_url(@post.user, @post)) }
|
177
|
-
it { should_not redirect_to(user_url(@post.user)) }
|
178
|
-
it { should set_the_flash_to(/created/i) }
|
179
|
-
it { should_not set_the_flash_to(/foo/i) }
|
180
|
-
end
|
181
|
-
|
182
|
-
describe "viewing posts for a user with rss format" do
|
183
|
-
before do
|
184
|
-
get :index, :user_id => users(:first), :format => 'rss'
|
185
|
-
@user = users(:first)
|
186
|
-
end
|
187
|
-
it { should respond_with(:success) }
|
188
|
-
it { should respond_with_content_type('application/rss+xml') }
|
189
|
-
it { should respond_with_content_type(:rss) }
|
190
|
-
it { should respond_with_content_type(/rss/) }
|
191
|
-
it { should return_from_session(:special, "'$2 off your next purchase'") }
|
192
|
-
it { should return_from_session(:special_user_id, '@user.id') }
|
193
|
-
it { should_not return_from_session(:monkey, "'fat'") }
|
194
|
-
it { should assign_to(:user, :posts) }
|
195
|
-
it { should_not assign_to(:foo, :bar) }
|
196
|
-
end
|
197
|
-
|
198
|
-
describe "viewing a post on GET to #show" do
|
199
|
-
before { get :show, :user_id => users(:first), :id => posts(:first) }
|
200
|
-
|
201
|
-
it { should render_with_layout('wide') }
|
202
|
-
it { should render_with_layout(:wide) }
|
203
|
-
it { should_not render_with_layout('other') }
|
204
|
-
|
205
|
-
it { should assign_to(:false_flag) }
|
206
|
-
|
207
|
-
it { should_not respond_with_content_type(:rss) }
|
208
|
-
|
209
|
-
it { should render_template(:show) }
|
210
|
-
it { should_not render_template(:new) }
|
211
|
-
end
|
212
|
-
|
213
|
-
describe "on GET to #new" do
|
214
|
-
before { get :new, :user_id => users(:first) }
|
215
|
-
it { should render_without_layout }
|
216
|
-
it { should_not set_the_flash }
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|