diff options
Diffstat (limited to 'features/step_definitions/dataset_steps.rb')
-rw-r--r-- | features/step_definitions/dataset_steps.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/features/step_definitions/dataset_steps.rb b/features/step_definitions/dataset_steps.rb new file mode 100644 index 0000000..0ba0f96 --- /dev/null +++ b/features/step_definitions/dataset_steps.rb @@ -0,0 +1,26 @@ +Given /^a file (.*)$/ do |filename| + @filename = File.join(File.dirname(__FILE__),'..','data', filename) +end + +When /^I put the file to the dataset URI$/ do + call = "curl -X PUT -F 'file=@#{@filename};type=text/csv' -F compound_format=#{@params['compound_format']} #{@uri + '/import'}" + @uri = `#{call}` +end + +Then /^the URI should return a YAML representation$/ do + valid_yaml = false + begin + @yaml_string = RestClient.get(@uri) + yaml = YAML.load(@yaml_string) + valid_yaml = true + rescue + end + assert valid_yaml, true + #puts @yaml_string +end + +When /^I put YAML data to the dataset URI$/ do + yaml = File.read(@filename) + RestClient.put @uri, :features => yaml +end + |