Sha256: a70a49dd74c85541a471b21014e8a4de1deb7833ad9d4b9ac870d7fd1a8cd209
Contents?: true
Size: 778 Bytes
Versions: 7
Compression:
Stored size: 778 Bytes
Contents
def it_acts_as_single_create_command(namespace, type) plural = type.to_s.pluralize.to_sym namespaced_type = "#{namespace.to_s.camelize}::#{type.to_s.camelize}" model_class = "Models::#{namespaced_type}".constantize serializer_class = "Serializers::#{namespaced_type}".constantize let(:response) { subject.class.run(params) } context "with valid params" do context "when creating a single item" do let(:item) { build("api_#{type}".to_sym) } let(:params) { item } it "returns the newly created #{type}" do response.success?.should == true response.result[:id].should_not == nil model = model_class.find(response.result[:id]) response.result.should == serializer_class.as_json(model) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems