Re: [rspec-users] Can I set subject to its own method call?

2012-01-05 Thread m
Thanks, I was using another way before until I properly read through the rspec doc. I was doing this in another example: let(:instance) { described_class.new() } describe ' subject { instance.parse_log() } its([:duration]){ should == mock_duration} its([:owner]){ should == mock_editor} I guess

Re: [rspec-users] why is 'get :index, :page => 2' different from 'get :index, :page => "2"'

2012-01-05 Thread apneadiving
On Jan 6, 12:55 am, David Chelimsky wrote: > On Thu, Jan 5, 2012 at 5:45 PM, apneadiving > wrote: > > Hi, > > > After coding my app and enjoying a green wave of tests, I had horrible > > feedback about some bugs. > > > Those bugs happened to some well tested parts of my app. > > > After some res

Re: [rspec-users] why is 'get :index, :page => 2' different from 'get :index, :page => "2"'

2012-01-05 Thread David Chelimsky
On Thu, Jan 5, 2012 at 5:45 PM, apneadiving wrote: > Hi, > > After coding my app and enjoying a green wave of tests, I had horrible > feedback about some bugs. > > Those bugs happened to some well tested parts of my app. > > After some research, I found out that > > get :index, :page => 2, :per_pa

[rspec-users] why is 'get :index, :page => 2' different from 'get :index, :page => "2"'

2012-01-05 Thread apneadiving
Hi, After coding my app and enjoying a green wave of tests, I had horrible feedback about some bugs. Those bugs happened to some well tested parts of my app. After some research, I found out that get :index, :page => 2, :per_page => 5 is different from: get :index, :page => "2", :per_page =>

Re: [rspec-users] Can I set subject to its own method call?

2012-01-05 Thread Andrew Timberlake
Why don't you use let: describe MyClass do # Will set subject to an instance of MyClass context '#parse_input' do let(:input) { subject.parse_input } # calling input in your specs will now return the result of parse_input it 'is a hash' do input.shoul

[rspec-users] Can I set subject to its own method call?

2012-01-05 Thread m
The symbol "subject" by default is an instance of the described class. In some method testing I often want to set the subject to be a method call to the instance, for example "city.parse_input()". I tried to do describe '#parse_input' do subject{ subject.parse_input() } #returns hash ... end but