Hi, I''m using a expectation like this : repository.should_receive(:add_gem).with("test.txt", :anything) When I run my spec, it fails with the following message : Spec::Mocks::MockExpectationError in ''MiniGemServer should add a new gem to the repository after it has been uploaded'' #<MiniGemServer::Repository:0xb11164> expected :add_gem with ("test.txt", :anything) but received it with ("test.txt", "C:/DOCUME~1/xyzuser/LOCALS~1/Temp/RackMultipart20081113-8392-1vodbzf-0") Shouldn''t it be working? The first argument is the same and I don''t really care about the second one as long as it is there. I also tried to replace :anything with :string and got the same error. Any idea why I get this? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081113/fe6a9f55/attachment.html>
On Thu, Nov 13, 2008 at 7:38 AM, Emmanuel Pirsch <emmanuel at pirsch.org> wrote:> Hi, > > I''m using a expectation like this : > repository.should_receive(:add_gem).with("test.txt", :anything)Try the anything() method. Support for symbols as argument matchers was deprecated and removed. Are you still seeing docs somewhere that talk about using symbols?> > When I run my spec, it fails with the following message : > Spec::Mocks::MockExpectationError in ''MiniGemServer should add a new gem to > the repository after it has been uploaded'' > #<MiniGemServer::Repository:0xb11164> expected :add_gem with ("test.txt", > :anything) but received it with ("test.txt", > "C:/DOCUME~1/xyzuser/LOCALS~1/Temp/RackMultipart20081113-8392-1vodbzf-0") > > Shouldn''t it be working? The first argument is the same and I don''t really > care about the second one as long as it is there. I also tried to replace > :anything with :string and got the same error. > > Any idea why I get this? > > Thanks! > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Thu, Nov 13, 2008 at 10:38 AM, Emmanuel Pirsch <emmanuel at pirsch.org> wrote:> Hi, > > I''m using a expectation like this : > repository.should_receive(:add_gem).with("test.txt", :anything) > > When I run my spec, it fails with the following message : > Spec::Mocks::MockExpectationError in ''MiniGemServer should add a new gem to > the repository after it has been uploaded'' > #<MiniGemServer::Repository:0xb11164> expected :add_gem with ("test.txt", > :anything) but received it with ("test.txt", > "C:/DOCUME~1/xyzuser/LOCALS~1/Temp/RackMultipart20081113-8392-1vodbzf-0") > > Shouldn''t it be working? The first argument is the same and I don''t really > care about the second one as long as it is there. I also tried to replace > :anything with :string and got the same error. > > Any idea why I get this? >Did you tried "anything" (not a symbol) instead? -- Luis Lavena AREA 17 - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams
On 13 Nov 2008, at 13:42, David Chelimsky wrote:> On Thu, Nov 13, 2008 at 7:38 AM, Emmanuel Pirsch > <emmanuel at pirsch.org> wrote: >> Hi, >> >> I''m using a expectation like this : >> repository.should_receive(:add_gem).with("test.txt", :anything) > > Try the anything() method. Support for symbols as argument matchers > was deprecated and removed. > > Are you still seeing docs somewhere that talk about using symbols?I know I always go on about this (and never do anything about it) but the symbols are still all over the docs: http://rspec.info/documentation/mocks/message_expectations.html> Argument Constraints > > Constraints can be placed on individual arguments which are looser > than value > equivalence (as above). > :anything > > accepts any value for this argument, e.g.: > > my_mock.should_receive(:msg).with(1, :anything, "A")cheers, Matt
On Thu, Nov 13, 2008 at 7:44 AM, Matt Wynne <matt at mattwynne.net> wrote:> On 13 Nov 2008, at 13:42, David Chelimsky wrote: >> >> On Thu, Nov 13, 2008 at 7:38 AM, Emmanuel Pirsch <emmanuel at pirsch.org> >> wrote: >>> >>> Hi, >>> >>> I''m using a expectation like this : >>> repository.should_receive(:add_gem).with("test.txt", :anything) >> >> Try the anything() method. Support for symbols as argument matchers >> was deprecated and removed. >> >> Are you still seeing docs somewhere that talk about using symbols? > > I know I always go on about this (and never do anything about it) but the > symbols are still all over the docs: > http://rspec.info/documentation/mocks/message_expectations.html > >> Argument Constraints >> >> Constraints can be placed on individual arguments which are looser than >> value >> equivalence (as above). >> :anything >> >> accepts any value for this argument, e.g.: >> >> my_mock.should_receive(:msg).with(1, :anything, "A")carapola! There is just no time for the present. Update coming shortly.> > cheers, > Matt > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Great, it worked! Here is where I found the doc which talk about using symbols : http://rspec.info/documentation/mocks/message_expectations.html Thanks! On Thu, Nov 13, 2008 at 8:42 AM, David Chelimsky <dchelimsky at gmail.com>wrote:> On Thu, Nov 13, 2008 at 7:38 AM, Emmanuel Pirsch <emmanuel at pirsch.org> > wrote: > > Hi, > > > > I''m using a expectation like this : > > repository.should_receive(:add_gem).with("test.txt", :anything) > > Try the anything() method. Support for symbols as argument matchers > was deprecated and removed. > > Are you still seeing docs somewhere that talk about using symbols? > > > > > When I run my spec, it fails with the following message : > > Spec::Mocks::MockExpectationError in ''MiniGemServer should add a new gem > to > > the repository after it has been uploaded'' > > #<MiniGemServer::Repository:0xb11164> expected :add_gem with ("test.txt", > > :anything) but received it with ("test.txt", > > "C:/DOCUME~1/xyzuser/LOCALS~1/Temp/RackMultipart20081113-8392-1vodbzf-0") > > > > Shouldn''t it be working? The first argument is the same and I don''t > really > > care about the second one as long as it is there. I also tried to replace > > :anything with :string and got the same error. > > > > Any idea why I get this? > > > > Thanks! > > > > > > > > _______________________________________________ > > 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/20081113/5663c25e/attachment.html>
On Thu, Nov 13, 2008 at 7:45 AM, Emmanuel Pirsch <emmanuel at pirsch.org> wrote:> Great, it worked! > > Here is where I found the doc which talk about using symbols : > http://rspec.info/documentation/mocks/message_expectations.htmlFixed. Sorry for the misinformation and thanks for the heads up. Cheers, David> > Thanks! > > On Thu, Nov 13, 2008 at 8:42 AM, David Chelimsky <dchelimsky at gmail.com> > wrote: >> >> On Thu, Nov 13, 2008 at 7:38 AM, Emmanuel Pirsch <emmanuel at pirsch.org> >> wrote: >> > Hi, >> > >> > I''m using a expectation like this : >> > repository.should_receive(:add_gem).with("test.txt", :anything) >> >> Try the anything() method. Support for symbols as argument matchers >> was deprecated and removed. >> >> Are you still seeing docs somewhere that talk about using symbols? >> >> > >> > When I run my spec, it fails with the following message : >> > Spec::Mocks::MockExpectationError in ''MiniGemServer should add a new gem >> > to >> > the repository after it has been uploaded'' >> > #<MiniGemServer::Repository:0xb11164> expected :add_gem with >> > ("test.txt", >> > :anything) but received it with ("test.txt", >> > >> > "C:/DOCUME~1/xyzuser/LOCALS~1/Temp/RackMultipart20081113-8392-1vodbzf-0") >> > >> > Shouldn''t it be working? The first argument is the same and I don''t >> > really >> > care about the second one as long as it is there. I also tried to >> > replace >> > :anything with :string and got the same error. >> > >> > Any idea why I get this? >> > >> > Thanks! >> > >> > >> > >> > _______________________________________________ >> > 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 >