Is there any plugin available for breakman in rubymine? - ruby

Im planning to use brakeman in my ruby app , is there any way to use brakeman in rubymine ? (able to configure robocop)

At the moment there's no plugin for that, but there's a feature request on RubyMine's tracker for adding support to Brakeman so your vote is welcome: https://youtrack.jetbrains.com/issue/RUBY-17517

Related

Asana API: How do I set the Section of a Task on My Tasks

Asana has Sections on the My Tasks View. I want to use the Asana Ruby API to update the My Tasks Section of a given pre-existing task.
I have been spending hours trying to get this to work on the latest version of the Ruby Asana API Gem.
The API support for this new feature seems spotty, but this thread indicates it's possible using the /tasks/task-id/addProject endpoint.
Attempting to hit this endpoint with the Asana Ruby Gem is not working for me:
#client.tasks.add_project_for_task(task_gid: task.gid, section: section_id, project: ENV['my_tasks_project_id'])
This gives:
Asana::Errors::InvalidRequest: section: Not the correct type
Okay, so that's presumably because it's a special My Tasks section, rather than a typical project section. So let's try with assignee_section
#client.tasks.add_project_for_task(task_gid: task.gid, assignee_section: section_id, project: ENV['my_tasks_project_id'], options: {pretty: true})
No error from this, but it does nothing. So how do I set the My Tasks section of a pre-existing task with the Ruby Asana gem?
It might be that the Asana Ruby SDK is too out of date to do this at all, and I need to write a custom body for the request. I'd be interested in how to write such a custom body request from within the gem, if a raw/custom body is the only way.
Simple solution, just set task_updates[:assignee_section] with the My Tasks section Gid. Then task.update(task_updates)
My Task sections are fundamentally different than normal Project sections. Hope this helps future people

how generate logs and reports in ruby capybara rspec

I am new to this technology and I am working on an automation framework, ruby-capybara-rspec. And this project is in POC state. Now I want to generate "Logs" and "reports" as well. Please help me if there is any default/inbuilt functionality to do so or is there any specific gem I can use to achieve it. Thank you in advance.
PS: There is no specific ask from the client so I can bring my own logging and report to this framework.
From the official documentation:
rspec example_spec.rb --format documentation --out rspec.txt

Moodle with Ruby On Rails

Currently, I am working on a rails application which requires the user to be registered automatically in the moodle. I searched for it and found these gems,
moodle-api: https://github.com/getsmarter/moodle-api
moodle_rb: https://github.com/jobready/moodle-rb/
moodle: https://github.com/robertboloc/moodle
But, nothing seems to work for me. I even searched on youtube but found nothing with the rails.
However, using the moodle_rb gem I was able to create an object which returned me the sites info using the sites_info function. Other than that I am unable to use any of the web services of the moodle. I have created an external service and added some functions like auth_email_get_signup_settings and auth_email_signup_user which accepts none parameters.
May anyone guides me through this? or even a minor help would also be great.
I am using a token to create the object.
Thanks in advance.
Can you show us how you tried to configure your gems? For example, according to the docs the moddle-api gem requires a configuration like:
Moodle::Api.configure do|c|
c.host = 'http://my_moodle_instance.com'
c.token = 'mytoken'
end
If you did configure the gem like the above, can you show some of the code that you tried to call once the gem was installed and configured?

How do I ignore requests to a certain route in Sinatra when using NewRelic?

We're using NewRelic to monitor a Sinatra app. We don't want the probe URL varnish uses to check if the app is online to be instrumented by NewRelic. How do we tell NewRelic to ignore a certain Sinatra route? (The documentation only seems to refer to how to do this in Rails: https://newrelic.com/docs/ruby/blocking-controller-instrumentation)
You could try calling NewRelic::Agent.abort_transaction! within the code path for the probe request. See the API docs for details.
Have you tried what their docs suggest https://newrelic.com/docs/ruby/sinatra-support-in-the-ruby-agent
newrelic_ignore '/ping'
As of version 3.6.3 of the NewRelic gem, you can should be able to use the 'newrelic_ignore' method to ignore endpoints. If you are using Sinatra, you may need to call this class method explicitly, like so:
NewRelic::Agent::Instrumentation::Sinatra::newrelic_ignore('/route/to/ignore')
But, it doesn't work as expected. I am filing a bug report with NewRelic.

File uploads using the selenium-client gem

I am using the selenium-client gem with Webrat and Cucumber to test a rails project. I have Cucumber set up pretty much as described here: https://github.com/cucumber/cucumber/wiki/Setting-up-Selenium
My problem is that Selenium is prevented from performing file uploads. Ideally I'd like to be able to replicate webrat's 'attach_file' method. I tried dodging the issue by using selenium-client's 'type' method to type the path to the required file, but this seems to fail.
Does anyone have a sugestion for a workaround using selenium-client (i.e. not the regular Selenium gem)?
The normal selenium can't do this because browser security prevents javascript from writing to input=file elements. This is a security feature so that your password file doesnt get uploaded to hackers if you go to a site thats been hacked.
http://jira.openqa.org/browse/SEL-63 has the details
I finally figured this out.
You need to be using firefox with the chrome backend, and you need to specifiy an absolute filepath.
I ended up creating a helper module to specify the filepath, and a "fixtures" folder containing test content. Here is a gist of the solution I came up with: http://gist.github.com/214185
Therefore it is totally possible to replicate Webrat's attach_file method!

Resources