I am trying to follow this tutorial - http://www.lukeredpath.co.uk/2006/8/29/developing-a-rails-model-using-bdd-and-rspec-part-1 I installed the Rspec gem but I can''t install the RSpec On Rails plugin (the url is not goood). 1. the URL for the RSpec On Rails plugin is not good so I can''t install it. 2. What is the usage of this plugin? I think that it let me generate Rspec files like this: script/generate rspec_model User but I am not sure. 3. What is the different between a gem and a plugin? here is my guess: a gem is global to my machine and a plugin is added to a specific project. a plugin adds a generator to my project. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8/5/07, oren <orengolan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am trying to follow this tutorial - > http://www.lukeredpath.co.uk/2006/8/29/developing-a-rails-model-using-bdd-and-rspec-part-1 > > I installed the Rspec gem but I can''t install the RSpec On Rails > plugin (the url is not goood). > > 1. the URL for the RSpec On Rails plugin is not good so I can''t > install it.See http://rspec.rubyforge.org/documentation/rails/install.html for current information. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
great. it works. now i am facing this problem- I get this error when running Rspec- NoMethodError in ''A user (in general) should be invalid without a username'' undefined method `should_not_be_valid'' for #<User:0xb6fdbd4c> ./spec/models/user_spec.rb:9: #the model - user.rb class User < ActiveRecord::Base validates_presence_of :username end #the migration file - 001_create_users.rb this is my migration file: class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.column :first_name, :string t.column :last_name, :string t.column :email, :string t.column :description, :string t.column :username, :string t.column :encrypted_password, :string t.column :salt, :string end end def self.down drop_table :users end end #the rpec file - user_spec.rb require File.dirname(__FILE__) + ''/../spec_helper'' context "A user (in general)" do setup do @user = User.new end specify "should be invalid without a username" do @user.should_not_be_valid end end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8/6/07, oren <orengolan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > great. it works. > now i am facing this problem- > I get this error when running Rspec- > NoMethodError in ''A user (in general) should be invalid without a > username'' > undefined method `should_not_be_valid'' for #<User:0xb6fdbd4c> > ./spec/models/user_spec.rb:9:You must reading some old docs. Try this: user.should_not be_valid (no _ between not and be)> > #the model - user.rb > class User < ActiveRecord::Base > validates_presence_of :username > end > > #the migration file - 001_create_users.rb > this is my migration file: > class CreateUsers < ActiveRecord::Migration > def self.up > create_table :users do |t| > t.column :first_name, :string > t.column :last_name, :string > t.column :email, :string > t.column :description, :string > t.column :username, :string > t.column :encrypted_password, :string > t.column :salt, :string > end > end > > def self.down > drop_table :users > end > end > > #the rpec file - user_spec.rb > require File.dirname(__FILE__) + ''/../spec_helper'' > > context "A user (in general)" do > setup do > @user = User.new > end > > specify "should be invalid without a username" do > @user.should_not_be_valid > end > end > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks David, it works. and I also found a nice notification popup for my ubuntu: http://snakesgemscoffee.blogspot.com/2007/07/marrying-autotest-with-rspec-on-gnome.html On 8/6/07, David Chelimsky <dchelimsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 8/6/07, oren <orengolan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > great. it works. > > now i am facing this problem- > > I get this error when running Rspec- > > NoMethodError in ''A user (in general) should be invalid without a > > username'' > > undefined method `should_not_be_valid'' for #<User:0xb6fdbd4c> > > ./spec/models/user_spec.rb:9: > > You must reading some old docs. Try this: > > user.should_not be_valid > > (no _ between not and be) > > > > > #the model - user.rb > > class User < ActiveRecord::Base > > validates_presence_of :username > > end > > > > #the migration file - 001_create_users.rb > > this is my migration file: > > class CreateUsers < ActiveRecord::Migration > > def self.up > > create_table :users do |t| > > t.column :first_name, :string > > t.column :last_name, :string > > t.column :email, :string > > t.column :description, :string > > t.column :username, :string > > t.column :encrypted_password, :string > > t.column :salt, :string > > end > > end > > > > def self.down > > drop_table :users > > end > > end > > > > #the rpec file - user_spec.rb > > require File.dirname(__FILE__) + ''/../spec_helper'' > > > > context "A user (in general)" do > > setup do > > @user = User.new > > end > > > > specify "should be invalid without a username" do > > @user.should_not_be_valid > > end > > end > > > > > > > > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Chelimsky wrote:> On 8/6/07, oren <orengolan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> great. it works. >> now i am facing this problem- >> I get this error when running Rspec- >> NoMethodError in ''A user (in general) should be invalid without a >> username'' >> undefined method `should_not_be_valid'' for #<User:0xb6fdbd4c> >> ./spec/models/user_spec.rb:9: > > You must reading some old docs. Try this: > > user.should_not be_valid > > (no _ between not and be)David, I''m working through the same tutorial and can''t get part of the spec to fail. There''s probably a simple explanation for it, but it doesn''t make much sense to me at the moment. I tried changing the error message checked for and it had not affect. It should have failed. Here''s the code: ################################################################ class User < ActiveRecord::Base validates_presence_of :username , :message => "is required" end ################################################################ require File.dirname(__FILE__) + ''/../spec_helper'' describe User do before do @user = User.new end it "should be invalid without a username" do @user.should_not be_valid @user.errors.on(:username).should equal?("is _this_should_fail_ required") @user.username = ''someusername'' @user.should be_valid end after do @user = nil end end ################################################################ Does anyone know what''s missing? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8/16/07, Cody Skidmore <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > David Chelimsky wrote: > > On 8/6/07, oren <orengolan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > >> great. it works. > >> now i am facing this problem- > >> I get this error when running Rspec- > >> NoMethodError in ''A user (in general) should be invalid without a > >> username'' > >> undefined method `should_not_be_valid'' for #<User:0xb6fdbd4c> > >> ./spec/models/user_spec.rb:9: > > > > You must reading some old docs. Try this: > > > > user.should_not be_valid > > > > (no _ between not and be) > > David, I''m working through the same tutorial and can''t get part of the > spec to fail. There''s probably a simple explanation for it, but it > doesn''t make much sense to me at the moment. I tried changing the error > message checked for and it had not affect. It should have failed. > Here''s the code: > > ################################################################ > class User < ActiveRecord::Base > validates_presence_of :username , :message => "is required" > end > ################################################################ > require File.dirname(__FILE__) + ''/../spec_helper'' > > describe User do > before do > @user = User.new > end > > it "should be invalid without a username" do > @user.should_not be_valid > @user.errors.on(:username).should equal?("is _this_should_fail_ > required")Get rid of the question mark: @user.errors.on(:username).should equal("is _this_should_fail_required") Also - keep in mind that rspec has 3 equality matchers: equal(expected) eql(expected) == expected Each one works like the corresponding ruby method. So ... "this".should equal("this") will fail, because "this".equal?("this") would fail.> @user.username = ''someusername'' > @user.should be_valid > end > > after do > @user = nil > end > end > ################################################################ > > Does anyone know what''s missing? > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Chelimsky wrote:> Get rid of the question mark: > > @user.errors.on(:username).should equal("is _this_should_fail_required") > > Also - keep in mind that rspec has 3 equality matchers: > > equal(expected) > eql(expected) > == expected > > Each one works like the corresponding ruby method. So ... > > "this".should equal("this") > > will fail, because "this".equal?("this") would fail.Thank you Sir. That did the trick. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---