CFC-Servers / CFC-Servers/GLuaTest
Allow stubs to replace non-function values too
- Dominant language
- Lua
- Stars
- 87
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Sometimes you want to stub non-function values, like convars, strings, etc. from tables. Right now, you'd have to manually keep track of and clean up the changes:
```lua
{
name = "Example"
func = function( state )
state.original_foo = state.original_foo or myProject.foo
myProject.foo = "bar"
expect( myProject:returnFoo() ).to.equal( "bar" )
end,
cleanup = function( state )
myProject.foo = state.original_foo
end
}
```
It would be nice if we could do:
```lua
{
name = "Example"
func = function( state )
stub( myProject, "foo" ).with( "bar" )
expect( myProject:returnFoo() ).to.equal( "bar" )
end
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.