how could a check not been done with all assertions set to true? - eiffel

Running a debug session with estudio with all assertions set to true (I checked into cluster, common target, specific target, etc.) pass over a check assertion?
I also tried to remove EIFGENs and recompile the whole project.

Related

Only allow page.save_screenshot if a window exists?

My Capybara tests are designed to call page.save_screenshot if an example fails. This is configured in a config.after(:each) block in my spec_helper.
However, not all of my tests always have a window open. Long story short, some of my tests may make a few requests using rest-client and then pass/fail based on some rspec expectations. When these type of tests fail, a browser window opens because of the call to page.save_screenshot.
Is there a way to add a conditional so that saving a screenshot is only attempted when there is a window (headless or non-headless) open?
You can probable do something like
page.save_screenshot if page.current_window.exists?
however the best options would really be to make tests that don't use the browser a different type of test (not system or feature) or add metadata to the test so that metadata can be used to determine whether or not the test uses the browser
# In your tests
it 'does something not using the browser', :no_browser do
...
end
# In your spec_helper
config.after(:each) do |example|
page.save_screenshot unless example.metadata[:no_browser]
end

SSRS Security settings using ReportService2010 - .GetPolicies InheritParent value

I need to check and add permissions on lots of folders, I was looking into using ReportService2010, but I have doubt regarding inheritance of security settings. In all examples I found online they are using:
$inheritParent = $true
in method
.GetPolicies($reportFolder, [ref]$inheritParent)
but this is not always the case.. sometimes folders have security setting independent from parent. Is there a way to check this setting using same assembly?
I have some doubts what exactly this does, I ran the same with $false and results were the same. Still I'd like to avoid breaking something when adding new user to folder.
I checked GetProperties and GetPermissions methods, but they do not return value I was looking for.
$inheritParent has to be initialized before it can be used with .GetPolicies. As you've already discovered, it doesn't matter what value you use. You can even set it to $null if you like, which might make it less confusing. You'll want to check the value after the call is made to determine if the policies returned are inherited or not.
The code found at https://github.com/microsoft/ReportingServicesTools might be useful to you. You can use it in its entirety or just as a reference.

Dynamically registering and unregistering Nancy routes/modules

We have a situation where our app has a number of modules that implement an api. Each of these modules has a dependency that in turn depends on a data directory path being properly configured. These modules should not even be constructed until this path is configured.
We also have a module that implements the setting and validation of the configuration, including configuring the aforementioned path.
We would like to somehow 'disable' the data modules until such time as the config can be confirmed. The config would be confirmed by, for example, at start up we check that the data directory exists and is valid. Additionally when a user saves changes through the config module we would again do that confirmation. To recap, the user sets the data directory and then the data modules all get enabled. When the user sets an invalid data directory (or we start up and the existing one is invalid) the modules all get disabled.
We tried registering a handler on the pipelines.BeforeRequest but it didn't help. We're actually failing much earlier, when Nancy is instantiating our modules as part of populating a RouteCache. We need to prevent this instantiation until we can confirm we're configured.
It seems like we ought to be able to say "use this set of modules when some condition is true, and use this other set when the condition is false." How does one go about something like this in Nancy?
If all these modules you are referring to implement the same API (i.e. define the same set of Method + Pattern + Action handlers) then perhaps you should use just one module to handle the requests for all of them, and use a capture segment variable (e.g. "/{path}/api/operation/") in your module's pattern to identify which path (i.e. data directory) you are referring to.
Then, in the body of the action, you could check whether the conditions you need are satisfied. Something like this:
Get["/app/{directory}/api/status"] = parameters => {
var dataDirectory = parameters.directory;
// Do whatever condition checks you need with the dataDirectory value
// and return the appropriate HTTP status code if they are not met,
// otherwise continue handling the request
return HttpStatus.OK;
}
Another approach would be (again if using a single module to handle all these requests) to use a custom route parameter constraint (see https://github.com/NancyFx/Nancy/wiki/Defining-routes#custom-constraints).
In this case if your conditions are not met, the route will not be hit at all.

What is a 'Pending Patch' in RTC source control

Within my 'Pending Changes' view I see this :
What are 'Pending Patches' and how are they created ? I think someone may have inadvertently created it. I do not seem to have the options to see what files have changed, should I not have this option ?
A pending Patch is a diff waiting to be applied in your local workspace.
It can be the result of a merge, or the explicit removal of a changeset ("Suspend"), put aside as a "Patch" (again, a diff), in order to clear the current local workspace of a modification you don't want to apply just yet.
You can also create one when accepting an incoming changet:
Accepting a change set will work when all previous change sets it depends on are present in your repository workspace.
When one of those change sets is missing then there is a gap in history.
RTC SCM prevents an accept from completing in this scenario.
There are two options to get the change into your repository workspace:
Accept the change sets that will fill the gap. This may be as simple as accepting all incoming changes if the change set you want is in your incoming changes.
Accept the change set and select the option to accept as a patch.
This will create changes that you can merge into your Eclipse workspace and check-in. A new change set would be created that will not depend on the change sets that would fill the gap.
The Help page explains how to create a patch.
Note that there is no easy way to get the same feature in ClearCase.
See:
"Is there RTC-equivalent “Suspend mode” in ClearCase?"
"git stash equivalents in other revision control systems?"

Mercurial pre-merge hook

Is there a way to do some checks before allowing a merge in Mercurial?
I have found the pre-update hook and have a script that runs before an update is allowed, by adding the following to ~/.hg/hgrc:
[hooks]
pre-update = ~/hg_pre_update.sh
But I'd like to run the check before allowing a merge as well, and currently it just allows the merge to go through without running my checks.
Background
In case there are alternative ways to solve the problem...
We have been having a number of problems with 'lost' edits under Mercurial. I've tracked down most of them now to the same underlying cause: someone has vim edit sessions open while either they or someone else does a hg update or merge. The editor warns the file has changed externally, the user ignores the warning and saves their changes.
When these changes are committed, for Mercurial there is nothing controversial. The user has simply reverted all the changes brought in with the last update and put in their own changes.
Some time later, we notice the code has gone walkabouts. Cue assorted insults flung the way of mercurial...
Set vim to autoreload changes if no local changes where done. (otherwise ask, or force a merge)
that's how I avoid such issues in any editor...
Sorry just worked out there is a pre-merge hook that works just the same as pre-update. I tried it before asking the question, but now just looking at my hgrc I realise I put the script being called for that hook to ~/hg_pre_merge.sh which doesn't exist.
I can't find the existence of pre-merge documented anywhere but still feeling like a bit of a muppet now.

Resources