Hillary Hueter
2012-Mar-28 22:11 UTC
[rspec-users] validating if a cell has any of the options.
I''m testing the filter on a table. One of the filter options is "Show All". So for my other tests I''ve been looping through the rows and seeing if the table cell that contains the status doesn''t include text (cell.should_not == ''Active''). However when the filter is set to all it can include any of the three statuses (Active, Inactive, Deleted). Using any of the rspec matchers how can I validate this? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120328/e1a79035/attachment.html>
David Chelimsky
2012-Mar-29 11:45 UTC
[rspec-users] validating if a cell has any of the options.
On Wed, Mar 28, 2012 at 5:11 PM, Hillary Hueter <weimar1927 at gmail.com> wrote:> I''m testing the filter on a table. One of the filter options is "Show All". > So for my other tests I''ve been looping through the rows and seeing if the > table cell that contains the status doesn''t include text (cell.should_not => ''Active'').Please post one of these examples so we can see precisely what you''re already doing. Thx, David> However when the filter is set to all it can include any of the three > statuses (Active, Inactive, Deleted). > > Using any of the rspec matchers how can I validate this?
Hillary Hueter
2012-Mar-30 16:52 UTC
[rspec-users] validating if a cell has any of the options.
The example as it exists today: it "should show all applications" do I.new do |c| c.login_flow(:userid => $support, :password => $password) ## Logs in c.manage_application_page.filter.when_present.flash c.manage_application_page.filter.when_present.select_value("All") ## Checks that the dropdown exists and changes it to "Show All Applications" #Assertion c.manage_application_page.applications_table.tr.each do | cell | if ["Active", "Inactive", "Deleted"].include? cell.text() puts cell.text() end end end end An example of the other tests: it "should show all active applications" do ### Checking the Application Filter "Show All Active Applications" is working properly Insight.new do |c| c.login_flow(:userid => $support, :password => $password) ## Logs in c.manage_application_page.filter.when_present.flash c.manage_application_page.filter.when_present.select_value("AllActive") ## Checks that the dropdown exists and changes it to "Show All Active Applications" #Assertion c.manage_application_page.applications_table.tr.each do |cell| cell.text.should_not == ''Deleted'' cell.text.should_not == ''Inactive'' end end end On Thursday, March 29, 2012 4:45:21 AM UTC-7, dchel... at gmail.com wrote:> > On Wed, Mar 28, 2012 at 5:11 PM, Hillary Hueter <weimar1927 at gmail.com> > wrote: > > I''m testing the filter on a table. One of the filter options is "Show > All". > > So for my other tests I''ve been looping through the rows and seeing if > the > > table cell that contains the status doesn''t include text > (cell.should_not => > ''Active''). > > Please post one of these examples so we can see precisely what you''re > already doing. > > Thx, > David > > > However when the filter is set to all it can include any of the three > > statuses (Active, Inactive, Deleted). > > > > Using any of the rspec matchers how can I validate this? > _______________________________________________ > 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/20120330/b15a5e72/attachment.html>
Justin Ko
2012-Mar-31 00:30 UTC
[rspec-users] validating if a cell has any of the options.
On Mar 30, 2012, at 10:52 AM, Hillary Hueter wrote:> > The example as it exists today: > it "should show all applications" do > I.new do |c| > c.login_flow(:userid => $support, :password => $password) ## Logs in > c.manage_application_page.filter.when_present.flash > c.manage_application_page.filter.when_present.select_value("All") ## Checks that the dropdown exists and changes it to "Show All Applications" > #Assertion > c.manage_application_page.applications_table.tr.each do | cell | > if ["Active", "Inactive", "Deleted"].include? cell.text() > puts cell.text() > end > end > end > end > > An example of the other tests: > > it "should show all active applications" do ### Checking the Application Filter "Show All Active Applications" is working properly > Insight.new do |c| > c.login_flow(:userid => $support, :password => $password) ## Logs in > c.manage_application_page.filter.when_present.flash > c.manage_application_page.filter.when_present.select_value("AllActive") ## Checks that the dropdown exists and changes it to "Show All Active Applications" > #Assertion > c.manage_application_page.applications_table.tr.each do |cell| > cell.text.should_not == ''Deleted'' > cell.text.should_not == ''Inactive'' > end > end > end > > > > > On Thursday, March 29, 2012 4:45:21 AM UTC-7, dchel... at gmail.com wrote: > On Wed, Mar 28, 2012 at 5:11 PM, Hillary Hueter <weimar1927 at gmail.com> wrote: > > I''m testing the filter on a table. One of the filter options is "Show All". > > So for my other tests I''ve been looping through the rows and seeing if the > > table cell that contains the status doesn''t include text (cell.should_not => > ''Active''). > Please post one of these examples so we can see precisely what you''re > already doing. > > Thx, > David > > > However when the filter is set to all it can include any of the three > > statuses (Active, Inactive, Deleted). > > > > Using any of the rspec matchers how can I validate this? > _______________________________________________ > 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-usersIf you''re trying to verify that a string can be *any* of some things, I would go with something like this: "foo".should match Regexp.union(''Active'', ''Inactive'', ''Deleted'') That is the same as: "foo".should match /Active|Inactive|Deleted/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120330/58bac11d/attachment.html>
Hillary Hueter
2012-Apr-06 22:18 UTC
[rspec-users] validating if a cell has any of the options.
thanks. On Friday, March 30, 2012 5:30:28 PM UTC-7, Justin Ko wrote:> > > On Mar 30, 2012, at 10:52 AM, Hillary Hueter wrote: > > > The example as it exists today: > it "should show all applications" do > I.new do |c| > c.login_flow(:userid => $support, :password => $password) ## Logs in > c.manage_application_page.filter.when_present.flash > c.manage_application_page.filter.when_present.select_value("All") ## > Checks that the dropdown exists and changes it to "Show All Applications" > #Assertion > c.manage_application_page.applications_table.tr.each do | cell | > if ["Active", "Inactive", "Deleted"].include? cell.text() > puts cell.text() > end > end > end > end > > An example of the other tests: > > it "should show all active applications" do ### Checking the > Application Filter "Show All Active Applications" is working properly > Insight.new do |c| > c.login_flow(:userid => $support, :password => $password) ## Logs in > c.manage_application_page.filter.when_present.flash > > c.manage_application_page.filter.when_present.select_value("AllActive") ## > Checks that the dropdown exists and changes it to "Show All Active > Applications" > #Assertion > c.manage_application_page.applications_table.tr.each do |cell| > cell.text.should_not == ''Deleted'' > cell.text.should_not == ''Inactive'' > end > end > end > > > > > On Thursday, March 29, 2012 4:45:21 AM UTC-7, dchel... at gmail.com wrote: >> >> On Wed, Mar 28, 2012 at 5:11 PM, Hillary Hueter <weimar1927 at gmail.com> >> wrote: >> > I''m testing the filter on a table. One of the filter options is "Show >> All". >> > So for my other tests I''ve been looping through the rows and seeing if >> the >> > table cell that contains the status doesn''t include text >> (cell.should_not =>> > ''Active''). >> >> Please post one of these examples so we can see precisely what you''re >> already doing. >> >> Thx, >> David >> >> > However when the filter is set to all it can include any of the three >> > statuses (Active, Inactive, Deleted). >> > >> > Using any of the rspec matchers how can I validate this? >> _______________________________________________ >> 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 > > > If you''re trying to verify that a string can be *any* of some things, I > would go with something like this: > > "foo".should match Regexp.union(''Active'', ''Inactive'', ''Deleted'') > > That is the same as: > > "foo".should match /Active|Inactive|Deleted/ > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120406/9a847abf/attachment.html>