This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project < ActiveRecord::Base | |
after_create :send_create_notifications | |
private | |
def send_create_notifications | |
self.members.each do |member| | |
ProjectMailer.deliver_notification(self, member) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def followers_count(user) | |
c = Twitter.followers_count(user) | |
user.update_attribute(:followers_count, c) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stub_request(:any, "api.twitter.com/followrs/count").with(:body=>'Hi') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'webmock/rspec' | |
RSpec.configure do |config| | |
WebMock.disable_net_connect! | |
require 'vcr' | |
VCR.config do |c| | |
c.cassette_library_dir = 'vcr_cassettes' | |
c.stub_with :webmock | |
c.default_cassette_options = { :record => :once } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should get followers count" do | |
VCR.use_cassette('twi_followers_count') do | |
MyModel.followers_count(@user).should == 3 | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HtmlReporter | |
def make_report(data) | |
make_html_header | |
make_html_body | |
make_html_footer | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HtmlReporter | |
def make_report(data) | |
make_html_header | |
make_html_body | |
make_html_footer | |
end | |
end | |
class PdfReporter | |
def make_report(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Report | |
def make_report(data) | |
make_header | |
make_body | |
make_footer | |
end | |
protected | |
# методы ничего не реализуют |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HtmlReporter < SomthingElse | |
include Reporter | |
protected | |
# реализация методов для html-версии | |
def make_header | |
end | |
def make_body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass | |
def do_somth_with_class | |
OtherClass.method | |
other_stuff | |
end | |
end |
OlderNewer