I can''t figure out how to build rspec-rails as a gem when just cloned from github... there isn''t any .gemspec file or rake task that does this. Any help? -- Posted via http://www.ruby-forum.com/.
On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez <lists at ruby-forum.com> wrote:> I can''t figure out how to build rspec-rails as a gem when just cloned > from github... there isn''t any .gemspec file or rake task that does > this. Any help?rspec-rails is a rails plugin, not a gem. Pat
So how can I test a mocked rails controller within my plugin''s specs? -- Posted via http://www.ruby-forum.com/.
On Mon, Jun 2, 2008 at 11:16 PM, Jose Fernandez <lists at ruby-forum.com> wrote:> So how can I test a mocked rails controller within my plugin''s specs?I don''t quite follow you. Can you post an example of what you''re trying to do? Pat
Pat Maddox wrote:> On Mon, Jun 2, 2008 at 11:16 PM, Jose Fernandez <lists at ruby-forum.com> > wrote: >> So how can I test a mocked rails controller within my plugin''s specs? > > I don''t quite follow you. Can you post an example of what you''re trying > to do? > > Pathttp://github.com/jfernandez/submarine/tree/b3853cb0a959813f156bb25239dcd4f4f2c0c406/spec/submarine/submarine_spec.rb That only test wont work because neither the ''controller_name'' or ''get'' methods are recognized, and I think thats because they are part of rspec-rails. -- Posted via http://www.ruby-forum.com/.
On Mon, Jun 2, 2008 at 11:23 PM, Jose Fernandez <lists at ruby-forum.com> wrote:> Pat Maddox wrote: >> On Mon, Jun 2, 2008 at 11:16 PM, Jose Fernandez <lists at ruby-forum.com> >> wrote: >>> So how can I test a mocked rails controller within my plugin''s specs? >> >> I don''t quite follow you. Can you post an example of what you''re trying >> to do? >> >> Pat > > http://github.com/jfernandez/submarine/tree/b3853cb0a959813f156bb25239dcd4f4f2c0c406/spec/submarine/submarine_spec.rb > > That only test wont work because neither the ''controller_name'' or ''get'' > methods are recognized, and I think thats because they are part of > rspec-rails.You need to include the app''s spec-helper from within your spec. http://github.com/pat-maddox/rspec-plugin-generator/tree/master/generators/rspec_plugin/templates/spec_helper.rb shows what I did in my rspec_plugin generator. You might just be able to require spec/rails, I''m not sure, but you''d have to set up the load path. Pat
Pat Maddox wrote:> On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez <lists at ruby-forum.com> wrote: > >> I can''t figure out how to build rspec-rails as a gem when just cloned >> from github... there isn''t any .gemspec file or rake task that does >> this. Any help? >> > > rspec-rails is a rails plugin, not a gem. > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >I have needed to use it as a gem before. Why? Well, with ticket 383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup) David extracted the mocking features for AR so that it could be reused easily. I was writing a merb app that used AR and I quickly began missing the mock_model and other mock helpers found in rspec-rails. So, I created a gem out of the plugin, installed it locally in my merb app I just required ''spec/rails/mocks''. The gemspec file I created to do this was: Gem::Specification.new do |s| s.name = %q{rspec-rails} s.version = "1.1.4" s.specification_version = 2 if s.respond_to? :specification_version s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version s.authors = ["RSpec Development Team"] s.date = %q{2008-05-25} s.default_executable = %q{spec} s.description = %q{RSpec-Rails is an extension to RSpec to provide a better environment for specing rails.} s.email = %q{rspec-devel at rubyforge.org} s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"] s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", "lib/autotest/discover.rb", "lib/autotest/rails_rspec.rb", "lib/spec/rails/example/assigns_hash_proxy.rb", "lib/spec/rails/example/controller_example _group.rb", "lib/spec/rails/example/functional_example_group.rb", "lib/spec/rails/example/helper_example_group.rb", "lib/spec/rails/example/model_example_group.rb", "lib/spec/rails/example/rails_example_group.r b", "lib/spec/rails/example/render_observer.rb", "lib/spec/rails/example/view_example_group.rb", "lib/spec/rails/example.rb", "lib/spec/rails/extensions/action_controller/base.rb", "lib/spec/rails/extensions/ac tion_controller/rescue.rb", "lib/spec/rails/extensions/action_controller/test_response.rb", "lib/spec/rails/extensions/action_view/base.rb", "lib/spec/rails/extensions/active_record/base.rb", "lib/spec/rails/ex tensions/object.rb", "lib/spec/rails/extensions/spec/example/configuration.rb", "lib/spec/rails/extensions/spec/matchers/have.rb", "lib/spec/rails/extensions.rb", "lib/spec/rails/matchers/assert_select.rb", "li b/spec/rails/matchers/have_text.rb", "lib/spec/rails/matchers/include_text.rb", "lib/spec/rails/matchers/redirect_to.rb", "lib/spec/rails/matchers/render_template.rb", "lib/spec/rails/matchers.rb", "lib/spec/ra ils/mocks.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/rails/version.rb", "lib/spec/rails.rb"] s.has_rdoc = true s.homepage = %q{http://rspec.rubyforge.org} s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", "--inline-source", "--main", "README"] s.require_paths = ["lib"] s.rubygems_version = %q{1.1.0} s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for Ruby http://rspec.rubyforge.org/} end
On Jun 3, 2008, at 11:31 AM, Ben Mabey wrote:> Pat Maddox wrote: >> On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez <lists at ruby- >> forum.com> wrote: >> >>> I can''t figure out how to build rspec-rails as a gem when just >>> cloned >>> from github... there isn''t any .gemspec file or rake task that does >>> this. Any help? >>> >> >> rspec-rails is a rails plugin, not a gem. >> >> Pat >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > I have needed to use it as a gem before. Why? Well, with ticket > 383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup > ) David extracted the mocking features for AR so that it could be > reused easily. I was writing a merb app that used AR and I quickly > began missing the mock_model and other mock helpers found in rspec- > rails. So, I created a gem out of the plugin, installed it locally > in my merb app I just required ''spec/rails/mocks''. > > > The gemspec file I created to do this was: > > Gem::Specification.new do |s| > s.name = %q{rspec-rails} > s.version = "1.1.4" > > s.specification_version = 2 if s.respond_to? :specification_version> > s.required_rubygems_version = Gem::Requirement.new(">= 0") if > s.respond_to? :required_rubygems_version> s.authors = ["RSpec Development Team"] > s.date = %q{2008-05-25} > s.default_executable = %q{spec} > s.description = %q{RSpec-Rails is an extension to RSpec to provide a > better environment for specing rails.} > s.email = %q{rspec-devel at rubyforge.org} > s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"] > s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", "lib/ > autotest/discover.rb", "lib/autotest/rails_rspec.rb", "lib/spec/ > rails/example/assigns_hash_proxy.rb", "lib/spec/rails/example/ > controller_example > _group.rb", "lib/spec/rails/example/functional_example_group.rb", > "lib/spec/rails/example/helper_example_group.rb", "lib/spec/rails/ > example/model_example_group.rb", "lib/spec/rails/example/ > rails_example_group.r > b", "lib/spec/rails/example/render_observer.rb", "lib/spec/rails/ > example/view_example_group.rb", "lib/spec/rails/example.rb", "lib/ > spec/rails/extensions/action_controller/base.rb", "lib/spec/rails/ > extensions/ac > tion_controller/rescue.rb", "lib/spec/rails/extensions/ > action_controller/test_response.rb", "lib/spec/rails/extensions/ > action_view/base.rb", "lib/spec/rails/extensions/active_record/ > base.rb", "lib/spec/rails/ex > tensions/object.rb", "lib/spec/rails/extensions/spec/example/ > configuration.rb", "lib/spec/rails/extensions/spec/matchers/ > have.rb", "lib/spec/rails/extensions.rb", "lib/spec/rails/matchers/ > assert_select.rb", "li > b/spec/rails/matchers/have_text.rb", "lib/spec/rails/matchers/ > include_text.rb", "lib/spec/rails/matchers/redirect_to.rb", "lib/ > spec/rails/matchers/render_template.rb", "lib/spec/rails/ > matchers.rb", "lib/spec/ra > ils/mocks.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/rails/ > version.rb", "lib/spec/rails.rb"] > s.has_rdoc = true > s.homepage = %q{http://rspec.rubyforge.org} > s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", "-- > inline-source", "--main", "README"] > s.require_paths = ["lib"] > s.rubygems_version = %q{1.1.0} > s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for > Ruby http://rspec.rubyforge.org/} > endI can grab this and add it or, if you want, you can gimme a git-patch. Your call. Cheers, David
David Chelimsky wrote:> > On Jun 3, 2008, at 11:31 AM, Ben Mabey wrote: > >> Pat Maddox wrote: >>> On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez >>> <lists at ruby-forum.com> wrote: >>> >>>> I can''t figure out how to build rspec-rails as a gem when just cloned >>>> from github... there isn''t any .gemspec file or rake task that does >>>> this. Any help? >>>> >>> >>> rspec-rails is a rails plugin, not a gem. >>> >>> Pat >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> >> I have needed to use it as a gem before. Why? Well, with ticket >> 383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup) >> David extracted the mocking features for AR so that it could be >> reused easily. I was writing a merb app that used AR and I quickly >> began missing the mock_model and other mock helpers found in >> rspec-rails. So, I created a gem out of the plugin, installed it >> locally in my merb app I just required ''spec/rails/mocks''. >> >> >> The gemspec file I created to do this was: >> >> Gem::Specification.new do |s| >> s.name = %q{rspec-rails} >> s.version = "1.1.4" >> >> s.specification_version = 2 if s.respond_to? :specification_version>> >> s.required_rubygems_version = Gem::Requirement.new(">= 0") if >> s.respond_to? :required_rubygems_version>> s.authors = ["RSpec Development Team"] >> s.date = %q{2008-05-25} >> s.default_executable = %q{spec} >> s.description = %q{RSpec-Rails is an extension to RSpec to provide a >> better environment for specing rails.} >> s.email = %q{rspec-devel at rubyforge.org} >> s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"] >> s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", >> "lib/autotest/discover.rb", "lib/autotest/rails_rspec.rb", >> "lib/spec/rails/example/assigns_hash_proxy.rb", >> "lib/spec/rails/example/controller_example >> _group.rb", "lib/spec/rails/example/functional_example_group.rb", >> "lib/spec/rails/example/helper_example_group.rb", >> "lib/spec/rails/example/model_example_group.rb", >> "lib/spec/rails/example/rails_example_group.r >> b", "lib/spec/rails/example/render_observer.rb", >> "lib/spec/rails/example/view_example_group.rb", >> "lib/spec/rails/example.rb", >> "lib/spec/rails/extensions/action_controller/base.rb", >> "lib/spec/rails/extensions/ac >> tion_controller/rescue.rb", >> "lib/spec/rails/extensions/action_controller/test_response.rb", >> "lib/spec/rails/extensions/action_view/base.rb", >> "lib/spec/rails/extensions/active_record/base.rb", "lib/spec/rails/ex >> tensions/object.rb", >> "lib/spec/rails/extensions/spec/example/configuration.rb", >> "lib/spec/rails/extensions/spec/matchers/have.rb", >> "lib/spec/rails/extensions.rb", >> "lib/spec/rails/matchers/assert_select.rb", "li >> b/spec/rails/matchers/have_text.rb", >> "lib/spec/rails/matchers/include_text.rb", >> "lib/spec/rails/matchers/redirect_to.rb", >> "lib/spec/rails/matchers/render_template.rb", >> "lib/spec/rails/matchers.rb", "lib/spec/ra >> ils/mocks.rb", "lib/spec/rails/story_adapter.rb", >> "lib/spec/rails/version.rb", "lib/spec/rails.rb"] >> s.has_rdoc = true >> s.homepage = %q{http://rspec.rubyforge.org} >> s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", >> "--inline-source", "--main", "README"] >> s.require_paths = ["lib"] >> s.rubygems_version = %q{1.1.0} >> s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for >> Ruby http://rspec.rubyforge.org/} >> end > > > I can grab this and add it or, if you want, you can gimme a git-patch. > Your call. >I think a rake task like rspec has would be the best solution. I will create a patch and enter it on lighthouse when I get some time. -Ben
On Jun 3, 2008, at 11:55 AM, Ben Mabey wrote:> David Chelimsky wrote: >> >> On Jun 3, 2008, at 11:31 AM, Ben Mabey wrote: >> >>> Pat Maddox wrote: >>>> On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez <lists at ruby-forum.com >>>> > wrote: >>>> >>>>> I can''t figure out how to build rspec-rails as a gem when just >>>>> cloned >>>>> from github... there isn''t any .gemspec file or rake task that >>>>> does >>>>> this. Any help? >>>>> >>>> >>>> rspec-rails is a rails plugin, not a gem. >>>> >>>> Pat >>>> _______________________________________________ >>>> rspec-users mailing list >>>> rspec-users at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>> >>> >>> I have needed to use it as a gem before. Why? Well, with ticket >>> 383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup >>> ) David extracted the mocking features for AR so that it could be >>> reused easily. I was writing a merb app that used AR and I >>> quickly began missing the mock_model and other mock helpers found >>> in rspec-rails. So, I created a gem out of the plugin, installed >>> it locally in my merb app I just required ''spec/rails/mocks''. >>> >>> >>> The gemspec file I created to do this was: >>> >>> Gem::Specification.new do |s| >>> s.name = %q{rspec-rails} >>> s.version = "1.1.4" >>> >>> s.specification_version = 2 if s.respond_to? :specification_version>>> >>> s.required_rubygems_version = Gem::Requirement.new(">= 0") if >>> s.respond_to? :required_rubygems_version>>> s.authors = ["RSpec Development Team"] >>> s.date = %q{2008-05-25} >>> s.default_executable = %q{spec} >>> s.description = %q{RSpec-Rails is an extension to RSpec to provide >>> a better environment for specing rails.} >>> s.email = %q{rspec-devel at rubyforge.org} >>> s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"] >>> s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", "lib/ >>> autotest/discover.rb", "lib/autotest/rails_rspec.rb", "lib/spec/ >>> rails/example/assigns_hash_proxy.rb", "lib/spec/rails/example/ >>> controller_example >>> _group.rb", "lib/spec/rails/example/functional_example_group.rb", >>> "lib/spec/rails/example/helper_example_group.rb", "lib/spec/rails/ >>> example/model_example_group.rb", "lib/spec/rails/example/ >>> rails_example_group.r >>> b", "lib/spec/rails/example/render_observer.rb", "lib/spec/rails/ >>> example/view_example_group.rb", "lib/spec/rails/example.rb", "lib/ >>> spec/rails/extensions/action_controller/base.rb", "lib/spec/rails/ >>> extensions/ac >>> tion_controller/rescue.rb", "lib/spec/rails/extensions/ >>> action_controller/test_response.rb", "lib/spec/rails/extensions/ >>> action_view/base.rb", "lib/spec/rails/extensions/active_record/ >>> base.rb", "lib/spec/rails/ex >>> tensions/object.rb", "lib/spec/rails/extensions/spec/example/ >>> configuration.rb", "lib/spec/rails/extensions/spec/matchers/ >>> have.rb", "lib/spec/rails/extensions.rb", "lib/spec/rails/matchers/ >>> assert_select.rb", "li >>> b/spec/rails/matchers/have_text.rb", "lib/spec/rails/matchers/ >>> include_text.rb", "lib/spec/rails/matchers/redirect_to.rb", "lib/ >>> spec/rails/matchers/render_template.rb", "lib/spec/rails/ >>> matchers.rb", "lib/spec/ra >>> ils/mocks.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/rails/ >>> version.rb", "lib/spec/rails.rb"] >>> s.has_rdoc = true >>> s.homepage = %q{http://rspec.rubyforge.org} >>> s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", "-- >>> inline-source", "--main", "README"] >>> s.require_paths = ["lib"] >>> s.rubygems_version = %q{1.1.0} >>> s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for >>> Ruby http://rspec.rubyforge.org/} >>> end >> >> >> I can grab this and add it or, if you want, you can gimme a git- >> patch. Your call. >> > > I think a rake task like rspec has would be the best solution. I > will create a patch and enter it on lighthouse when I get some time.Great. Thanks.