aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter_http.h
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-09-05 12:31:22 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-09-05 12:31:22 +0100
commitfef78131a46462ee1d1457aa690c52a52b23151a (patch)
treec4ecee50eb32da7aee9587b7a107eb2ab348e48a /protocols/twitter/twitter_http.h
parent41e0c00fd22d1cdace2040be5912d64f51f12ab8 (diff)
Fix compiler warnings. Also fixing irc_send_motd(), which so far got away
with a horrible practice of reading the MOTD file one by one.
Diffstat (limited to 'protocols/twitter/twitter_http.h')
0 files changed, 0 insertions, 0 deletions
0.0.11'>hotfix/0.20.0.11 Unnamed repository; edit this file 'description' to name the repository.MimesBrønn
aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/rspec-rails-1.3.3/spec/spec/rails/mocks/mock_model_spec.rb
blob: 0abcd08c1ca172a5715d3b6e1701bb4bc6ee82bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
require 'spec_helper'
require File.dirname(__FILE__) + '/ar_classes'

describe "mock_model" do
  describe "responding to interrogation" do
    before(:each) do
      @model = mock_model(SubMockableModel)
    end
    it "should say it is_a? if it is" do
      @model.is_a?(SubMockableModel).should be(true)
    end
    it "should say it is_a? if it's ancestor is" do
      @model.is_a?(MockableModel).should be(true)
    end
    it "should say it is kind_of? if it is" do
      @model.kind_of?(SubMockableModel).should be(true)
    end
    it "should say it is kind_of? if it's ancestor is" do
      @model.kind_of?(MockableModel).should be(true)
    end
    it "should say it is instance_of? if it is" do
      @model.instance_of?(SubMockableModel).should be(true)
    end
    it "should not say it instance_of? if it isn't, even if it's ancestor is" do
      @model.instance_of?(MockableModel).should be(false)
    end
    it "should say it is not destroyed" do
      @model.destroyed?(SubMockableModel).should be(false)
    end
    it "should say it is not marked_for_destruction" do
      @model.marked_for_destruction?.should be(false)
    end
  end

  describe "with params" do
    it "should not mutate its parameters" do
      params = {:a => 'b'}
      model = mock_model(MockableModel, params)
      params.should == {:a => 'b'}
    end
  end

  describe "with #id stubbed", :type => :view do
    before(:each) do
      @model = mock_model(MockableModel, :id => 1)
    end
    it "should be named using the stubbed id value" do
      @model.instance_variable_get(:@name).should == "MockableModel_1"
    end
    it "should return string of id value for to_param" do
      @model.to_param.should == "1"
    end
  end

  describe "as association", :type => :view do
    before(:each) do
      @real = AssociatedModel.create!
      @mock_model = mock_model(MockableModel)
      @real.mockable_model = @mock_model
    end

    it "should pass associated_model == mock" do
        @mock_model.should == @real.mockable_model
    end

    it "should pass mock == associated_model" do
        @real.mockable_model.should == @mock_model
    end
  end

  describe "with :null_object => true", :type => :view do
    before(:each) do
      @model = mock_model(MockableModel, :null_object => true, :mocked_method => "mocked")
    end

    it "should be able to mock methods" do
      @model.mocked_method.should == "mocked"
    end
    it "should return itself to unmocked methods" do
      @model.unmocked_method.should equal(@model)
    end
  end

  describe "#as_null_object", :type => :view do
    before(:each) do
      @model = mock_model(MockableModel, :mocked_method => "mocked").as_null_object
    end

    it "should be able to mock methods" do
      @model.mocked_method.should == "mocked"
    end
    it "should return itself to unmocked methods" do
      @model.unmocked_method.should equal(@model)
    end
  end

  describe "#as_new_record" do
    it "should say it is a new record" do
      mock_model(MockableModel).as_new_record.should be_new_record
    end

    it "should have a nil id" do
      mock_model(MockableModel).as_new_record.id.should be(nil)
    end

    it "should return nil for #to_param" do
      mock_model(MockableModel).as_new_record.to_param.should be(nil)
    end
  end
end