aguids-publishable 0.1.0

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 (57) hide show
  1. data/.document +5 -0
  2. data/.gitignore +7 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +7 -0
  5. data/Rakefile +57 -0
  6. data/VERSION +1 -0
  7. data/init.rb +1 -0
  8. data/lib/publishable.rb +25 -0
  9. data/test/rails_root/Rakefile +10 -0
  10. data/test/rails_root/app/controllers/application_controller.rb +10 -0
  11. data/test/rails_root/app/helpers/application_helper.rb +3 -0
  12. data/test/rails_root/app/models/post.rb +5 -0
  13. data/test/rails_root/app/models/published_post.rb +3 -0
  14. data/test/rails_root/config/boot.rb +110 -0
  15. data/test/rails_root/config/database.yml +22 -0
  16. data/test/rails_root/config/environment.rb +20 -0
  17. data/test/rails_root/config/environments/development.rb +17 -0
  18. data/test/rails_root/config/environments/production.rb +28 -0
  19. data/test/rails_root/config/environments/test.rb +28 -0
  20. data/test/rails_root/config/initializers/backtrace_silencers.rb +7 -0
  21. data/test/rails_root/config/initializers/inflections.rb +10 -0
  22. data/test/rails_root/config/initializers/mime_types.rb +5 -0
  23. data/test/rails_root/config/initializers/new_rails_defaults.rb +19 -0
  24. data/test/rails_root/config/initializers/session_store.rb +15 -0
  25. data/test/rails_root/config/locales/en.yml +5 -0
  26. data/test/rails_root/config/routes.rb +43 -0
  27. data/test/rails_root/db/development.sqlite3 +0 -0
  28. data/test/rails_root/db/migrate/20090731062231_create_posts.rb +15 -0
  29. data/test/rails_root/db/migrate/20090731073912_create_published_posts.rb +13 -0
  30. data/test/rails_root/db/schema.rb +28 -0
  31. data/test/rails_root/public/404.html +30 -0
  32. data/test/rails_root/public/422.html +30 -0
  33. data/test/rails_root/public/500.html +30 -0
  34. data/test/rails_root/public/favicon.ico +0 -0
  35. data/test/rails_root/public/images/rails.png +0 -0
  36. data/test/rails_root/public/index.html +275 -0
  37. data/test/rails_root/public/javascripts/application.js +2 -0
  38. data/test/rails_root/public/javascripts/controls.js +963 -0
  39. data/test/rails_root/public/javascripts/dragdrop.js +973 -0
  40. data/test/rails_root/public/javascripts/effects.js +1128 -0
  41. data/test/rails_root/public/javascripts/prototype.js +4320 -0
  42. data/test/rails_root/public/robots.txt +5 -0
  43. data/test/rails_root/script/about +4 -0
  44. data/test/rails_root/script/console +3 -0
  45. data/test/rails_root/script/dbconsole +3 -0
  46. data/test/rails_root/script/destroy +3 -0
  47. data/test/rails_root/script/generate +3 -0
  48. data/test/rails_root/script/performance/benchmarker +3 -0
  49. data/test/rails_root/script/performance/profiler +3 -0
  50. data/test/rails_root/script/plugin +3 -0
  51. data/test/rails_root/script/runner +3 -0
  52. data/test/rails_root/script/server +3 -0
  53. data/test/rails_root/test/performance/browsing_test.rb +9 -0
  54. data/test/rails_root/test/test_helper.rb +38 -0
  55. data/test/rails_root/test/unit/post_test.rb +49 -0
  56. data/test/rails_root/test/unit/published_post_test.rb +16 -0
  57. metadata +140 -0
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/dbconsole'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'performance_test_help'
3
+
4
+ # Profiling results for each test method are written to tmp/performance.
5
+ class BrowsingTest < ActionController::PerformanceTest
6
+ def test_homepage
7
+ get '/'
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require 'test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Transactional fixtures accelerate your tests by wrapping each test method
7
+ # in a transaction that's rolled back on completion. This ensures that the
8
+ # test database remains unchanged so your fixtures don't have to be reloaded
9
+ # between every test method. Fewer database queries means faster tests.
10
+ #
11
+ # Read Mike Clark's excellent walkthrough at
12
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
+ #
14
+ # Every Active Record database supports transactions except MyISAM tables
15
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
16
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
17
+ # is recommended.
18
+ #
19
+ # The only drawback to using transactional fixtures is when you actually
20
+ # need to test transactions. Since your test is bracketed by a transaction,
21
+ # any transactions started in your code will be automatically rolled back.
22
+ self.use_transactional_fixtures = true
23
+
24
+ # Instantiated fixtures are slow, but give you @david where otherwise you
25
+ # would need people(:david). If you don't want to migrate your existing
26
+ # test cases which use the @david style and don't mind the speed hit (each
27
+ # instantiated fixtures translates to a database query per test method),
28
+ # then set this back to true.
29
+ self.use_instantiated_fixtures = false
30
+
31
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
+ #
33
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
+ # -- they do not yet inherit this setting
35
+ fixtures :all
36
+
37
+ # Add more helper methods to be used by all tests here...
38
+ end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ def setup
5
+ @post = create_post
6
+ end
7
+
8
+ test "should start unpublished" do
9
+ assert @post.unpublished?
10
+ assert !@post.published?
11
+ end
12
+
13
+ test "should publish" do
14
+ @post.publish
15
+ assert @post.published?
16
+ assert !@post.unpublished?
17
+ end
18
+
19
+ test "should unpublish" do
20
+ @post.publish
21
+ @post.unpublish
22
+ assert @post.unpublished?
23
+ end
24
+
25
+ test "should define published scope" do
26
+ @published = create_post(:title => 'Title')
27
+ @published.publish!
28
+ @unpublished = create_post
29
+ assert Post.published.include?(@published)
30
+ assert !Post.published.include?(@unpublished)
31
+ end
32
+
33
+ test "should define the unpublished scope" do
34
+ @published = create_post(:title => 'Title')
35
+ @published.publish!
36
+ @unpublished = create_post
37
+ assert Post.unpublished.include?(@unpublished)
38
+ assert !Post.unpublished.include?(@published)
39
+ end
40
+
41
+ test "should require name before publishing" do
42
+ @post.publish
43
+ assert !@post.valid?
44
+ end
45
+
46
+ def create_post(options = {})
47
+ Post.create(options)
48
+ end
49
+ end
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+
3
+ class PublishedPostTest < ActiveSupport::TestCase
4
+ def setup
5
+ @post = create_post
6
+ end
7
+
8
+ test "should start published" do
9
+ assert @post.published?
10
+ assert !@post.unpublished?
11
+ end
12
+
13
+ def create_post
14
+ PublishedPost.create
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aguids-publishable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Felipe Doria
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-31 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubyist-aasm
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.3.4
24
+ version:
25
+ description:
26
+ email: felipe.doria@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Rakefile
40
+ - VERSION
41
+ - init.rb
42
+ - lib/publishable.rb
43
+ - test/rails_root/Rakefile
44
+ - test/rails_root/app/controllers/application_controller.rb
45
+ - test/rails_root/app/helpers/application_helper.rb
46
+ - test/rails_root/app/models/post.rb
47
+ - test/rails_root/app/models/published_post.rb
48
+ - test/rails_root/config/boot.rb
49
+ - test/rails_root/config/database.yml
50
+ - test/rails_root/config/environment.rb
51
+ - test/rails_root/config/environments/development.rb
52
+ - test/rails_root/config/environments/production.rb
53
+ - test/rails_root/config/environments/test.rb
54
+ - test/rails_root/config/initializers/backtrace_silencers.rb
55
+ - test/rails_root/config/initializers/inflections.rb
56
+ - test/rails_root/config/initializers/mime_types.rb
57
+ - test/rails_root/config/initializers/new_rails_defaults.rb
58
+ - test/rails_root/config/initializers/session_store.rb
59
+ - test/rails_root/config/locales/en.yml
60
+ - test/rails_root/config/routes.rb
61
+ - test/rails_root/db/development.sqlite3
62
+ - test/rails_root/db/migrate/20090731062231_create_posts.rb
63
+ - test/rails_root/db/migrate/20090731073912_create_published_posts.rb
64
+ - test/rails_root/db/schema.rb
65
+ - test/rails_root/public/404.html
66
+ - test/rails_root/public/422.html
67
+ - test/rails_root/public/500.html
68
+ - test/rails_root/public/favicon.ico
69
+ - test/rails_root/public/images/rails.png
70
+ - test/rails_root/public/index.html
71
+ - test/rails_root/public/javascripts/application.js
72
+ - test/rails_root/public/javascripts/controls.js
73
+ - test/rails_root/public/javascripts/dragdrop.js
74
+ - test/rails_root/public/javascripts/effects.js
75
+ - test/rails_root/public/javascripts/prototype.js
76
+ - test/rails_root/public/robots.txt
77
+ - test/rails_root/script/about
78
+ - test/rails_root/script/console
79
+ - test/rails_root/script/dbconsole
80
+ - test/rails_root/script/destroy
81
+ - test/rails_root/script/generate
82
+ - test/rails_root/script/performance/benchmarker
83
+ - test/rails_root/script/performance/profiler
84
+ - test/rails_root/script/plugin
85
+ - test/rails_root/script/runner
86
+ - test/rails_root/script/server
87
+ - test/rails_root/test/performance/browsing_test.rb
88
+ - test/rails_root/test/test_helper.rb
89
+ - test/rails_root/test/unit/post_test.rb
90
+ - test/rails_root/test/unit/published_post_test.rb
91
+ has_rdoc: false
92
+ homepage: http://github.com/aguids/publishable
93
+ licenses:
94
+ post_install_message:
95
+ rdoc_options:
96
+ - --charset=UTF-8
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
104
+ version:
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: "0"
110
+ version:
111
+ requirements: []
112
+
113
+ rubyforge_project:
114
+ rubygems_version: 1.3.5
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: Rails engine for publishing behavior. Depends on AASM.
118
+ test_files:
119
+ - test/rails_root/app/controllers/application_controller.rb
120
+ - test/rails_root/app/helpers/application_helper.rb
121
+ - test/rails_root/app/models/post.rb
122
+ - test/rails_root/app/models/published_post.rb
123
+ - test/rails_root/config/boot.rb
124
+ - test/rails_root/config/environment.rb
125
+ - test/rails_root/config/environments/development.rb
126
+ - test/rails_root/config/environments/production.rb
127
+ - test/rails_root/config/environments/test.rb
128
+ - test/rails_root/config/initializers/backtrace_silencers.rb
129
+ - test/rails_root/config/initializers/inflections.rb
130
+ - test/rails_root/config/initializers/mime_types.rb
131
+ - test/rails_root/config/initializers/new_rails_defaults.rb
132
+ - test/rails_root/config/initializers/session_store.rb
133
+ - test/rails_root/config/routes.rb
134
+ - test/rails_root/db/migrate/20090731062231_create_posts.rb
135
+ - test/rails_root/db/migrate/20090731073912_create_published_posts.rb
136
+ - test/rails_root/db/schema.rb
137
+ - test/rails_root/test/performance/browsing_test.rb
138
+ - test/rails_root/test/test_helper.rb
139
+ - test/rails_root/test/unit/post_test.rb
140
+ - test/rails_root/test/unit/published_post_test.rb