OSDN Git Service

t#31076:import methods move to model
[pettanr/pettanr.git] / spec / models / provider_spec.rb
index 3f87421..b5f1b3a 100644 (file)
@@ -606,4 +606,28 @@ describe Provider do
     end
   end
   
+  describe 'エクスポートurl取得に於いて' do
+    before do
+      @ps = FactoryGirl.create :provider_status
+      @provider = FactoryGirl.create :provider, :provider_status_id => @ps.id, :demander_url => 'http://demander.url/'
+    end
+    context 'つつがなく終わるとき' do
+      before do
+      end
+      it 'エクスポートurl文字列を返す' do
+        r = @provider.export_url 'action'
+        r.should eq 'http://demander.url/action.json'
+      end
+    end
+    context '借手urlが/で終わらないとき' do
+      before do
+        @provider.demander_url = 'http://demander.url'
+      end
+      it '末尾に/を追加する' do
+        r = @provider.export_url 'action'
+        r.should eq 'http://demander.url/action.json'
+      end
+    end
+  end
+  
 end