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...@gmail.com wrote:
> On Wed, Mar 28, 2012 at 5:11 PM, Hillary Hueter <weimar1...@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@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
> 
> 
> 
> _______________________________________________
> rspec-users mailing list
> rspec-users@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/


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to