RubyMine: Duplicity lines on steps.rb files - ruby-on-rails

I have two files .feature and both are about diferent feature on my system.
Feature A is about Login and Feature B is about Register.
However in both files contains:
And(/^I click on button "([^"]*)"$/) do |arg|
pending
end
When I create the steps.rb one for each .feature, it is accusses duplicity, but the buttons are completely different.
Is there a way to implement two different clicks on the same file step.rb to the same line?

You can create two different scenarios and pass the button's element id inside the double quotes?
I click on button "Login"
I click on button "Login1"
You can have one step definitions and invoke multiple gherkin steps with this way
Creating two step definitions steps for each scenario will lead to duplication when the rubymine tries to auto populate the gherkin steps used.

Related

How to avoid AppBuilder removing pieces of code

I'm working on a Progress-4GL programming environment, based on AppBuilder release 11.6.
Until now I've been changing already existing *.w and *.p files, but now I wanted to created my *.w file from scratch.
I've created a window and I've put a browse, a fill-in field and a button. Now I would like to add an event to that button. In order to do that, I add following lines to the *.w file:
ON CHOOSE OF btn-Start_Query IN FRAME DEFAULT-FRAME
DO:
MESSAGE "button is pushed" VIEW-AS ALERT-BOX.
END.
However, when I save the *.w file, re-open it in the AppBuilder and save the file there again, those lines of code get removed.
I've already understood that, in order to avoid this, I need to "wrap" those lines of code by Scoped-define or Analyze:suspend/resume lines, something like this:
&Scoped-define SELF-NAME btn-Start_Query
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn-Start_Query C-Win
ON CHOOSE OF btn-Start_Query IN FRAME DEFAULT-FRAME
DO:
MESSAGE "button is pushed" VIEW-AS ALERT-BOX.
END.
&ANALYZE-RESUME
However, this seems not to be working.
Can you explain me what exactly I have to do in order avoid my lines of code to be removed?
By the way: I know that I'm working with extremely outdated technology, but I only work here for two weeks, so I don't have the authority to force my boss to change his development environment, just for me.
The recommended approach is to use the Wizards of the AppBuilder to create the trigger block with the required AppBuilder markup for you.
Add the button to the Window
Select the button on the design canvas
Choose the "Edit code" button in the AppBuilder main window (the pencil)
This will create an empty default trigger block (in case of a button, that's the CHOOSE). To create a different event, use the "New..." button in the section editor window.

Turn off TextMate 2.0 snippets

Summary: I write Ruby and Ruby on Rails code using TextMate 2.0 (version 2.0-alpha.9515 currently) and I find I'm accidentally triggering the 'snippets' feature.
Sacrilegious though it might be, I currently don't want to use most of TextMate's advanced features - which means I also don't want to have to learn all about them. But I can't seem to avoid triggering the 'snippets' feature which inserts unwanted text into my code. I'd like to be able to turn the feature off entirely. Or failing that I'd like to be able to disable any snippet that's causing me problems - but in order to do that I'd like to be able to quickly find the relevant entry amongst all the many bundles.
To give an example, I happened to have some variables with names like 'serial_if'. If I hit 'tab' after typing the variable name, TextMate would insert the template for an if statement and I couldn't figure out how to stop it happening. I contacted TextMate's support people and was told that in theory the snippet that's firing could be anywhere. To quote: "We use scopes to determine what bundle items are active at a given time, so items from any bundle could be active and responding to the tab key." I did track the problem down with their help (it was in Ruby > Menu Actions > Declarations). But now I'm noticing that if I hit tab after a colon I get ':key => "value",' inserted. And of course since Ruby 1.9, it's common to put a colon at the end of a variable name in order to use a symbol as a hash key. I haven't found the relevant entry for that yet - and it's not ideal to have to make time to go looking for it.
Is there a way to stop all snippets firing in a way that doesn't involve nuking the feature forever? Or is there a way to quickly find which snippet just fired in order to kill it? Any tips appreciated.
To disable tab triggers (i.e. pressing tab and potentially have a snippet inserted) do:
Edit → Macros → Start Recording (⌥⌘M)
Press tab (⇥)
Edit → Macros → Stop Recording (⌥⌘M)
Edit → Macros → Save Macro… (⌃⌘M)
Select a bundle for where to save your macro
Set key equivalent to tab (⇥)
Press ⌘S to save the macro.
Now pressing tab (⇥) executes the macro (that always insert a tab) instead of TextMate’s default behavior.
If you wish to only disable the feature for ruby then set the macro’s scope selector to source.ruby.
As for how to find which items are inserted, use:
Bundles → Select Bundle Item… (⌃⌘T)
Enter if
Press option-return (⌥↩) to edit the item found

How to Create Multi-Valued List in Team Foundation Server/Microsoft Test Manager?

I am working on VSTS 2010 and using Microsoft Test Manager to manage our team's test cases. I just want to add a custom field for Test Categories (with values like BVT, FVT, Regression etc..) to the existing Test case template by following the steps here and here. But I am not able to select multiple values. I am able to create a drop down list with one of these values can be selected but not more than one. but since a test case can be part of more than one test category, how can I make this possible?
My steps:
In Process Editor, Work item types I Create a new field called Test Category with Ref Name as MyCustomField
In Rules, I selected AllowedValues as BVT, FVT, Regression.
After that, In Layout tab created a new control with name Test Categories
4.The field name of the control is set to MyCustomField
When I checked in MTM to create a new test case, the control is showing as drop down instead of one that was shown here
The control you are trying to use is strictly 1 to 1 (does not allow for multiple values), so there isn't really a simple answer to this question, but here are some options:
1- Create 3 custom fields BVT, FVT, and Regression each with a yes/no input.
2- Follow the steps here: Multi-value list control
3- Upgrade to VS2012 and use tagging.

How do I make Automator select a list of files recursively?

I am working on an Automator that needs to open a sequence of files in Photoshop and define them as a pattern (and no, Photoshop Actions will not do it in the way I need it to.) I have the automator application working, but it will not run through the files recursively and instead runs the action on only the first file.
Is there a simple actionScript that can be inserted into the action to run recursively? Or is there a way to use the loop action and select the first file, then have Automator select the next file in sequence?
Currently, my action is in this sequence:
Open Finder Items: in Photoshop
Watch Me Do: selects the correct menu item inside PShop and clicks OK
Close file
It isn't recursive, but you can use the Dispense Items Incrementally action from http://automator.us/leopard/downloads/ - it is used with the Loop action to step through files one at a time.

How can I configure Fitnesse to automatically add the Test property to all pages ending in "Tests"

I its default configuration fitnesse automatically adds the Test property to all pages ending in "Test".
However, in the project I'm working I have to add the Test property to all pages ending in "Tests". Unfortunately, renaming all pages so that they end in "Test" is not a option for me.
Since the 2008xxxx versions of Fitnesse any page that starts or ends with Test is automatically set to be a test page and any page starting or ending in Suite is set to be a suite. This is done on the creation of the page and probably will not work by just renaming the page.
Note: If you have a large number of test pages to retrofit, you could use wingrep/grepwin (or some other tool that can do large scale file search and replace, I personally use grepwin) and manipulate the properties.xml by inserting
<Test>true</Test>
Set the pages test property in one of the following ways:
1. Visit the page, click properties, select the test checkbox.
2. Vist the page with ?properties, select the test checkbox
3. Modify the properties.xml file associated with the page to include the tag inside the block.
Method 3 would be the easiest to automate for a large number of files.
Could probably do this with a grep file utility to do a mass search and replace.
Or a script (powershell) or program to read the files and add this tag if needed.

Resources