vendredi 17 juillet 2015

How to change fixture values inside integration test

I'm writing an integration test and halfway along the test I would like two values for a fixture changed. How can I do this?

I have tried the following:

@organization1.toggle!(:subscription)
@organization1.expires = Time.zone.now + 50.days

However, this does not seem to work. The strange thing is that puts @organization1 and @organization1.expires confirm the new values but puts @response.body which shows the organization's profile still includes the old values. What am I doing wrong?

Part of the test code:

get organization_path(@organization1)
...
@organization1.toggle!(:subscription)
@organization1.expires = Time.zone.now + 50.days

get organization_path(@organization1)

puts @organization1.subscription    # Has the new value
puts @organization1.expires         # Has the new value
puts @response.body                 # Still has the old values

Aucun commentaire:

Enregistrer un commentaire