rc_rails 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.3
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ = 2.1.1
2
+
3
+ * Stop modifying resource_specification_map in place [Joel Chippendale]
4
+ * Handle instance_methods containing Symbols in Ruby >= 1.9 [Lewis Marshall]
5
+ * Fix failing specs since 2.1.0 [Ian White]
6
+ * Add travis ci [Ian White]
7
+
8
+
1
9
  = 2.1.0
2
10
 
3
11
  * Gemify resources_controller and friends (thanks Josh Goebel)
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source :rubygems
2
2
 
3
- gemspec
4
-
5
- gem 'pry'
3
+ gemspec
@@ -1,60 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rc_rails (2.1.0)
4
+ rc_rails (2.1.1)
5
5
  rails (>= 3.1.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (3.2.2)
11
- actionpack (= 3.2.2)
12
- mail (~> 2.4.0)
13
- actionpack (3.2.2)
14
- activemodel (= 3.2.2)
15
- activesupport (= 3.2.2)
10
+ actionmailer (3.2.3)
11
+ actionpack (= 3.2.3)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.3)
14
+ activemodel (= 3.2.3)
15
+ activesupport (= 3.2.3)
16
16
  builder (~> 3.0.0)
17
17
  erubis (~> 2.7.0)
18
18
  journey (~> 1.0.1)
19
19
  rack (~> 1.4.0)
20
- rack-cache (~> 1.1)
20
+ rack-cache (~> 1.2)
21
21
  rack-test (~> 0.6.1)
22
22
  sprockets (~> 2.1.2)
23
- activemodel (3.2.2)
24
- activesupport (= 3.2.2)
23
+ activemodel (3.2.3)
24
+ activesupport (= 3.2.3)
25
25
  builder (~> 3.0.0)
26
- activerecord (3.2.2)
27
- activemodel (= 3.2.2)
28
- activesupport (= 3.2.2)
26
+ activerecord (3.2.3)
27
+ activemodel (= 3.2.3)
28
+ activesupport (= 3.2.3)
29
29
  arel (~> 3.0.2)
30
30
  tzinfo (~> 0.3.29)
31
- activeresource (3.2.2)
32
- activemodel (= 3.2.2)
33
- activesupport (= 3.2.2)
34
- activesupport (3.2.2)
31
+ activeresource (3.2.3)
32
+ activemodel (= 3.2.3)
33
+ activesupport (= 3.2.3)
34
+ activesupport (3.2.3)
35
35
  i18n (~> 0.6)
36
36
  multi_json (~> 1.0)
37
37
  arel (3.0.2)
38
38
  builder (3.0.0)
39
- coderay (1.0.5)
40
39
  diff-lcs (1.1.3)
41
40
  erubis (2.7.0)
42
41
  hike (1.2.1)
43
42
  i18n (0.6.0)
44
43
  journey (1.0.3)
45
- json (1.6.5)
44
+ json (1.7.1)
46
45
  mail (2.4.4)
47
46
  i18n (>= 0.4.0)
48
47
  mime-types (~> 1.16)
49
48
  treetop (~> 1.4.8)
50
- method_source (0.7.1)
51
- mime-types (1.17.2)
52
- multi_json (1.1.0)
49
+ mime-types (1.18)
50
+ multi_json (1.3.4)
53
51
  polyglot (0.3.3)
54
- pry (0.9.8.4)
55
- coderay (~> 1.0.5)
56
- method_source (~> 0.7.1)
57
- slop (>= 2.4.4, < 3)
58
52
  rack (1.4.1)
59
53
  rack-cache (1.2)
60
54
  rack (>= 0.4)
@@ -62,17 +56,17 @@ GEM
62
56
  rack
63
57
  rack-test (0.6.1)
64
58
  rack (>= 1.0)
65
- rails (3.2.2)
66
- actionmailer (= 3.2.2)
67
- actionpack (= 3.2.2)
68
- activerecord (= 3.2.2)
69
- activeresource (= 3.2.2)
70
- activesupport (= 3.2.2)
59
+ rails (3.2.3)
60
+ actionmailer (= 3.2.3)
61
+ actionpack (= 3.2.3)
62
+ activerecord (= 3.2.3)
63
+ activeresource (= 3.2.3)
64
+ activesupport (= 3.2.3)
71
65
  bundler (~> 1.0)
72
- railties (= 3.2.2)
73
- railties (3.2.2)
74
- actionpack (= 3.2.2)
75
- activesupport (= 3.2.2)
66
+ railties (= 3.2.3)
67
+ railties (3.2.3)
68
+ actionpack (= 3.2.3)
69
+ activesupport (= 3.2.3)
76
70
  rack-ssl (~> 1.3.2)
77
71
  rake (>= 0.8.7)
78
72
  rdoc (~> 3.4)
@@ -80,37 +74,35 @@ GEM
80
74
  rake (0.9.2.2)
81
75
  rdoc (3.12)
82
76
  json (~> 1.4)
83
- rspec (2.8.0)
84
- rspec-core (~> 2.8.0)
85
- rspec-expectations (~> 2.8.0)
86
- rspec-mocks (~> 2.8.0)
87
- rspec-core (2.8.0)
88
- rspec-expectations (2.8.0)
89
- diff-lcs (~> 1.1.2)
90
- rspec-mocks (2.8.0)
91
- rspec-rails (2.8.1)
77
+ rspec (2.10.0)
78
+ rspec-core (~> 2.10.0)
79
+ rspec-expectations (~> 2.10.0)
80
+ rspec-mocks (~> 2.10.0)
81
+ rspec-core (2.10.0)
82
+ rspec-expectations (2.10.0)
83
+ diff-lcs (~> 1.1.3)
84
+ rspec-mocks (2.10.1)
85
+ rspec-rails (2.10.1)
92
86
  actionpack (>= 3.0)
93
87
  activesupport (>= 3.0)
94
88
  railties (>= 3.0)
95
- rspec (~> 2.8.0)
96
- slop (2.4.4)
97
- sprockets (2.1.2)
89
+ rspec (~> 2.10.0)
90
+ sprockets (2.1.3)
98
91
  hike (~> 1.2)
99
92
  rack (~> 1.0)
100
93
  tilt (~> 1.1, != 1.3.0)
101
- sqlite3 (1.3.5)
94
+ sqlite3 (1.3.6)
102
95
  thor (0.14.6)
103
96
  tilt (1.3.3)
104
97
  treetop (1.4.10)
105
98
  polyglot
106
99
  polyglot (>= 0.3.1)
107
- tzinfo (0.3.32)
100
+ tzinfo (0.3.33)
108
101
 
109
102
  PLATFORMS
110
103
  ruby
111
104
 
112
105
  DEPENDENCIES
113
- pry
114
106
  rc_rails!
115
107
  rspec (>= 2.8.0)
116
108
  rspec-rails (>= 2.8.0)
@@ -1,5 +1,7 @@
1
1
  = resources_controller
2
2
 
3
+ {<img src="https://secure.travis-ci.org/ianwhite/resources_controller.png?branch=master" alt="Build Status" />}[http://travis-ci.org/ianwhite/resources_controller]
4
+
3
5
  is a plugin to facilitate inheritance and DRYness in your resources controllers. It introduces some abstraction to help
4
6
  you override the default RESTful funtionality in a clean and simple manner.
5
7
 
@@ -25,32 +27,24 @@ Add this to your Gemfile
25
27
 
26
28
  use the rails2 branch: http://github.com/ianwhite/resources_controller/tree/rails2
27
29
 
28
- == Run the specs
29
-
30
- To get set up for development, do the following:
31
-
32
- git clone git://github.com/ianwhite/resources_controller
33
- cd resources_controller
34
- cp Gemfile.lock.development Gemfile.lock
35
- bundle
36
- rake spec:generate
37
- rake spec
38
-
39
30
  == How to contribute
40
31
 
41
32
  If you have found a bug, or have a new feature, then spec'd code is great.
42
33
 
43
- To get set up and run the tests
34
+ To get set up for development, do the following:
44
35
 
45
36
  git clone git://github.com/ianwhite/resources_controller
46
37
  cd resources_controller
38
+ cp Gemfile.lock.development Gemfile.lock
47
39
  bundle
48
- rake spec:all
40
+ rake spec
41
+ rake spec:rspec_generated_specs
49
42
 
50
43
  == Contributors
51
44
 
52
45
  The following people have made contributions to resources_controller. Please let me know if I've missed you out.
53
46
 
47
+ * Lewis Marshall
54
48
  * Josh Goebel
55
49
  * Andrew Bloomgarden
56
50
  * Chris Hapgood
@@ -489,7 +489,7 @@ module ResourcesController
489
489
  # See Specification#new for details of how to call this
490
490
  def map_enclosing_resource(name, options = {}, &block)
491
491
  spec = Specification.new(name, options, &block)
492
- resource_specification_map[spec.segment] = spec
492
+ self.resource_specification_map = resource_specification_map.merge spec.segment => spec
493
493
  end
494
494
 
495
495
  # this will be deprecated soon as it's badly named - use map_enclosing_resource
@@ -26,9 +26,10 @@ module ResourcesController
26
26
 
27
27
  def action_methods_to_remove(options = {})
28
28
  if options[:only]
29
- instance_methods - Array(options[:only]).map(&:to_s)
29
+ # instance_methods contains Strings in < 1.9, and Symbols in >= 1.9
30
+ instance_methods.map(&:to_s) - Array(options[:only]).map(&:to_s)
30
31
  elsif options[:except]
31
- Array(options[:except]).map(&:to_s) & instance_methods
32
+ Array(options[:except]).map(&:to_s) & instance_methods.map(&:to_s)
32
33
  else
33
34
  []
34
35
  end
@@ -1,3 +1,3 @@
1
1
  module ResourcesController
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -31,6 +31,7 @@ Rails.application.routes.draw do
31
31
  end
32
32
 
33
33
  resources :users do
34
+ resources :interests
34
35
  resources :posts, :controller => 'user_posts'
35
36
  resources :comments, :controller => 'user_comments'
36
37
  resources :addresses do
@@ -1,5 +1,4 @@
1
1
  test:
2
2
  adapter: sqlite3
3
- database: tmp/test.sqlite3
4
- pool: 5
5
- timeout: 5000
3
+ database: ":memory:"
4
+ verbosity: quiet
@@ -156,7 +156,7 @@ end
156
156
 
157
157
  describe UsersController, "handling GET /users/new" do
158
158
  it "should be unknown action" do
159
- lambda{ get :new }.should raise_error(ActionView::MissingTemplate)
159
+ lambda{ get :new }.should raise_error(::AbstractController::ActionNotFound)
160
160
  end
161
161
  end
162
162
 
@@ -194,7 +194,7 @@ end
194
194
 
195
195
  describe UsersController, "handling POST /users" do
196
196
  it "should be unknown action" do
197
- lambda{ post :create }.should raise_error(ActionController::RoutingError)
197
+ lambda{ post :create }.should raise_error(::AbstractController::ActionNotFound)
198
198
  end
199
199
  end
200
200
 
@@ -52,27 +52,28 @@ module ResourceMethodsSpec
52
52
  describe "when an enclosing resource is added (a forum)" do
53
53
  before do
54
54
  @forum = Forum.create!
55
+ @forum.stub(:users).and_return(@users = double)
55
56
  @controller.send :add_enclosing_resource, @forum
56
57
  end
57
58
 
58
- it "#find_resource(<id>) should call forum.users.find(<id>)" do
59
- @forum.users.should_receive(:find).with("42")
60
- @controller.send(:find_resource, "42")
59
+ it "#find_resource(<id>) should find the forum user" do
60
+ @users.should_receive(:find).with("42").and_return(user = double)
61
+ @controller.send(:find_resource, "42").should == user
61
62
  end
62
63
 
63
- it "#find_resources should call forum.users.find(:all)" do
64
- @forum.users.should_receive(:all)
65
- @controller.send(:find_resources)
64
+ it "#find_resources should return the forum users" do
65
+ @users.should_receive(:all).and_return(users = double)
66
+ @controller.send(:find_resources).should == users
66
67
  end
67
68
 
68
69
  it "#new_resource({}) should call forum.users.build({})" do
69
- @forum.users.should_receive(:build).with({})
70
- @controller.send :new_resource, {}
70
+ @users.should_receive(:build).with({}).and_return(user = double)
71
+ @controller.send(:new_resource, {}).should == user
71
72
  end
72
73
 
73
- it "#destroy_resource(<id>) should call forum.users.find(<id>) and forum.users.destroy(<id>)" do
74
- @forum.users.should_receive(:find).with("42").and_return(user = mock)
75
- @forum.users.should_receive(:destroy).with("42").and_return(useless_array = mock)
74
+ it "#destroy_resource(<id>) should call forum.users.find(<id>) and forum.users.destroy(<id>) and return the resource" do
75
+ @users.should_receive(:find).with("42").and_return(user = double)
76
+ @users.should_receive(:destroy).with("42")
76
77
  @controller.send(:destroy_resource, "42").should == user
77
78
  end
78
79
  end
@@ -1,6 +1,6 @@
1
1
  namespace :spec do
2
2
  desc "Run rspec's generated specs against RC'd controllers"
3
- task :generate => 'tmp/test_app' do
3
+ task :rspec_generated_specs => 'tmp/test_app' do
4
4
  require 'active_support/all'
5
5
 
6
6
  cd 'tmp/test_app' do
@@ -9,7 +9,8 @@ namespace :spec do
9
9
  migrate_up
10
10
  make_resources_controller :author
11
11
  puts "** Running generated controller specs"
12
- sh "bundle exec rake spec:controllers"
12
+ sh "rake db:test:prepare"
13
+ sh "bundle exec rspec"
13
14
  ensure
14
15
  migrate_down
15
16
  cleanup_resource :author
@@ -28,21 +29,14 @@ namespace :spec do
28
29
  puts "Generating test app"
29
30
  mkdir_p "tmp"
30
31
  cd 'tmp' do
31
- system "rails new test_app"
32
+ system "rails new test_app --skip-gemfile --skip-bundle --skip-git --skip-test-unit"
32
33
 
33
34
  cd 'test_app' do
34
35
  File.open('Gemfile', 'w+') do |file|
35
- file << <<-EOD
36
- source :rubygems
37
- gem 'rails'
38
- gem 'sqlite3'
39
- gem 'rspec'
40
- gem 'rspec-rails'
41
- gem 'rc_rails', :git => "#{File.expand_path('../../../..', __FILE__)}"
42
- EOD
36
+ file << %Q{gem 'rc_rails', :git => "#{File.expand_path('../../../..', __FILE__)}"}
43
37
  end
44
- system "bundle install"
45
- system "rails g rspec:install"
38
+ system "bundle install --quiet"
39
+ system "rails generate rspec:install"
46
40
  end
47
41
  end
48
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rc_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-16 00:00:00.000000000 Z
12
+ date: 2012-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70213065794220 !ruby/object:Gem::Requirement
16
+ requirement: &70122018858180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70213065794220
24
+ version_requirements: *70122018858180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70213065793660 !ruby/object:Gem::Requirement
27
+ requirement: &70122018856400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.8.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70213065793660
35
+ version_requirements: *70122018856400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &70213065793060 !ruby/object:Gem::Requirement
38
+ requirement: &70122018850400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.8.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70213065793060
46
+ version_requirements: *70122018850400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &70213065792600 !ruby/object:Gem::Requirement
49
+ requirement: &70122018847920 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70213065792600
57
+ version_requirements: *70122018847920
58
58
  description: rc makes RESTful controllers fun
59
59
  email: ian.w.white@gmail.com
60
60
  executables: []
@@ -63,6 +63,7 @@ extra_rdoc_files:
63
63
  - README.rdoc
64
64
  files:
65
65
  - .gitignore
66
+ - .travis.yml
66
67
  - CHANGELOG
67
68
  - Gemfile
68
69
  - Gemfile.lock.development
@@ -174,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
175
  version: '0'
175
176
  segments:
176
177
  - 0
177
- hash: 1183401089440574337
178
+ hash: -2439169626615472327
178
179
  required_rubygems_version: !ruby/object:Gem::Requirement
179
180
  none: false
180
181
  requirements:
@@ -183,11 +184,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  version: '0'
184
185
  segments:
185
186
  - 0
186
- hash: 1183401089440574337
187
+ hash: -2439169626615472327
187
188
  requirements: []
188
189
  rubyforge_project:
189
190
  rubygems_version: 1.8.10
190
191
  signing_key:
191
192
  specification_version: 3
192
- summary: resources_controller-2.1.0
193
+ summary: resources_controller-2.1.1
193
194
  test_files: []