Coder Social home page Coder Social logo

Comments (4)

tlowrimore avatar tlowrimore commented on June 9, 2024 1

@adomokos

Wow! Thanks so much for the rapid response! This is exactly what I was looking for! I'll give it a go, and once I have a working version, I'd be happy to create a PR for the update to the docs.

Cheers!
Tim

from light-service.

adomokos avatar adomokos commented on June 9, 2024

Hello @tlowrimore!

Thanks for using LightService.

We created the ContextFactory helper for "segmented" outside-in tests. Meaning, when we had 5 actions like this:

[Action1,
Action2,
Action3,
Action4,
Action5]

and we wanted to test Action4, (we had to have a lot of data in the Context, and since we talked to the database anyway as it was fast with database_cleaner transactions) we just executed the pipeline up-to Action3, and used the context in that state at that point in time.

In case you want to call one action in isolation, you can invoke it via the execute method.
See this example for it.

The Context is a more specific Hash, you can initialize it with LightService::Context.make, like in the spec, and then you can add any items your action needs. Invoke execute on your action and assert on the items in the resulting Context.

I am thinking this would be a good paragraph in the README. In case someone would contribute with a small README pr.

Hth.

from light-service.

gee-forr avatar gee-forr commented on June 9, 2024

I had 30 minutes free, so I thought I'd add some docs into the readme about how to run actions in isolation, that led to me turning it into a small "Getting Started" section.

I already have a PR open #194 so I thought I'd sneak it in there, even though it's not strictly related to the PR's content. @tlowrimore, let me know if you'd like me to add anything to the readme. You can see the changes here: 3fe6a63

from light-service.

adomokos avatar adomokos commented on June 9, 2024

Seems like @tlowrimore is happy with the response, closing this issue.

from light-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.