Deepak Jois
2007-Feb-13 06:33 UTC
[rspec-users] Error against latest trunk while testing via spec for model
Hi I just did an update to lates trunk ================context "Given a generated venue_spec.rb with fixtures loaded" do fixtures :venues specify "fixtures should load two Venues" do Venue.should have(2).records end end ================= gives me =========1) TypeError in ''Given a generated venue_spec.rb with fixtures loaded fixtures should load two Venues'' can''t convert nil into String ========= This was working fine before I did an update. Could anyone tell me what is going on?
aslak hellesoy
2007-Feb-13 07:20 UTC
[rspec-users] Error against latest trunk while testing via spec for model
We need the backtrace. Can you run again with --backtrace Aslak On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote:> Hi > I just did an update to lates trunk > ================> context "Given a generated venue_spec.rb with fixtures loaded" do > fixtures :venues > > specify "fixtures should load two Venues" do > Venue.should have(2).records > end > end > =================> > gives me > > =========> 1) > TypeError in ''Given a generated venue_spec.rb with fixtures loaded > fixtures should load two Venues'' > can''t convert nil into String > =========> > This was working fine before I did an update. Could anyone tell me > what is going on? > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Deepak Jois
2007-Feb-13 07:28 UTC
[rspec-users] Error against latest trunk while testing via spec for model
On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> We need the backtrace. Can you run again with --backtrace > >==============1) TypeError in ''Given a generated venue_spec.rb with fixtures loaded fixtures should load two Venues'' can''t convert nil into String /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in `join'' /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in `create_fixtures'' /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:250:in `create_fixtures'' /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/base.rb:890:in `silence'' /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:248:in `create_fixtures'' /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:581:in `load_fixtures'' /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:535:in `setup_with_fixtures'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:131:in `create_block_from_parts'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:129:in `create_block_from_parts'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:47:in `setup_spec'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:29:in `run'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:58:in `run'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:55:in `run'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:23:in `run'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:22:in `run'' /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/command_line.rb:27:in `run'' vendor/plugins/rspec/bin/spec:4: ======================= FWIW, here is my fixtures file file ======one: id: 1 name: LT1 description: Lecture Theatre 1 active: 1 two: id: 2 name: LT2 description: Lecture Theatre 2 active: 0 ======== The schema of the table matches the fields in the YAML file
aslak hellesoy
2007-Feb-13 08:11 UTC
[rspec-users] Error against latest trunk while testing via spec for model
Rails version? svn revision? On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote:> On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > We need the backtrace. Can you run again with --backtrace > > > > > ==============> 1) > TypeError in ''Given a generated venue_spec.rb with fixtures loaded > fixtures should load two Venues'' > can''t convert nil into String > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > `join'' > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > `create_fixtures'' > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:250:in > `create_fixtures'' > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/base.rb:890:in > `silence'' > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:248:in > `create_fixtures'' > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:581:in > `load_fixtures'' > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:535:in > `setup_with_fixtures'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:131:in > `create_block_from_parts'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:129:in > `create_block_from_parts'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:47:in > `setup_spec'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:29:in > `run'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:58:in > `run'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:55:in > `run'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:23:in > `run'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:22:in > `run'' > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/command_line.rb:27:in > `run'' > vendor/plugins/rspec/bin/spec:4: > =======================> > FWIW, here is my fixtures file file > > ======> one: > id: 1 > name: LT1 > description: Lecture Theatre 1 > active: 1 > two: > id: 2 > name: LT2 > description: Lecture Theatre 2 > active: 0 > ========> > The schema of the table matches the fields in the YAML file > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Deepak Jois
2007-Feb-13 08:23 UTC
[rspec-users] Error against latest trunk while testing via spec for model
On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> Rails version? svn revision? >I am running edge rails (HEAD) with rspec trunk HEAD.> On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote: > > On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > We need the backtrace. Can you run again with --backtrace > > > > > > > > ==============> > 1) > > TypeError in ''Given a generated venue_spec.rb with fixtures loaded > > fixtures should load two Venues'' > > can''t convert nil into String > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > `join'' > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > `create_fixtures'' > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:250:in > > `create_fixtures'' > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/base.rb:890:in > > `silence'' > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:248:in > > `create_fixtures'' > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:581:in > > `load_fixtures'' > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:535:in > > `setup_with_fixtures'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:131:in > > `create_block_from_parts'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:129:in > > `create_block_from_parts'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:47:in > > `setup_spec'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:29:in > > `run'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:58:in > > `run'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:55:in > > `run'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:23:in > > `run'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:22:in > > `run'' > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/command_line.rb:27:in > > `run'' > > vendor/plugins/rspec/bin/spec:4: > > =======================> > > > FWIW, here is my fixtures file file > > > > ======> > one: > > id: 1 > > name: LT1 > > description: Lecture Theatre 1 > > active: 1 > > two: > > id: 2 > > name: LT2 > > description: Lecture Theatre 2 > > active: 0 > > ========> > > > The schema of the table matches the fields in the YAML file > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy
2007-Feb-13 09:18 UTC
[rspec-users] Error against latest trunk while testing via spec for model
On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote:> On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > Rails version? svn revision? > > > I am running edge rails (HEAD) with rspec trunk HEAD. >We haven''t tested RSpec on Rails with Rails Edge because Rails (or some of its dependencies) seems to exit the ruby interpreter while running the test suite. Until we solve this problem, we cannot ensure compatibility with Edge Rails> > On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote: > > > On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > > We need the backtrace. Can you run again with --backtrace > > > > > > > > > > > ==============> > > 1) > > > TypeError in ''Given a generated venue_spec.rb with fixtures loaded > > > fixtures should load two Venues'' > > > can''t convert nil into String > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > > `join'' > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > > `create_fixtures'' > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:250:in > > > `create_fixtures'' > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/base.rb:890:in > > > `silence'' > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:248:in > > > `create_fixtures'' > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:581:in > > > `load_fixtures'' > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:535:in > > > `setup_with_fixtures'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:131:in > > > `create_block_from_parts'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:129:in > > > `create_block_from_parts'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:47:in > > > `setup_spec'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:29:in > > > `run'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:58:in > > > `run'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:55:in > > > `run'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:23:in > > > `run'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:22:in > > > `run'' > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/command_line.rb:27:in > > > `run'' > > > vendor/plugins/rspec/bin/spec:4: > > > =======================> > > > > > FWIW, here is my fixtures file file > > > > > > ======> > > one: > > > id: 1 > > > name: LT1 > > > description: Lecture Theatre 1 > > > active: 1 > > > two: > > > id: 2 > > > name: LT2 > > > description: Lecture Theatre 2 > > > active: 0 > > > ========> > > > > > The schema of the table matches the fields in the YAML file > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2007-Feb-13 11:23 UTC
[rspec-users] Error against latest trunk while testing via spec for model
On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote: > > On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > Rails version? svn revision? > > > > > I am running edge rails (HEAD) with rspec trunk HEAD.Deepak - please provide revision numbers. HEAD is a moving target.> We haven''t tested RSpec on Rails with Rails Edge because Rails (or > some of its dependencies) seems to exit the ruby interpreter while > running the test suite. > > Until we solve this problem, we cannot ensure compatibility with Edge RailsEven after we solve this problem, we will not ensure compatibility with edge. There is simply no way for us to do that. That said, it is important that we hear about problems so that we can be reasonably up to date when releases of Rails come out, so thanks Deepak for bringing this up. Again, please do include revision numbers in the future. Cheers, David> > > > On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote: > > > > On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > > > We need the backtrace. Can you run again with --backtrace > > > > > > > > > > > > > > ==============> > > > 1) > > > > TypeError in ''Given a generated venue_spec.rb with fixtures loaded > > > > fixtures should load two Venues'' > > > > can''t convert nil into String > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > > > `join'' > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > > > `create_fixtures'' > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:250:in > > > > `create_fixtures'' > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/base.rb:890:in > > > > `silence'' > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:248:in > > > > `create_fixtures'' > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:581:in > > > > `load_fixtures'' > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:535:in > > > > `setup_with_fixtures'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:131:in > > > > `create_block_from_parts'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:129:in > > > > `create_block_from_parts'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:47:in > > > > `setup_spec'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:29:in > > > > `run'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:58:in > > > > `run'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:55:in > > > > `run'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:23:in > > > > `run'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:22:in > > > > `run'' > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/command_line.rb:27:in > > > > `run'' > > > > vendor/plugins/rspec/bin/spec:4: > > > > =======================> > > > > > > > FWIW, here is my fixtures file file > > > > > > > > ======> > > > one: > > > > id: 1 > > > > name: LT1 > > > > description: Lecture Theatre 1 > > > > active: 1 > > > > two: > > > > id: 2 > > > > name: LT2 > > > > description: Lecture Theatre 2 > > > > active: 0 > > > > ========> > > > > > > > The schema of the table matches the fields in the YAML file > > > > _______________________________________________ > > > > rspec-users mailing list > > > > rspec-users at rubyforge.org > > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2007-Feb-13 11:37 UTC
[rspec-users] Error against latest trunk while testing via spec for model
FYI - I just ran our suite and everything related to models ran just fine with the following: RSpec rev 1493 Rails rev 6149 ruby 1.8.5 mysql 4.1 On 2/13/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote: > > > On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > > Rails version? svn revision? > > > > > > > I am running edge rails (HEAD) with rspec trunk HEAD. > > Deepak - please provide revision numbers. HEAD is a moving target. > > > We haven''t tested RSpec on Rails with Rails Edge because Rails (or > > some of its dependencies) seems to exit the ruby interpreter while > > running the test suite. > > > > Until we solve this problem, we cannot ensure compatibility with Edge Rails > > Even after we solve this problem, we will not ensure compatibility > with edge. There is simply no way for us to do that. > > That said, it is important that we hear about problems so that we can > be reasonably up to date when releases of Rails come out, so thanks > Deepak for bringing this up. Again, please do include revision numbers > in the future. > > Cheers, > David > > > > > > > > On 2/13/07, Deepak Jois <deepak.jois at gmail.com> wrote: > > > > > On 2/13/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > > > > We need the backtrace. Can you run again with --backtrace > > > > > > > > > > > > > > > > > ==============> > > > > 1) > > > > > TypeError in ''Given a generated venue_spec.rb with fixtures loaded > > > > > fixtures should load two Venues'' > > > > > can''t convert nil into String > > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > > > > `join'' > > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:251:in > > > > > `create_fixtures'' > > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:250:in > > > > > `create_fixtures'' > > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/base.rb:890:in > > > > > `silence'' > > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:248:in > > > > > `create_fixtures'' > > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:581:in > > > > > `load_fixtures'' > > > > > /home/deepak/personalcode/worlds/config/../vendor/rails/activerecord/lib/active_record/fixtures.rb:535:in > > > > > `setup_with_fixtures'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:131:in > > > > > `create_block_from_parts'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_eval.rb:129:in > > > > > `create_block_from_parts'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:47:in > > > > > `setup_spec'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/specification.rb:29:in > > > > > `run'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:58:in > > > > > `run'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context.rb:55:in > > > > > `run'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:23:in > > > > > `run'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/context_runner.rb:22:in > > > > > `run'' > > > > > /home/deepak/personalcode/worlds/vendor/plugins/rspec/lib/spec/runner/command_line.rb:27:in > > > > > `run'' > > > > > vendor/plugins/rspec/bin/spec:4: > > > > > =======================> > > > > > > > > > FWIW, here is my fixtures file file > > > > > > > > > > ======> > > > > one: > > > > > id: 1 > > > > > name: LT1 > > > > > description: Lecture Theatre 1 > > > > > active: 1 > > > > > two: > > > > > id: 2 > > > > > name: LT2 > > > > > description: Lecture Theatre 2 > > > > > active: 0 > > > > > ========> > > > > > > > > > The schema of the table matches the fields in the YAML file > > > > > _______________________________________________ > > > > > rspec-users mailing list > > > > > rspec-users at rubyforge.org > > > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > > > _______________________________________________ > > > > rspec-users mailing list > > > > rspec-users at rubyforge.org > > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > >
I have conditional logic in my view (I know, obligatory slap on the wrist) so that an add-on stylesheet is linked in for IE users. The code is: <%= stylesheet_link_tag(''ie'', :media => ''screen'') if request.user_agent && request.user_agent =~ /msie/i %> The spec is: specify "should display index page" do get :index response.should_be_success end There is no user_agent in the request object passed to the view. Now, I can change all of this by simply: setup do request.stub!(:user_agent).and_return(''msie'') end but I was wondering if there was a better way? Thanks, Steve
Deepak Jois
2007-Feb-14 00:37 UTC
[rspec-users] Error against latest trunk while testing via spec for model
On 2/13/07, David Chelimsky <dchelimsky at gmail.com> wrote:> FYI - I just ran our suite and everything related to models ran just > fine with the following: > > RSpec rev 1493 > Rails rev 6149 > ruby 1.8.5 > mysql 4.1 >Almost the same for me RSpec rev 1493 Rails rev 6149 ruby 1.8.5 mysql 5.0.27 The error seems to be related to loading the fixture because other specs not related to specs pass as normal. And I can replicate it both on my Mac as well as Linux machines. I could be doing something stupud, but here is my code: The Venue Model: ==class Venue < ActiveRecord::Base validates_uniqueness_of :name, :on => :create, :message => "must be unique" validates_presence_of :name, :description end == The Venue Fixture: ==one: id: 1 name: LT1 description: Lecture Theatre 1 active: 1 two: id: 2 name: LT2 description: Lecture Theatre 2 active: 0 == Spec file using fixtures. As I said above, I have another context where I do not use specs and it works just fine. ===context "Given a generated venue_spec.rb with fixtures loaded" do fixtures :venues specify "fixtures should load two Venues" do Venue.should have(2).records end specify "a new venue cannot have the same name" do v = Venue.new(:name => "LT2", :description => "Lecture Theatre 2 (duplicate)", :active => false) v.should_not_be_valid end end ====
Deepak Jois
2007-Feb-14 00:38 UTC
[rspec-users] Error against latest trunk while testing via spec for model
> The error seems to be related to loading the fixture because other > specs not related to specs pass as normal. >I meant to say "The other specs not loading fixtures pass as normal".
On 2/13/07, s.ross <cwdinfo at gmail.com> wrote:> I have conditional logic in my view (I know, obligatory slap on the > wrist) so that an add-on stylesheet is linked in for IE users. The > code is: > > <%= stylesheet_link_tag(''ie'', :media => ''screen'') if > request.user_agent && request.user_agent =~ /msie/i %> > > The spec is: > > specify "should display index page" do > get :index > response.should_be_success > end > > There is no user_agent in the request object passed to the view. Now, > I can change all of this by simply: > > setup do > request.stub!(:user_agent).and_return(''msie'') > end > > but I was wondering if there was a better way?That seems pretty simple to me. What is bugging you about it?> > Thanks, > > Steve > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Just checking. I guess it just seemed too easy :) What happens when this page renders is a tag like: <link href="/path/to/my/stylesheet.css?123453498"> Or something like that with the Rails asset tagging. What I want to do is test that I''m responding to the user agent string correctly using a matcher that looks for the filename, but disregards the asset tag: response.should have_tag(''link'', :attributes => {:href => / application.css/}) response.should_not have_tag(''link'', :attributes => {:href => /ie.css/}) However, the "should have" expectations always pass no matter what. Not coincidentally, the "should_not have" ones always fail. I can see, looking at the Rails plugin source that my syntax is broken and that the have_tag expectation was meant more to determine whether the tag exists and how many times it occurs. Is there a matcher that peers into the tag the way the old Test::Unit assertions did? Thanks On Feb 13, 2007, at 4:40 PM, David Chelimsky wrote:> On 2/13/07, s.ross <cwdinfo at gmail.com> wrote: >> I have conditional logic in my view (I know, obligatory slap on the >> wrist) so that an add-on stylesheet is linked in for IE users. The >> code is: >> >> <%= stylesheet_link_tag(''ie'', :media => ''screen'') if >> request.user_agent && request.user_agent =~ /msie/i %> >> >> The spec is: >> >> specify "should display index page" do >> get :index >> response.should_be_success >> end >> >> There is no user_agent in the request object passed to the view. Now, >> I can change all of this by simply: >> >> setup do >> request.stub!(:user_agent).and_return(''msie'') >> end >> >> but I was wondering if there was a better way? > > That seems pretty simple to me. What is bugging you about it? > >> >> Thanks, >> >> Steve >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Deepak Jois
2007-Feb-15 06:25 UTC
[rspec-users] Error against latest trunk while testing via spec for model
> The error seems to be related to loading the fixture because other > specs not related to specs pass as normal. >Ok I know the cause of the error now. It is because the fixtures path is not being passed correctly. turns out that my spec_helper file was outdated, here is a diff. Hope it helps Index: spec/spec_helper.rb ==================================================================--- spec/spec_helper.rb (revision 134) +++ spec/spec_helper.rb (working copy) @@ -1,6 +1,6 @@ # This file is copied to ~/spec when you run ''ruby script/generate rspec'' # from the project root directory. -ENV["RAILS_ENV"] = "test" +ENV["RAILS_ENV"] ||= "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require ''spec/rails'' @@ -10,15 +10,17 @@ # tightly coupled to Test::Unit in Rails, which is why you''re seeing it here. module Spec module Rails - class EvalContext < Test::Unit::TestCase - self.use_transactional_fixtures = true - self.use_instantiated_fixtures = false - self.fixture_path = RAILS_ROOT + ''/spec/fixtures'' + module Runner + class EvalContext < Test::Unit::TestCase + self.use_transactional_fixtures = true + self.use_instantiated_fixtures = false + self.fixture_path = RAILS_ROOT + ''/spec/fixtures'' - # You can set up your global fixtures here, or you - # can do it in individual contexts using "fixtures :table_a, table_b". - # - #self.global_fixtures = :table_a, :table_b + # You can set up your global fixtures here, or you + # can do it in individual contexts using "fixtures :table_a, table_b". + # + #self.global_fixtures = :table_a, :table_b + end end end end
Given this in views/layouts/person.rhtml: <%= stylesheet_link_tag(''ie'', :media => ''screen'') if request.user_agent && request.user_agent =~ /msie/i %> The following passes for me: ===================================context "layout for person w/ user_agent = msie" do setup do request.stub!(:user_agent).and_return(''msie'') render ''layouts/person'' end specify "should have msie stylesheet" do response.should have_tag("link[href*=ie.css]") end specify "should not have firefox stylesheet" do response.should_not have_tag("link[href*=firefox.css]") end end context "layout for person w/ user_agent = firefox" do setup do request.stub!(:user_agent).and_return(''mozilla'') render ''layouts/person'' end specify "should have no link tag" do response.should_not have_tag("link") end end =================================== Take a look at the assert_select cheat sheet for more info: http://labnotes.org/svn/public/ruby/rails_plugins/assert_select/cheat/assert_select.html have_tag just wraps that w/ rspec syntax. Let me know if this helps. Cheers, David On 2/13/07, s.ross <cwdinfo at gmail.com> wrote:> Just checking. I guess it just seemed too easy :) > > What happens when this page renders is a tag like: > > <link href="/path/to/my/stylesheet.css?123453498"> > > Or something like that with the Rails asset tagging. What I want to > do is test that I''m responding to the user agent string correctly > using a matcher that looks for the filename, but disregards the asset > tag: > > response.should have_tag(''link'', :attributes => {:href => / > application.css/}) > response.should_not have_tag(''link'', :attributes => {:href => /ie.css/}) > > However, the "should have" expectations always pass no matter what. > Not coincidentally, the "should_not have" ones always fail. > > I can see, looking at the Rails plugin source that my syntax is > broken and that the have_tag expectation was meant more to determine > whether the tag exists and how many times it occurs. Is there a > matcher that peers into the tag the way the old Test::Unit assertions > did? > > Thanks > > On Feb 13, 2007, at 4:40 PM, David Chelimsky wrote: > > > On 2/13/07, s.ross <cwdinfo at gmail.com> wrote: > >> I have conditional logic in my view (I know, obligatory slap on the > >> wrist) so that an add-on stylesheet is linked in for IE users. The > >> code is: > >> > >> <%= stylesheet_link_tag(''ie'', :media => ''screen'') if > >> request.user_agent && request.user_agent =~ /msie/i %> > >> > >> The spec is: > >> > >> specify "should display index page" do > >> get :index > >> response.should_be_success > >> end > >> > >> There is no user_agent in the request object passed to the view. Now, > >> I can change all of this by simply: > >> > >> setup do > >> request.stub!(:user_agent).and_return(''msie'') > >> end > >> > >> but I was wondering if there was a better way? > > > > That seems pretty simple to me. What is bugging you about it? > > > >> > >> Thanks, > >> > >> Steve > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > >> > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Wait - Steve - that was based on what''s in the trunk. It *might* work w/ 0.7.5.1, but I haven''t tried it. What version are you using? On 2/15/07, David Chelimsky <dchelimsky at gmail.com> wrote:> Given this in views/layouts/person.rhtml: > > <%= stylesheet_link_tag(''ie'', :media => ''screen'') if > request.user_agent && request.user_agent =~ /msie/i %> > > The following passes for me: > > ===================================> context "layout for person w/ user_agent = msie" do > setup do > request.stub!(:user_agent).and_return(''msie'') > render ''layouts/person'' > end > > specify "should have msie stylesheet" do > response.should have_tag("link[href*=ie.css]") > end > > specify "should not have firefox stylesheet" do > response.should_not have_tag("link[href*=firefox.css]") > end > > end > > context "layout for person w/ user_agent = firefox" do > setup do > request.stub!(:user_agent).and_return(''mozilla'') > render ''layouts/person'' > end > > specify "should have no link tag" do > response.should_not have_tag("link") > end > > end > ===================================> > Take a look at the assert_select cheat sheet for more info: > > http://labnotes.org/svn/public/ruby/rails_plugins/assert_select/cheat/assert_select.html > > have_tag just wraps that w/ rspec syntax. > > Let me know if this helps. > > Cheers, > David > > On 2/13/07, s.ross <cwdinfo at gmail.com> wrote: > > Just checking. I guess it just seemed too easy :) > > > > What happens when this page renders is a tag like: > > > > <link href="/path/to/my/stylesheet.css?123453498"> > > > > Or something like that with the Rails asset tagging. What I want to > > do is test that I''m responding to the user agent string correctly > > using a matcher that looks for the filename, but disregards the asset > > tag: > > > > response.should have_tag(''link'', :attributes => {:href => / > > application.css/}) > > response.should_not have_tag(''link'', :attributes => {:href => /ie.css/}) > > > > However, the "should have" expectations always pass no matter what. > > Not coincidentally, the "should_not have" ones always fail. > > > > I can see, looking at the Rails plugin source that my syntax is > > broken and that the have_tag expectation was meant more to determine > > whether the tag exists and how many times it occurs. Is there a > > matcher that peers into the tag the way the old Test::Unit assertions > > did? > > > > Thanks > > > > On Feb 13, 2007, at 4:40 PM, David Chelimsky wrote: > > > > > On 2/13/07, s.ross <cwdinfo at gmail.com> wrote: > > >> I have conditional logic in my view (I know, obligatory slap on the > > >> wrist) so that an add-on stylesheet is linked in for IE users. The > > >> code is: > > >> > > >> <%= stylesheet_link_tag(''ie'', :media => ''screen'') if > > >> request.user_agent && request.user_agent =~ /msie/i %> > > >> > > >> The spec is: > > >> > > >> specify "should display index page" do > > >> get :index > > >> response.should_be_success > > >> end > > >> > > >> There is no user_agent in the request object passed to the view. Now, > > >> I can change all of this by simply: > > >> > > >> setup do > > >> request.stub!(:user_agent).and_return(''msie'') > > >> end > > >> > > >> but I was wondering if there was a better way? > > > > > > That seems pretty simple to me. What is bugging you about it? > > > > > >> > > >> Thanks, > > >> > > >> Steve > > >> _______________________________________________ > > >> rspec-users mailing list > > >> rspec-users at rubyforge.org > > >> http://rubyforge.org/mailman/listinfo/rspec-users > > >> > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > >
Thanks for the reply. I''m about 4 days off trunk, so depending on what you checked in when, I''m pretty current. I''ll mess around with this more. Thanks for the code and the link. Steve On Feb 15, 2007, at 7:58 AM, David Chelimsky wrote:> Wait - Steve - that was based on what''s in the trunk. It *might* work > w/ 0.7.5.1, but I haven''t tried it. > > What version are you using? > > On 2/15/07, David Chelimsky <dchelimsky at gmail.com> wrote: >> Given this in views/layouts/person.rhtml: >> >> <%= stylesheet_link_tag(''ie'', :media => ''screen'') if >> request.user_agent && request.user_agent =~ /msie/i %> >> >> The following passes for me: >> >> ===================================>> context "layout for person w/ user_agent = msie" do >> setup do >> request.stub!(:user_agent).and_return(''msie'') >> render ''layouts/person'' >> end >> >> specify "should have msie stylesheet" do >> response.should have_tag("link[href*=ie.css]") >> end >> >> specify "should not have firefox stylesheet" do >> response.should_not have_tag("link[href*=firefox.css]") >> end >> >> end >> >> context "layout for person w/ user_agent = firefox" do >> setup do >> request.stub!(:user_agent).and_return(''mozilla'') >> render ''layouts/person'' >> end >> >> specify "should have no link tag" do >> response.should_not have_tag("link") >> end >> >> end >> ===================================>> >> Take a look at the assert_select cheat sheet for more info: >> >> http://labnotes.org/svn/public/ruby/rails_plugins/assert_select/ >> cheat/assert_select.html >> >> have_tag just wraps that w/ rspec syntax. >> >> Let me know if this helps. >> >> Cheers, >> David >> >> On 2/13/07, s.ross <cwdinfo at gmail.com> wrote: >>> Just checking. I guess it just seemed too easy :) >>> >>> What happens when this page renders is a tag like: >>> >>> <link href="/path/to/my/stylesheet.css?123453498"> >>> >>> Or something like that with the Rails asset tagging. What I want to >>> do is test that I''m responding to the user agent string correctly >>> using a matcher that looks for the filename, but disregards the >>> asset >>> tag: >>> >>> response.should have_tag(''link'', :attributes => {:href => / >>> application.css/}) >>> response.should_not have_tag(''link'', :attributes => {:href => / >>> ie.css/}) >>> >>> However, the "should have" expectations always pass no matter what. >>> Not coincidentally, the "should_not have" ones always fail. >>> >>> I can see, looking at the Rails plugin source that my syntax is >>> broken and that the have_tag expectation was meant more to determine >>> whether the tag exists and how many times it occurs. Is there a >>> matcher that peers into the tag the way the old Test::Unit >>> assertions >>> did? >>> >>> Thanks >>> >>> On Feb 13, 2007, at 4:40 PM, David Chelimsky wrote: >>> >>>> On 2/13/07, s.ross <cwdinfo at gmail.com> wrote: >>>>> I have conditional logic in my view (I know, obligatory slap on >>>>> the >>>>> wrist) so that an add-on stylesheet is linked in for IE users. The >>>>> code is: >>>>> >>>>> <%= stylesheet_link_tag(''ie'', :media => ''screen'') if >>>>> request.user_agent && request.user_agent =~ /msie/i %> >>>>> >>>>> The spec is: >>>>> >>>>> specify "should display index page" do >>>>> get :index >>>>> response.should_be_success >>>>> end >>>>> >>>>> There is no user_agent in the request object passed to the >>>>> view. Now, >>>>> I can change all of this by simply: >>>>> >>>>> setup do >>>>> request.stub!(:user_agent).and_return(''msie'') >>>>> end >>>>> >>>>> but I was wondering if there was a better way? >>>> >>>> That seems pretty simple to me. What is bugging you about it? >>>> >>>>> >>>>> Thanks, >>>>> >>>>> Steve >>>>> _______________________________________________ >>>>> rspec-users mailing list >>>>> rspec-users at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>>> >>>> _______________________________________________ >>>> rspec-users mailing list >>>> rspec-users at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users