rhode_island 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 (56) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +31 -0
  5. data/Rakefile +7 -0
  6. data/lib/rhode_island.rb +5 -0
  7. data/lib/rhode_island/active_record_extensions.rb +48 -0
  8. data/lib/rhode_island/railtie.rb +0 -0
  9. data/lib/rhode_island/version.rb +3 -0
  10. data/rhode_island.gemspec +23 -0
  11. data/spec/dummy/.rspec +1 -0
  12. data/spec/dummy/README.rdoc +261 -0
  13. data/spec/dummy/Rakefile +7 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  17. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  18. data/spec/dummy/app/mailers/.gitkeep +0 -0
  19. data/spec/dummy/app/models/.gitkeep +0 -0
  20. data/spec/dummy/app/models/post.rb +11 -0
  21. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/spec/dummy/config.ru +4 -0
  23. data/spec/dummy/config/application.rb +59 -0
  24. data/spec/dummy/config/boot.rb +10 -0
  25. data/spec/dummy/config/database.yml +25 -0
  26. data/spec/dummy/config/environment.rb +5 -0
  27. data/spec/dummy/config/environments/development.rb +37 -0
  28. data/spec/dummy/config/environments/production.rb +67 -0
  29. data/spec/dummy/config/environments/test.rb +37 -0
  30. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/spec/dummy/config/initializers/inflections.rb +15 -0
  32. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  33. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  34. data/spec/dummy/config/initializers/session_store.rb +8 -0
  35. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  36. data/spec/dummy/config/locales/en.yml +5 -0
  37. data/spec/dummy/config/routes.rb +58 -0
  38. data/spec/dummy/db/development.sqlite3 +0 -0
  39. data/spec/dummy/db/migrate/20130331035511_create_posts.rb +8 -0
  40. data/spec/dummy/db/schema.rb +22 -0
  41. data/spec/dummy/db/test.sqlite3 +0 -0
  42. data/spec/dummy/lib/assets/.gitkeep +0 -0
  43. data/spec/dummy/log/.gitkeep +0 -0
  44. data/spec/dummy/log/development.log +53 -0
  45. data/spec/dummy/log/test.log +324 -0
  46. data/spec/dummy/public/404.html +26 -0
  47. data/spec/dummy/public/422.html +26 -0
  48. data/spec/dummy/public/500.html +25 -0
  49. data/spec/dummy/public/favicon.ico +0 -0
  50. data/spec/dummy/script/rails +6 -0
  51. data/spec/dummy/test/fixtures/posts.yml +11 -0
  52. data/spec/dummy/test/unit/post_test.rb +7 -0
  53. data/spec/models/post_spec.rb +31 -0
  54. data/spec/rhode_island_spec.rb +50 -0
  55. data/spec/spec_helper.rb +38 -0
  56. metadata +194 -0
@@ -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,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,31 @@
1
+ # require 'spec_helper'
2
+
3
+ # describe Post do
4
+ # it "should create make methods for each state" do
5
+ # post = Post.new
6
+ # post.respond_to?(:make_pending).should be_true
7
+ # post.respond_to?(:make_live).should be_true
8
+ # post.respond_to?(:make_archived).should be_true
9
+ # post.respond_to?(:make_deleted).should be_true
10
+ # end
11
+
12
+ # it "should create make bang methods for each state" do
13
+ # post = Post.new
14
+ # post.respond_to?(:make_pending!).should be_true
15
+ # post.respond_to?(:make_live!).should be_true
16
+ # post.respond_to?(:make_archived!).should be_true
17
+ # post.respond_to?(:make_deleted!).should be_true
18
+ # end
19
+
20
+ # it "should call before entering callback before changing state" do
21
+ # post = Post.new
22
+ # post.should_receive(:before_making_live) do
23
+ # post.should_receive(:make_live) do
24
+ # end
25
+ # end
26
+ # post.make_live
27
+ # end
28
+
29
+ # it "should call before leaving callback before changing state" do
30
+ # end
31
+ # end
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ describe RhodeIsland do
4
+ it "should be a module" do
5
+ RhodeIsland.should be_a Module
6
+ end
7
+
8
+ it "should create make methods for each state" do
9
+ post = Post.new
10
+ post.respond_to?(:make_pending).should be_true
11
+ post.respond_to?(:make_live).should be_true
12
+ post.respond_to?(:make_archived).should be_true
13
+ post.respond_to?(:make_deleted).should be_true
14
+ end
15
+
16
+ it "should create make bang methods for each state" do
17
+ post = Post.new
18
+ post.respond_to?(:make_pending!).should be_true
19
+ post.respond_to?(:make_live!).should be_true
20
+ post.respond_to?(:make_archived!).should be_true
21
+ post.respond_to?(:make_deleted!).should be_true
22
+ end
23
+
24
+ it "should call before entering callback before changing state" do
25
+ post = Post.new
26
+ post.should_receive(:before_making_live) do
27
+ post.should_receive(:state=).with('live')
28
+ end
29
+ post.make_live
30
+ end
31
+
32
+ it "should call before leaving callback before changing state" do
33
+ post = Post.new({state: 'live'}, without_protection: true)
34
+ post.should_receive(:before_leaving_live) do
35
+ post.should_receive(:state=).with('deleted')
36
+ end
37
+ post.make_deleted
38
+ end
39
+
40
+ it "should call before leaving callback before calling before making callback" do
41
+ post = Post.new({state: 'live'}, without_protection: true)
42
+
43
+ post.should_receive(:before_leaving_live) do
44
+ post.should_receive(:before_making_deleted) do
45
+ post.should_receive(:state=).with('deleted')
46
+ end
47
+ end
48
+ post.make_deleted
49
+ end
50
+ end
@@ -0,0 +1,38 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ # Requires supporting ruby files with custom matchers and macros, etc,
8
+ # in spec/support/ and its subdirectories.
9
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+ # ## Mock Framework
13
+ #
14
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15
+ #
16
+ # config.mock_with :mocha
17
+ # config.mock_with :flexmock
18
+ # config.mock_with :rr
19
+
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+
23
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
+ # examples within a transaction, remove the following line or assign false
25
+ # instead of true.
26
+ config.use_transactional_fixtures = true
27
+
28
+ # If true, the base class of anonymous controllers will be inferred
29
+ # automatically. This will be the default behavior in future versions of
30
+ # rspec-rails.
31
+ config.infer_base_class_for_anonymous_controllers = false
32
+
33
+ # Run specs in random order to surface order dependencies. If you find an
34
+ # order dependency and want to debug it, you can fix the order by providing
35
+ # the seed, which is printed after each run.
36
+ # --seed 1234
37
+ config.order = "random"
38
+ end
metadata ADDED
@@ -0,0 +1,194 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rhode_island
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Bradly Feeley
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: sqlite3
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: A really small state machince for Ruby on Rails
63
+ email:
64
+ - bradlyf@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - lib/rhode_island.rb
75
+ - lib/rhode_island/active_record_extensions.rb
76
+ - lib/rhode_island/railtie.rb
77
+ - lib/rhode_island/version.rb
78
+ - rhode_island.gemspec
79
+ - spec/dummy/.rspec
80
+ - spec/dummy/README.rdoc
81
+ - spec/dummy/Rakefile
82
+ - spec/dummy/app/assets/javascripts/application.js
83
+ - spec/dummy/app/assets/stylesheets/application.css
84
+ - spec/dummy/app/controllers/application_controller.rb
85
+ - spec/dummy/app/helpers/application_helper.rb
86
+ - spec/dummy/app/mailers/.gitkeep
87
+ - spec/dummy/app/models/.gitkeep
88
+ - spec/dummy/app/models/post.rb
89
+ - spec/dummy/app/views/layouts/application.html.erb
90
+ - spec/dummy/config.ru
91
+ - spec/dummy/config/application.rb
92
+ - spec/dummy/config/boot.rb
93
+ - spec/dummy/config/database.yml
94
+ - spec/dummy/config/environment.rb
95
+ - spec/dummy/config/environments/development.rb
96
+ - spec/dummy/config/environments/production.rb
97
+ - spec/dummy/config/environments/test.rb
98
+ - spec/dummy/config/initializers/backtrace_silencers.rb
99
+ - spec/dummy/config/initializers/inflections.rb
100
+ - spec/dummy/config/initializers/mime_types.rb
101
+ - spec/dummy/config/initializers/secret_token.rb
102
+ - spec/dummy/config/initializers/session_store.rb
103
+ - spec/dummy/config/initializers/wrap_parameters.rb
104
+ - spec/dummy/config/locales/en.yml
105
+ - spec/dummy/config/routes.rb
106
+ - spec/dummy/db/development.sqlite3
107
+ - spec/dummy/db/migrate/20130331035511_create_posts.rb
108
+ - spec/dummy/db/schema.rb
109
+ - spec/dummy/db/test.sqlite3
110
+ - spec/dummy/lib/assets/.gitkeep
111
+ - spec/dummy/log/.gitkeep
112
+ - spec/dummy/log/development.log
113
+ - spec/dummy/log/test.log
114
+ - spec/dummy/public/404.html
115
+ - spec/dummy/public/422.html
116
+ - spec/dummy/public/500.html
117
+ - spec/dummy/public/favicon.ico
118
+ - spec/dummy/script/rails
119
+ - spec/dummy/test/fixtures/posts.yml
120
+ - spec/dummy/test/unit/post_test.rb
121
+ - spec/models/post_spec.rb
122
+ - spec/rhode_island_spec.rb
123
+ - spec/spec_helper.rb
124
+ homepage: ''
125
+ licenses: []
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 1.8.24
145
+ signing_key:
146
+ specification_version: 3
147
+ summary: A really small state machince for Ruby on Rails
148
+ test_files:
149
+ - spec/dummy/.rspec
150
+ - spec/dummy/README.rdoc
151
+ - spec/dummy/Rakefile
152
+ - spec/dummy/app/assets/javascripts/application.js
153
+ - spec/dummy/app/assets/stylesheets/application.css
154
+ - spec/dummy/app/controllers/application_controller.rb
155
+ - spec/dummy/app/helpers/application_helper.rb
156
+ - spec/dummy/app/mailers/.gitkeep
157
+ - spec/dummy/app/models/.gitkeep
158
+ - spec/dummy/app/models/post.rb
159
+ - spec/dummy/app/views/layouts/application.html.erb
160
+ - spec/dummy/config.ru
161
+ - spec/dummy/config/application.rb
162
+ - spec/dummy/config/boot.rb
163
+ - spec/dummy/config/database.yml
164
+ - spec/dummy/config/environment.rb
165
+ - spec/dummy/config/environments/development.rb
166
+ - spec/dummy/config/environments/production.rb
167
+ - spec/dummy/config/environments/test.rb
168
+ - spec/dummy/config/initializers/backtrace_silencers.rb
169
+ - spec/dummy/config/initializers/inflections.rb
170
+ - spec/dummy/config/initializers/mime_types.rb
171
+ - spec/dummy/config/initializers/secret_token.rb
172
+ - spec/dummy/config/initializers/session_store.rb
173
+ - spec/dummy/config/initializers/wrap_parameters.rb
174
+ - spec/dummy/config/locales/en.yml
175
+ - spec/dummy/config/routes.rb
176
+ - spec/dummy/db/development.sqlite3
177
+ - spec/dummy/db/migrate/20130331035511_create_posts.rb
178
+ - spec/dummy/db/schema.rb
179
+ - spec/dummy/db/test.sqlite3
180
+ - spec/dummy/lib/assets/.gitkeep
181
+ - spec/dummy/log/.gitkeep
182
+ - spec/dummy/log/development.log
183
+ - spec/dummy/log/test.log
184
+ - spec/dummy/public/404.html
185
+ - spec/dummy/public/422.html
186
+ - spec/dummy/public/500.html
187
+ - spec/dummy/public/favicon.ico
188
+ - spec/dummy/script/rails
189
+ - spec/dummy/test/fixtures/posts.yml
190
+ - spec/dummy/test/unit/post_test.rb
191
+ - spec/models/post_spec.rb
192
+ - spec/rhode_island_spec.rb
193
+ - spec/spec_helper.rb
194
+ has_rdoc: