Application Method "SMWCindyKate::Page.store_to_PAGES( oPages )"

From SMW CindyKate by dataspects
Component0566509148
Jump to navigation Jump to search
[edit]
Keywords/Contexts

Smw-cindykate

Annotations
{{#compound_query:Component0566509148Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.UseCaseMotivation;?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.Application Method "SMWCindyKate::Page.store_to_PAGES( oPages )";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning Property "-Has subobject" has a restricted application area and cannot be used as annotation property by a user.Application Method "SMWCindyKate::Page.store_to_PAGES( oPages )";?HasDirection;?IsMotivating;?IsMotivatedBy;?HasReasoning
name=MotivationsDeclaredOnThisPageResultItem|link=none}}
Motivations
Lua error in Module:Motivations at line 23: attempt to concatenate field 'hasReasoning' (a nil value).
[edit]

Content


Unit tests covering this application method

TestsAreRunBy {{{2}}}

IsMethodType PageStoringMethod

# 170925
# smw-cindykate/spec/smw-cindykate/page_storing_methods_spec.rb
# TESTSMWID=smwck_restored rspec --format documentation --color spec/smw-cindykate/page_storing_methods_spec.rb
require_relative '../spec_helper.rb'

module SMWCindyKate

  describe Page do
    describe "store_to_PAGES" do

      before(:all) do
        @target_PAGES = SMWCindyKate::Pages.new($options)
        @target_PAGES.from_SMW($profile, $testSMWidentifier)
        @target_PAGES.from_CATEGORIES('TestCategory2')
        @target_PAGES.objectify_wikitexts
        #
        @test_pages = SMWCindyKate::Pages.new($options)
        @test_pages.from_SMW($profile, $testSMWidentifier)
        @test_pages.from_ASK_QUERIES('[[SingleTestPage3]]')
        @test_pages.objectify_wikitexts
        @test_page = @test_pages.pages.values.first
        @test_page.wikitext.set_field_value_for_FIELD_NAME_in_TEMPLATE_NAME_with_NEW_FIELD_VALUE(
          'TestTemplateField0', 'TestTemplate0', 'new_value_170925'
        )
        @test_page.store_to_PAGES(@target_PAGES)
      end
      it "SCENARIO: stores a page object into pages (compare object fields)" do
        expect(
          @target_PAGES.pages['SingleTestPage3'].wikitext.get_value_for_FIELD_NAME_in_TEMPLATE_NAME(
            'TestTemplateField0', 'TestTemplate0'
          )
        ).to eq(
          'new_value_170925'
        )
      end

      it "SCENARIO: stores a page object into pages (compare after objectify/stringify)" do
        new_wikitext = Wikitext.new(@target_PAGES.pages['SingleTestPage3'].wikitext.stringify_wikitext)
        new_wikitext.objectify_wikitext
        expect(
          new_wikitext.get_value_for_FIELD_NAME_in_TEMPLATE_NAME(
            'TestTemplateField0', 'TestTemplate0'
          )
        ).to eq(
          'new_value_170925'
        )
      end
    end

  end
end