spec/unit/resource/parser/property_spec.rb in transcriber-0.0.15 vs spec/unit/resource/parser/property_spec.rb in transcriber-0.0.16
- old
+ new
@@ -1,20 +1,20 @@
require 'spec_helper'
describe Resource::Parser::Property do
subject {Resource::Property.new(:login)}
- let(:value) {"jackiechan2010"}
+ let(:item) {{login: "jackiechan2010"}}
let(:serializer_mock) {mock :serializer}
before do
subject.stub!(:serializer).and_return serializer_mock
end
it "tries to serialize value" do
- serializer_mock.should_receive(:serialize).with(value).and_return(value)
- subject.parse(value)
+ serializer_mock.should_receive(:serialize).with(item[:login]).and_return(item[:login])
+ subject.parse(item)
end
context "when there is a values map" do
let(:values) {{paid: '01', unpaid: '02'}}
@@ -22,10 +22,10 @@
options = {values: values}
Resource::Property.new(:payment_status, options)
end
it "maps value" do
- serializer_mock.should_receive(:serialize).with(value).and_return "02"
- subject.parse(value).should == :unpaid
+ serializer_mock.should_receive(:serialize).with("02").and_return "02"
+ subject.parse({payment_status: "02"}).should == :unpaid
end
end
end