Sha256: 35da5d2ca743ae2ffa2bbafb5360665906b471c2e286573cb560eff32ac22d5d

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe Herder::Interaction do
  it "should setup right name" do
    Herder::Interaction.element_name.should be == "interaction"
  end

  it "should inherit Herder::Model" do
    Herder::Email.new.should be_a(Herder::Model)
  end

  describe "#toggle" do
    it "should remove the interaction" do
      interaction = Herder::Interaction.new key: "foo", value: true
      query = mock "Query"
      interaction.should_receive(:query).and_return(query)
      query.should_receive(:set).with("foo").and_return(query)
      query.should_receive(:to).with(false)
      interaction.toggle
    end
  end

  describe "#undo!" do
    it "should remove the interaction" do
      interaction = Herder::Interaction.new value: "foo"
      interaction.should_receive(:destroy)
      interaction.undo!
    end
  end

  describe "#to_s" do
    it "should be represented by value" do
      interaction = Herder::Interaction.new value: "foo"
      interaction.to_s.should be == "foo"
    end
  end

  describe "#==" do
    it "should compare by value" do
      interaction = Herder::Interaction.new value: "foo"
      interaction.should be == "foo"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
herder-0.0.5 spec/herder/interaction_spec.rb
herder-0.0.4 spec/herder/interaction_spec.rb