Forum: RSpec Using Rspec for web tests

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Peter Nicolai Motzfeldt (Guest)
on 2008-12-02 18:02
(Received via mailing list)
Hi, I am trying to use Rspec together with FunFX for Flex testing. To
ease
the number of tests and the functionality each test does, I would like
to
run all the it "shoulds..." in sequence.

This works just fine, but the creation of FunFX is created after each it
"should..." and no wonder since I create it in the before method.

But my question is where should I put the two lines of code that creates
an
instance of FunFx so that all the it "should .. " uses the same @flex
instance, that should be created just once in for each describe?

describe "DemoApp" do
  before do
    browser.goto(DEMO_APP)
    @flex = browser.flex_app('DemoAppId', 'DemoAppName')
  end

  it "should click on a checkbox" do
   # do somthing
  end

  it "should assert that it is checked" do
    # do something
  end
end

- Peter
David C. (Guest)
on 2008-12-02 18:19
(Received via mailing list)
On Tue, Dec 2, 2008 at 10:00 AM, Peter Nicolai Motzfeldt
<removed_email_address@domain.invalid> wrote:
> Hi, I am trying to use Rspec together with FunFX for Flex testing. To ease
> the number of tests and the functionality each test does, I would like to
> run all the it "shoulds..." in sequence.
>
> This works just fine, but the creation of FunFX is created after each it
> "should..." and no wonder since I create it in the before method.
>
> But my question is where should I put the two lines of code that creates an
> instance of FunFx so that all the it "should .. " uses the same @flex
> instance, that should be created just once in for each describe?

before(:all)

http://rspec.info/documentation/before_and_after.html

Cheers,
David
This topic is locked and can not be replied to.