spray_paint 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/Rakefile +40 -0
  3. data/app/models/spray_paint/tag.rb +19 -0
  4. data/app/models/spray_paint/tagging.rb +6 -0
  5. data/db/development.sqlite3 +0 -0
  6. data/db/migrate/20120327123848_create_tags.rb +23 -0
  7. data/lib/spray_paint.rb +63 -0
  8. data/lib/spray_paint/engine.rb +5 -0
  9. data/lib/spray_paint/version.rb +3 -0
  10. data/readme.md +48 -0
  11. data/test/dummy/README.rdoc +261 -0
  12. data/test/dummy/Rakefile +7 -0
  13. data/test/dummy/app/assets/javascripts/application.js +13 -0
  14. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/test/dummy/app/controllers/application_controller.rb +3 -0
  16. data/test/dummy/app/helpers/application_helper.rb +2 -0
  17. data/test/dummy/app/models/post.rb +5 -0
  18. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  19. data/test/dummy/config.ru +4 -0
  20. data/test/dummy/config/application.rb +62 -0
  21. data/test/dummy/config/boot.rb +10 -0
  22. data/test/dummy/config/database.yml +25 -0
  23. data/test/dummy/config/environment.rb +5 -0
  24. data/test/dummy/config/environments/development.rb +37 -0
  25. data/test/dummy/config/environments/production.rb +67 -0
  26. data/test/dummy/config/environments/test.rb +37 -0
  27. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  28. data/test/dummy/config/initializers/inflections.rb +15 -0
  29. data/test/dummy/config/initializers/mime_types.rb +5 -0
  30. data/test/dummy/config/initializers/secret_token.rb +7 -0
  31. data/test/dummy/config/initializers/session_store.rb +8 -0
  32. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  33. data/test/dummy/config/locales/en.yml +5 -0
  34. data/test/dummy/config/routes.rb +4 -0
  35. data/test/dummy/db/development.sqlite3 +0 -0
  36. data/test/dummy/db/migrate/20120327123850_create_posts.rb +12 -0
  37. data/test/dummy/db/schema.rb +38 -0
  38. data/test/dummy/db/test.sqlite3 +0 -0
  39. data/test/dummy/log/development.log +297 -0
  40. data/test/dummy/log/test.log +11863 -0
  41. data/test/dummy/public/404.html +26 -0
  42. data/test/dummy/public/422.html +26 -0
  43. data/test/dummy/public/500.html +25 -0
  44. data/test/dummy/public/favicon.ico +0 -0
  45. data/test/dummy/script/rails +6 -0
  46. data/test/integration/spray_paint/scope_test.rb +51 -0
  47. data/test/integration/spray_paint/tagging_test.rb +75 -0
  48. data/test/spray_paint.rb +7 -0
  49. data/test/test_helper.rb +13 -0
  50. data/test/unit/spray_paint/tag_test.rb +11 -0
  51. data/test/unit/spray_paint/tagging_test.rb +9 -0
  52. metadata +176 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ class ScopeTest < ActionDispatch::IntegrationTest
4
+ def test_doesnt_match_anything
5
+ post = Post.new :name => 'Test'
6
+ post.tags = %w(melodic progressive)
7
+ post.save!
8
+
9
+ assert_empty Post.tagged('uplift')
10
+ end
11
+
12
+ def test_finds_by_one_tag
13
+ post = Post.new :name => 'Test'
14
+ post.tags = %w(melodic progressive)
15
+ post.save!
16
+
17
+ assert_not_empty Post.tagged('melodic')
18
+ end
19
+
20
+ def test_scope_acts_like_a_set
21
+ melodic = Post.new :name => 'melodic'
22
+ melodic.tags = %w(melodic progressive)
23
+ melodic.save!
24
+
25
+ uplift = Post.new :name => 'uplift'
26
+ uplift.tags = %w(progressive uplift)
27
+ uplift.save!
28
+
29
+ assert_includes Post.tagged('melodic', 'progressive'), melodic
30
+ assert_not_includes Post.tagged('melodic', 'progressive'), uplift
31
+
32
+ assert_includes Post.tagged('uplift', 'progressive'), uplift
33
+ assert_not_includes Post.tagged('uplift', 'progressive'), melodic
34
+ end
35
+
36
+ def test_scope_is_not_case_sensitive
37
+ uplift = Post.new :name => 'uplift'
38
+ uplift.tags = %w(progressive uplift)
39
+ uplift.save!
40
+
41
+ assert_includes Post.tagged('UPLIFT', 'proGresSive'), uplift
42
+ end
43
+
44
+ def test_scope_with_count_returns_a_number
45
+ 5.times do |i|
46
+ Post.create! :name => "Post #{i}", :tags => %w(melodic progressive)
47
+ end
48
+
49
+ assert_equal 5, Post.tagged('melodic', 'progressive').count
50
+ end
51
+ end
@@ -0,0 +1,75 @@
1
+ require 'test_helper'
2
+
3
+ class TaggingTest < ActionDispatch::IntegrationTest
4
+ def test_can_add_tags
5
+ post = Post.create! :name => 'Test'
6
+
7
+ post.tags << 'epic'
8
+ post.save!
9
+
10
+ assert_equal %w(epic), post.tags
11
+ end
12
+
13
+ def test_can_add_tags_as_an_array
14
+ post = Post.create! :name => 'Test'
15
+
16
+ post.tags << %w(epic legit)
17
+ post.save!
18
+
19
+ assert_equal %w(epic legit), post.tags
20
+ end
21
+
22
+ def test_can_assign_tags_with_an_array
23
+ post = Post.create! :name => 'Test'
24
+
25
+ post.tags = %w(epic legit)
26
+ post.save!
27
+
28
+ assert_equal %w(epic legit), post.tags
29
+ end
30
+
31
+ def test_can_assign_tags_with_a_string
32
+ post = Post.create! :name => 'Test'
33
+
34
+ post.tags = 'epic'
35
+ post.save!
36
+
37
+ assert_equal %w(epic), post.tags
38
+ end
39
+
40
+ def test_handles_new_records
41
+ post = Post.new :name => 'Test'
42
+
43
+ post.tags = 'epic'
44
+ post.save!
45
+
46
+ assert_equal %w(epic), post.tags
47
+ end
48
+
49
+ def test_tag_names_are_not_case_senstive
50
+ post = Post.create :name => 'Test'
51
+
52
+ post.tags = %W(epic EPIC EpIc)
53
+ post.save!
54
+
55
+ assert_equal %w(epic), post.tags
56
+ end
57
+
58
+ def test_tag_names_are_not_case_senstive_for_new_objects
59
+ post = Post.new :name => 'Test'
60
+
61
+ post.tags = %W(epic EPIC EpIc)
62
+ post.save!
63
+
64
+ assert_equal %w(epic), post.tags
65
+ end
66
+
67
+ def test_association_looks_like_an_array
68
+ post = Post.create :name => 'Test'
69
+
70
+ post.tags = %W(epic EPIC EpIc)
71
+ post.save!
72
+
73
+ assert_equal post.tags.names.inspect, post.tags.inspect
74
+ end
75
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class SprayPaintTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, SprayPaint
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ require 'simplecov'
2
+ SimpleCov.start 'rails'
3
+
4
+ # Configure Rails Environment
5
+ ENV["RAILS_ENV"] = "test"
6
+
7
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
+ require "rails/test_help"
9
+
10
+ Rails.backtrace_cleaner.remove_silencers!
11
+
12
+ # Load support files
13
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ module SprayPaint
4
+ class TagTest < ActiveSupport::TestCase
5
+ def test_name_is_converted_to_lower_case
6
+ tag = Tag.create! :name => 'UPLIFT'
7
+
8
+ assert_equal 'uplift', tag.name
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module SprayPaint
4
+ class TaggingTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spray_paint
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam Hawkins
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70196827824940 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70196827824940
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3
27
+ requirement: &70196827824520 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70196827824520
36
+ - !ruby/object:Gem::Dependency
37
+ name: simplecov
38
+ requirement: &70196827824060 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70196827824060
47
+ description:
48
+ email:
49
+ - me@broadcastingadam.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - app/models/spray_paint/tag.rb
55
+ - app/models/spray_paint/tagging.rb
56
+ - db/development.sqlite3
57
+ - db/migrate/20120327123848_create_tags.rb
58
+ - lib/spray_paint/engine.rb
59
+ - lib/spray_paint/version.rb
60
+ - lib/spray_paint.rb
61
+ - MIT-LICENSE
62
+ - Rakefile
63
+ - readme.md
64
+ - test/dummy/app/assets/javascripts/application.js
65
+ - test/dummy/app/assets/stylesheets/application.css
66
+ - test/dummy/app/controllers/application_controller.rb
67
+ - test/dummy/app/helpers/application_helper.rb
68
+ - test/dummy/app/models/post.rb
69
+ - test/dummy/app/views/layouts/application.html.erb
70
+ - test/dummy/config/application.rb
71
+ - test/dummy/config/boot.rb
72
+ - test/dummy/config/database.yml
73
+ - test/dummy/config/environment.rb
74
+ - test/dummy/config/environments/development.rb
75
+ - test/dummy/config/environments/production.rb
76
+ - test/dummy/config/environments/test.rb
77
+ - test/dummy/config/initializers/backtrace_silencers.rb
78
+ - test/dummy/config/initializers/inflections.rb
79
+ - test/dummy/config/initializers/mime_types.rb
80
+ - test/dummy/config/initializers/secret_token.rb
81
+ - test/dummy/config/initializers/session_store.rb
82
+ - test/dummy/config/initializers/wrap_parameters.rb
83
+ - test/dummy/config/locales/en.yml
84
+ - test/dummy/config/routes.rb
85
+ - test/dummy/config.ru
86
+ - test/dummy/db/development.sqlite3
87
+ - test/dummy/db/migrate/20120327123850_create_posts.rb
88
+ - test/dummy/db/schema.rb
89
+ - test/dummy/db/test.sqlite3
90
+ - test/dummy/log/development.log
91
+ - test/dummy/log/test.log
92
+ - test/dummy/public/404.html
93
+ - test/dummy/public/422.html
94
+ - test/dummy/public/500.html
95
+ - test/dummy/public/favicon.ico
96
+ - test/dummy/Rakefile
97
+ - test/dummy/README.rdoc
98
+ - test/dummy/script/rails
99
+ - test/integration/spray_paint/scope_test.rb
100
+ - test/integration/spray_paint/tagging_test.rb
101
+ - test/spray_paint.rb
102
+ - test/test_helper.rb
103
+ - test/unit/spray_paint/tag_test.rb
104
+ - test/unit/spray_paint/tagging_test.rb
105
+ homepage: https://github.com/threadedlabs/spray_paint
106
+ licenses: []
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ segments:
118
+ - 0
119
+ hash: -1909329483239619361
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
127
+ - 0
128
+ hash: -1909329483239619361
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 1.8.11
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Simplest possible tagging for ActiveRecord
135
+ test_files:
136
+ - test/dummy/app/assets/javascripts/application.js
137
+ - test/dummy/app/assets/stylesheets/application.css
138
+ - test/dummy/app/controllers/application_controller.rb
139
+ - test/dummy/app/helpers/application_helper.rb
140
+ - test/dummy/app/models/post.rb
141
+ - test/dummy/app/views/layouts/application.html.erb
142
+ - test/dummy/config/application.rb
143
+ - test/dummy/config/boot.rb
144
+ - test/dummy/config/database.yml
145
+ - test/dummy/config/environment.rb
146
+ - test/dummy/config/environments/development.rb
147
+ - test/dummy/config/environments/production.rb
148
+ - test/dummy/config/environments/test.rb
149
+ - test/dummy/config/initializers/backtrace_silencers.rb
150
+ - test/dummy/config/initializers/inflections.rb
151
+ - test/dummy/config/initializers/mime_types.rb
152
+ - test/dummy/config/initializers/secret_token.rb
153
+ - test/dummy/config/initializers/session_store.rb
154
+ - test/dummy/config/initializers/wrap_parameters.rb
155
+ - test/dummy/config/locales/en.yml
156
+ - test/dummy/config/routes.rb
157
+ - test/dummy/config.ru
158
+ - test/dummy/db/development.sqlite3
159
+ - test/dummy/db/migrate/20120327123850_create_posts.rb
160
+ - test/dummy/db/schema.rb
161
+ - test/dummy/db/test.sqlite3
162
+ - test/dummy/log/development.log
163
+ - test/dummy/log/test.log
164
+ - test/dummy/public/404.html
165
+ - test/dummy/public/422.html
166
+ - test/dummy/public/500.html
167
+ - test/dummy/public/favicon.ico
168
+ - test/dummy/Rakefile
169
+ - test/dummy/README.rdoc
170
+ - test/dummy/script/rails
171
+ - test/integration/spray_paint/scope_test.rb
172
+ - test/integration/spray_paint/tagging_test.rb
173
+ - test/spray_paint.rb
174
+ - test/test_helper.rb
175
+ - test/unit/spray_paint/tag_test.rb
176
+ - test/unit/spray_paint/tagging_test.rb