This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//date formatting | |
import java.util.Date; | |
import java.text.SimpleDateFormat; | |
import java.util.TimeZone; | |
//http request | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.DataOutputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "updating matching categories on project save", :focus do | |
let(:project) { Factory.build :project } | |
before(:each) do | |
@old_matching_categories = project.matching_categories | |
end | |
it "should update the matching categories after updating the category and saving the project" do | |
project.category = "C01" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def seek_and_replace(array_of_keys, new_value) | |
last_level = self | |
sought_value = nil | |
array_of_keys.each_with_index do |_key_, _idx_| | |
if last_level.is_a?(Hash) && last_level.has_key?(_key_) | |
if _idx_ + 1 == array_of_keys.count | |
last_level[_key_] = new_value | |
else | |
last_level = last_level[_key_] |