Skip to content
Newer
Older
100644 27 lines (20 sloc) 657 Bytes
fe3a56d @luxflux add tests for Her::Collection
luxflux authored Dec 14, 2012
1 require 'spec_helper'
2
3 describe Her::Collection do
4
875bd42 @remiprev Refactor several tests with better RSpec practices
authored Jan 19, 2013
5 let(:items) { [1, 2, 3, 4] }
6 let(:metadata) { { :name => 'Testname' } }
7 let(:errors) { { :name => ['not_present'] } }
fe3a56d @luxflux add tests for Her::Collection
luxflux authored Dec 14, 2012
8
9 describe "#new" do
10 context "without parameters" do
11 subject { Her::Collection.new }
12
875bd42 @remiprev Refactor several tests with better RSpec practices
authored Jan 19, 2013
13 it { should eq([]) }
14 its(:metadata) { should eq({}) }
15 its(:errors) { should eq({}) }
fe3a56d @luxflux add tests for Her::Collection
luxflux authored Dec 14, 2012
16 end
17
18 context "with parameters" do
875bd42 @remiprev Refactor several tests with better RSpec practices
authored Jan 19, 2013
19 subject { Her::Collection.new(items, metadata, errors) }
fe3a56d @luxflux add tests for Her::Collection
luxflux authored Dec 14, 2012
20
875bd42 @remiprev Refactor several tests with better RSpec practices
authored Jan 19, 2013
21 it { should eq([1,2,3,4]) }
22 its(:metadata) { should eq({ :name => 'Testname' }) }
23 its(:errors) { should eq({ :name => ['not_present'] }) }
fe3a56d @luxflux add tests for Her::Collection
luxflux authored Dec 14, 2012
24 end
25 end
26 end
Something went wrong with that request. Please try again.