Sha256: 360db5853630982d639a95a8bb981e016a8e28d087e72d559fdb01acb35b2a46

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

# -*- coding : utf-8 -*-
require 'spec_helper'

describe Mushikago::Hanamgri::TrainRequest do
  before :all do
    @training_data = Mushikago::Hanamgri::TrainingData.new do
      put("name", "株式会社マイニングブラウニー")
      put("address", "東京都中央区日本橋浜町1−2−3")
      put("tel", "03-6206-2812")
    end
  end

  shared_examples_for 'a valid train instance' do |domain_name, url_or_html|
    subject{ Mushikago::Hanamgri::TrainRequest.new(domain_name, url_or_html, @training_data) }
    it{ should be_kind_of(Mushikago::Http::PostRequest) }
    its(:path){ should == "/1/hanamgri/domains/#{domain_name}/train" }
    its(:domain_name){ should == domain_name }
    its(:url_or_html){ should == url_or_html }
    its(:training_data){ should == @training_data.to_json }
  end

  test_parameters = [
    ['domain_name', 'http://www.mushikago.org'],
    ['domain_name', '<div>hello mushikago</div>'],
  ].each do |domain_name, url|
    context ".new(#{domain_name}, #{url})" do
      it_should_behave_like 'a valid train instance', domain_name, url
    end
  end
end

Version data entries

11 entries across 8 versions & 1 rubygems

Version Path
mushikago-sdk-2.4.3 spec/mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.4.3 spec//mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.4.2 spec/mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.4.2 spec//mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.4.1 spec/mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.4 spec/mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.2 spec/mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.2 spec//mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.1.1 spec/mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.1.0 spec/mushikago/hanamgri/train_spec.rb
mushikago-sdk-2.0.0 spec/mushikago/hanamgri/train_spec.rb