Tuesday, June 21, 2011

Online JSON viewer

A really nice online JSON viewer with a tree like structure:
Online JSON viewer: http://jsonviewer.stack.hu/

Sunday, June 19, 2011

GIT refusing to update checked out branch: refs/heads/master

To solve this issue below, simply execute this in your master repository:

"git init --bare"

The shared repository has to be a bare repository before your can push into it.

Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 296 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
remote: error: refusing to update checked out branch:
 refs/heads/master
remote: error: By default, updating the current branch 
in a non-bare repository
remote: error: is denied, because it will make the index 
and work tree inconsistent
remote: error: with what you pushed, and will require 
'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' 
configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository
 to allow pushing into
remote: error: its current branch; however, this is not 
recommended unless you
remote: error: arranged to update its work tree to match 
what you pushed in some
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the 
default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration
 variable to 'refuse'.

Testing JS popup box using selenium webdriver

To simulate the user clicking the ok or cancel button for a javascript pop up box simply use the following selenium web driver methods into your steps defintion:

<pre>
page.driver.browser.switch_to.alert.accept #to click ok
page.driver.browser.switch_to.alert.dismiss
</pre>

Wednesday, June 15, 2011

no such file to load require_relative (MissingSourceFile)

This error was introduced when I gem install ruby-debug (June 2011) and Ruby-debug install linecache gem 0.45 by default. Linecache 0.45 causes this "no such file to load require_relative (MissingSourceFile)". To fix this is to downgrade linecache to the earlier version such as 0.43

Could not find generator cucumber:install

>$ rails generate cucumber:install --capybara
Could not find generator cucumber:install.

I fix this by installing cucumber-rails gem instead of the cucumber gem.

gem install cucumber-rails
or you can put it in your bundle file.

source 'http://rubygems.org'
.
.
.
group :test do
  gem 'rspec', '2.5.0'
  gem 'capybara'
  gem 'cucumber-rails'
end

rails generate cucumber:install --capybara

create config/cucumber.yml
create script/cucumber
chmod script/cucumber
create features/step_definitions
create features/step_definitions/web_steps.rb
create features/support
create features/support/paths.rb
create features/support/selectors.rb
create features/support/env.rb
exist lib/tasks
create lib/tasks/cucumber.rake
gsub config/database.yml
gsub config/database.yml
force config/database.yml