diff options
| author | Alban Peignier | 2012-06-07 13:39:35 +0200 |
|---|---|---|
| committer | Alban Peignier | 2012-06-07 13:39:35 +0200 |
| commit | 7c0ae629a2ea0079c8b5efbd4c41b6ca661eae91 (patch) | |
| tree | 26195fe0d4eb8e77a89a9dadaf25626fc3f7fc50 /spec/models/export_spec.rb | |
| parent | 1d72c64b77c20d0d3b0bf4b05c40ba99a97493bd (diff) | |
| download | chouette-core-7c0ae629a2ea0079c8b5efbd4c41b6ca661eae91.tar.bz2 | |
Add support for Exports. Refs #41
Diffstat (limited to 'spec/models/export_spec.rb')
| -rw-r--r-- | spec/models/export_spec.rb | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/models/export_spec.rb b/spec/models/export_spec.rb new file mode 100644 index 000000000..bccaa4c42 --- /dev/null +++ b/spec/models/export_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +describe Export do + + subject { create :export } + + RSpec::Matchers.define :be_log_message do |expected| + match do |actual| + actual and expected.all? { |k,v| actual[k.to_s] == v } + end + end + + describe "#export" do + + before(:each) do + subject.stub :exporter => mock(:export => true) + end + + it "should create a ExportLogmessage :started when started" do + subject.export + subject.log_messages.first.should be_log_message(:key => "started") + end + + it "should create a ExportLogmessage :completed when completed" do + subject.export + subject.log_messages.last.should be_log_message(:key => "completed") + end + + it "should create a ExportLogmessage :failed when failed" do + pending + # subject.loader.stub(:export).and_raise("export failed") + subject.export + subject.log_messages.last.should be_log_message(:key => "failed") + end + + end + + describe "#options" do + + it "should be empty by default" do + subject.options.should be_empty + end + + end + + describe ".types" do + + it "should return available Export implementations" do + pending + Export.types.should =~ %w{NeptuneExport} + end + + end + + describe ".new" do + + it "should use type attribute to create a subclass" do + Export.new(:type => "NeptuneExport").should be_an_instance_of(NeptuneExport) + end + + end + +end |
