Marcelo de Moraes Serpa
2010-Jun-14 19:05 UTC
[rspec-users] Undefined method respont_to - rspec
Hello list, I have this very simple model spec: require ''spec_helper'' describe Token do describe "Associations" do token = Token.new token.should respond_to(:user) end end When I run it, I get the following error: /spec/models/token_spec.rb:7: undefined method `respond_to'' for Spec::Rails::Example::ModelExampleGroup::Subclass_1::Subclass_1:Class (NoMethodError) Should not respont_to? be defined and rspec automatically add the ? to the method? I am not getting it :S Thanks in advance, Marcelo. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100614/96dfd1df/attachment.html>
It looks like you need to put those lines in an it block. it ''should...'' do token... end Trey On Jun 14, 2010, at 1:05 PM, Marcelo de Moraes Serpa <celoserpa at gmail.com> wrote:> Hello list, > > I have this very simple model spec: > > require ''spec_helper'' > > describe Token do > describe "Associations" do > token = Token.new > token.should respond_to(:user) > end > end > > When I run it, I get the following error: > > /spec/models/token_spec.rb:7: undefined method `respond_to'' for Spec::Rails::Example::ModelExampleGroup::Subclass_1::Subclass_1:Class (NoMethodError) > > Should not respont_to? be defined and rspec automatically add the ? to the method? I am not getting it :S > > Thanks in advance, > > Marcelo. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Marcelo de Moraes Serpa
2010-Jun-14 20:38 UTC
[rspec-users] Undefined method respont_to - rspec
Ah! I thought I could use it / describe / context interchangeably. Thanks, Marcelo. On Mon, Jun 14, 2010 at 3:04 PM, Trey Bean <trey at 12spokes.com> wrote:> It looks like you need to put those lines in an it block. > > it ''should...'' do > token... > end > > Trey > > On Jun 14, 2010, at 1:05 PM, Marcelo de Moraes Serpa > <celoserpa at gmail.com> wrote: > > > Hello list, > > > > I have this very simple model spec: > > > > require ''spec_helper'' > > > > describe Token do > > describe "Associations" do > > token = Token.new > > token.should respond_to(:user) > > end > > end > > > > When I run it, I get the following error: > > > > /spec/models/token_spec.rb:7: undefined method `respond_to'' for > Spec::Rails::Example::ModelExampleGroup::Subclass_1::Subclass_1:Class > (NoMethodError) > > > > Should not respont_to? be defined and rspec automatically add the ? to > the method? I am not getting it :S > > > > Thanks in advance, > > > > Marcelo. > > _______________________________________________ > > 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100614/9b73ae78/attachment.html>
The primary concepts are example groups and examples. An example group is a group of examples. More technically, an example group is a class, and examples are instances of that class. * example_group, context, and describe all mean the same thing. * example, specify, and it all mean the same thing HTH, David On Jun 14, 2010, at 3:38 PM, Marcelo de Moraes Serpa wrote:> Ah! I thought I could use it / describe / context interchangeably. > > Thanks, > > Marcelo. > > On Mon, Jun 14, 2010 at 3:04 PM, Trey Bean <trey at 12spokes.com> wrote: > It looks like you need to put those lines in an it block. > > it ''should...'' do > token... > end > > Trey > > On Jun 14, 2010, at 1:05 PM, Marcelo de Moraes Serpa > <celoserpa at gmail.com> wrote: > > > Hello list, > > > > I have this very simple model spec: > > > > require ''spec_helper'' > > > > describe Token do > > describe "Associations" do > > token = Token.new > > token.should respond_to(:user) > > end > > end > > > > When I run it, I get the following error: > > > > /spec/models/token_spec.rb:7: undefined method `respond_to'' for Spec::Rails::Example::ModelExampleGroup::Subclass_1::Subclass_1:Class (NoMethodError) > > > > Should not respont_to? be defined and rspec automatically add the ? to the method? I am not getting it :S > > > > Thanks in advance, > > > > Marcelo. > > _______________________________________________ > > 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-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100614/ad9bded7/attachment.html>
Marcelo de Moraes Serpa
2010-Jun-14 23:38 UTC
[rspec-users] Undefined method respont_to - rspec
Thanks David and Trey ;) Marcelo. On Mon, Jun 14, 2010 at 4:05 PM, David Chelimsky <dchelimsky at gmail.com>wrote:> The primary concepts are example groups and examples. An example group is a > group of examples. More technically, an example group is a class, and > examples are instances of that class. > > * example_group, context, and describe all mean the same thing. > > * example, specify, and it all mean the same thing > > HTH, > David > > On Jun 14, 2010, at 3:38 PM, Marcelo de Moraes Serpa wrote: > > Ah! I thought I could use it / describe / context interchangeably. > > Thanks, > > Marcelo. > > On Mon, Jun 14, 2010 at 3:04 PM, Trey Bean <trey at 12spokes.com> wrote: > >> It looks like you need to put those lines in an it block. >> >> it ''should...'' do >> token... >> end >> >> Trey >> >> On Jun 14, 2010, at 1:05 PM, Marcelo de Moraes Serpa >> <celoserpa at gmail.com> wrote: >> >> > Hello list, >> > >> > I have this very simple model spec: >> > >> > require ''spec_helper'' >> > >> > describe Token do >> > describe "Associations" do >> > token = Token.new >> > token.should respond_to(:user) >> > end >> > end >> > >> > When I run it, I get the following error: >> > >> > /spec/models/token_spec.rb:7: undefined method `respond_to'' for >> Spec::Rails::Example::ModelExampleGroup::Subclass_1::Subclass_1:Class >> (NoMethodError) >> > >> > Should not respont_to? be defined and rspec automatically add the ? to >> the method? I am not getting it :S >> > >> > Thanks in advance, >> > >> > Marcelo. >> > _______________________________________________ >> > 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100614/e10e9c16/attachment.html>