Bit of a guess but
def build_valid_entities(n=1)
Entity.transaction do
Entity.destroy_all
n.to_i.times do |x|
Entity.create! :entity_name => "Entity #{x}",
:entity_legal_name => "Entity #{n} Legal Name",
:entity_legal_form => "CORP"
end
end
end
Note the x inside the blcok. Probably not a good idea to use same
variable inside and outside block
2008/11/27 James Byrne <[EMAIL PROTECTED]>:
> James Byrne wrote:
>
>> So, depending upon the way cucumber is invoked, either all the tests
>> pass, all the tests are skipped, or some of the tests pass and some fail
>> one way and others pass and fail when invoked another way. This seems
>> problematic for testing and it is far beyond my modest abilities to
>> explain or rectify.
>
> Well, I have localized the source of the error and I have resolved one
> of the causes.
>
> One of the feature tests was to assure that the test table was empty to
> begin with. This was passing under cucumber and rake features while
> failing under autotest. It failed because the testunit tests were
> loading a fixture into that table. This I resolved by changing the
> feature step to destroy_all that table.
>
> The four remaining failures are all located in a test that uses a "More
> Examples" construct. So, in fact, there is just one failing test that
> is hit four times. This test follows:
>
> Feature
> ...
> Scenario: The common name should display with initial capitals
> Given one valid entity
> And I am on the edit entity page
> When I fill in "Common Name" with " ANYThing WronG wITh tHiS? "
> And I commit the update
> Then I should see "Anything Wrong With This?"
> And I should see an update success confirmation
>
> More Examples:
> ...
>
> Steps
>
> ...
> def build_valid_entities(n=1)
> Entity.transaction do
> Entity.destroy_all
> n.to_i.times do |n|
> Entity.create! :entity_name => "Entity #{n}",
> :entity_legal_name => "Entity #{n} Legal Name",
> :entity_legal_form => "CORP"
> end
> end
> end
>
> Given /(\d+) valid entit/ do |n|
> build_valid_entities(n)
> end
>
> Given /one valid entity/ do
> build_valid_entities(1)
> end
>
> Given /I am on the edit entity page/ do
> visits "/entities/1/edit"
> end
> ...
>
> The error is that there exists no entity with id=1. Ideas?
>
> Regards,
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users