Sha256: fc8b7ce8ba7b89109873e1d6a16be29b670631a8449b354de3ddebabf2e093f5

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

require 'spec_helper'

describe 'Metadata' do
  describe '/metadata.json' do
    before do
      # 実行順により base_spec で作られた Classオブジェクトが返って来て意図通りのテストにならないため
      allow(TogoStanza::Stanza).to receive(:all).and_return([BarStanza, FooStanza])

      visit '/metadata.json'
    end

    it 'should return metadata as JSON' do
      json = JSON.parse(page.body)

      json["stanza:stanzas"].class.should eq(Array)
      json["stanza:stanzas"].first.should include('stanza:label' => 'Foo Stanza')
    end
  end

  describe '/:id/metadata.json' do
    before do
      visit '/foo/metadata.json'
    end

    it 'should return metadata as JSON' do
      json = JSON.parse(page.body)

      json.should include('stanza:label' => 'Foo Stanza')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
togostanza-1.5.0 spec/features/metadata_spec.rb
togostanza-1.4.1 spec/features/metadata_spec.rb
togostanza-1.4.0 spec/features/metadata_spec.rb
togostanza-1.3.3 spec/features/metadata_spec.rb
togostanza-1.3.2 spec/features/metadata_spec.rb
togostanza-1.3.1 spec/features/metadata_spec.rb
togostanza-1.3.0 spec/features/metadata_spec.rb