diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-02 16:36:21 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-02 17:00:48 +0300 |
commit | f1e9c97d64b96bdd398616743ad048f8d147e26b (patch) | |
tree | c90b227256a610d4b639183c5e9b093de35d60f9 /spec | |
parent | acfe394018df50bfc08aa9e41265231747675646 (diff) |
Use entity request object in environment entity
Diffstat (limited to 'spec')
-rw-r--r-- | spec/serializers/environment_serializer_spec.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index 3470863681c..cd9486111f1 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -2,18 +2,21 @@ require 'spec_helper' describe EnvironmentSerializer do let(:serializer) do - described_class.new(path: 'some path').represent(resource) + described_class.new(path: 'some path', user: user) + .represent(resource) end + let(:user) { create(:user) } + context 'when there is a single object provided' do let(:resource) { create(:environment) } it 'shows json' do - puts serializer.to_json + puts serializer.as_json end it 'it generates payload for single object' do - expect(parsed_json).to be_an_instance_of Hash + expect(serializer.as_json).to be_an_instance_of Hash end end @@ -21,15 +24,11 @@ describe EnvironmentSerializer do let(:resource) { create_list(:environment, 2) } it 'shows json' do - puts serializer.to_json + puts serializer.as_json end it 'generates payload for collection' do - expect(parsed_json).to be_an_instance_of Array + expect(serializer.as_json).to be_an_instance_of Array end end - - def parsed_json - JSON.parse(serializer.to_json) - end end |