Skip to content

Instantly share code, notes, and snippets.

View renugasaraswathy's full-sized avatar

Saraswathy Renuga renugasaraswathy

View GitHub Profile
@renugasaraswathy
renugasaraswathy / login_using_facebook_spec.rb
Created June 7, 2019 20:14
Testing Facebook login with Rspec & Capybara using koala gem- Ruby on Rails
require 'rails_helper'
require 'koala'
feature 'Login using facebook' do
before do
@test_users_api=Koala::Facebook::TestUsers.new(:app_id =>FB_APP_ID , :secret =>FB_SECRET_KEY)
@test_user=@test_users_api.create(false)
end
after do
@test_users_api.delete(@test_user["id"])
@renugasaraswathy
renugasaraswathy / sum_of_digits_is_7.rb
Created March 12, 2015 16:01
Display all numbers between 1 to 1000 whose sum of digits is 7
#This program produces the expected result in less number of iteration.
x=*(0...100)
x.each do |y|
str=y.to_s
removed_last_digit=str[0..-1]
s=removed_last_digit.split('').collect(&:to_i).reduce(:+)
if s<=7
diff=7-s
number=str.to_s+diff.to_s